Rosmar Bootstrap TouchMetadataDocument CAS fix#8289
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves correctness and cross-backend consistency for CAS behavior around “touch” operations, particularly for bootstrap metadata documents used by config rollback logic, and adds tests to lock in the intended semantics for both Couchbase Server and Rosmar.
Changes:
- Update Rosmar bootstrap
TouchMetadataDocumentto perform a CAS-checked xattr mutation (TouchXattrWithCas) instead of touching the whole document. - Add tests to ensure
TouchMetadataDocumentrejects stale CAS values and bumps CAS on success, and that standardTouch/GetAndTouchRawpreserve CAS. - Bump the
github.com/couchbaselabs/rosmardependency to pick up required CAS/touch semantics.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Updates Rosmar dependency version needed for CAS-safe touch behavior. |
| go.sum | Updates checksums for the new Rosmar version. |
| base/rosmar_cluster.go | Returns a concrete *rosmar.Collection and updates TouchMetadataDocument to do CAS-checked xattr mutation. |
| base/bucket_gocb_test.go | Adds test asserting Touch and GetAndTouchRaw preserve CAS (no CAS bump). |
| base/bootstrap_test.go | Adds test asserting TouchMetadataDocument enforces CAS correctness and bumps CAS on success. |
… CB Server implementation
b6558db to
b11871b
Compare
09c1510 to
fca2822
Compare
gregns1
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improved testing and correctness for document touch and CAS behavior across both Couchbase Server and Rosmar implementations.
It adds new tests to verify that CAS handling is consistent and correct, and updates the Rosmar cluster logic to ensure type safety and correct CAS mutation semantics.
Testing and validation of CAS behavior:
TestTouchMetadataDocumentinbootstrap_test.goto verify thatBootstrapConnection.TouchMetadataDocumentenforces CAS correctness—rejecting stale CAS values and bumping the CAS on successful mutation, which is critical for blocking racing writers during registry rollback.TestTouchPreservesCASinbucket_gocb_test.goto confirm that standardTouchandGetAndTouchRawoperations do not bump the CAS, matching Couchbase Server's memcached semantics. This clarifies that callers needing a CAS bump must use a real mutation.Rosmar cluster improvements:
getDefaultDataStoreinrosmar_cluster.goto perform a type assertion, ensuring the returned data store is a*rosmar.Collection. This allows us to run Rosmar specific methods without doing type assertions elsewhere.TouchMetadataDocumentinrosmar_cluster.goto useTouchXattrWithCas, ensuring that property updates in metadata documents are CAS-checked and mutate only the intended property rather than the entire document.Dependencies (if applicable)
Integration Tests
TestChangeIndexPartitionsStartStopAndRestart