-
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-3849 Remove inline cas handling for xattr config persistence #6850
Conversation
CI failure on test-race appears to be unrelated issue. |
base/config_persistence.go
Outdated
if bodyErr != nil { | ||
restoreErr := xbp.restoreDocumentBody(c, key, valuePtr, strCas) | ||
var restoreErr error | ||
casOut, restoreErr = xbp.restoreDocumentBody(c, key, valuePtr, res.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.
If there's an error here, I think casOut
will be updated to 0, which might not be correct? The tombstone document will have a cas.
OTOH, the cas isn't super useful
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 can also see how if there's no document, then it should have a zero cas. I'm not sure what to do here.
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 think you're correct - if the restore fails we should return the cas of the current version of the document (the tombstone), since we're returning the tombstone's xattr.
base/config_persistence.go
Outdated
// Restore a deleted document's body. Rewrites metadata, but preserves previous cfgCas | ||
func (xbp *XattrBootstrapPersistence) restoreDocumentBody(c *gocb.Collection, key string, value interface{}, cfgCas string) error { | ||
// Restore a deleted document's body. Rewrites metadata | ||
func (xbp *XattrBootstrapPersistence) restoreDocumentBody(c *gocb.Collection, key string, value interface{}, cas gocb.Cas) (casOut gocb.Cas, err 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.
We aren't using a cas check here because there aren't cas checks on insert. I think you can remove cas
from an argument here.
We are sure that there is no document existing because on gocb.StoreSemanticsInsert
CBG-3849
Remove inline cas usage for xattr config persistence - use standard document CAS semantics.
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/2468/Ran additional integration test with forced use of XattrBootstrapPersistence for all tests:
https://jenkins.sgwdev.com/job/SyncGateway-Integration/2463/
Triaged the three failures from that run: