-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBG-4365 rosmar xdcr, use _mou.cas for conflict resolution #7206
Conversation
xdcr/rosmar_xdcr.go
Outdated
@@ -373,3 +388,21 @@ func updateHLV(xattrs map[string][]byte, sourceHLV *db.HybridLogicalVector, sour | |||
} | |||
return nil | |||
} | |||
|
|||
// getConflictResolutionCas returns cas for conflict resolution. If thethe conflict resolution cas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here? I think it would be good to include on the comment the expected interaction between actual cas and mou cas, something like the below:
If we have:
- the _mou.cas == actualCas we will return _vv.cvCAS for conflict resolution,
- if mou.Cas is out of date we will use _vv.ver
- if mou.Cas is not out of date but there is no HLV we return 0 to match XDCR
xdcr/rosmar_xdcr.go
Outdated
@@ -342,21 +350,24 @@ func getHLVAndMou(xattrs map[string][]byte) (*db.HybridLogicalVector, *db.Metada | |||
return hlv, mou, nil | |||
} | |||
|
|||
func updateHLV(xattrs map[string][]byte, sourceHLV *db.HybridLogicalVector, sourceMou *db.MetadataOnlyUpdate, sourceID string, sourceCas uint64) error { | |||
func updateHLV(xattrs map[string][]byte, sourceHLV *db.HybridLogicalVector, sourceMou *db.MetadataOnlyUpdate, sourceID string, copiedCas uint64) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what 'copiedCas' implies here (as opposed to source cas) - maybe a comment to explain?
CBG-4365 rosmar xdcr, use _mou.cas for conflict resolution
I ran topologytests without a skip on
TestHLVUpdateDocumentSingleActor
and they now intermittently pass, rather than consistently fail without this patch.The guts of this ticket are to consider the cas for conflict resolution in xdcr as actual cas, unless
_mou.cas == doc cas
, in which case, using_hlv.cvCas
is correct. This matches the behavior of server XDCR.MetadataOnlyUpdate
is one of the only datastructures that we have that stores cas as a string, and that's fine for serialization but problematic for comparison. I decided to write method to convert the data rather than writing yet more comparisons in xdcr code. I don't think it makes sense to change the data on marshal and unmarshal due to the use of string comparison incomputeMetadataOnlyUpdate
but maybe having it convert all the values to hex on marshal/unmarshal would make more sense.Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/2810/