Skip to content

Rosmar Bootstrap TouchMetadataDocument CAS fix#8289

Merged
bbrks merged 6 commits into
mainfrom
rosmar_touchmetadatadocument_with_touchxattrwithcas
May 26, 2026
Merged

Rosmar Bootstrap TouchMetadataDocument CAS fix#8289
bbrks merged 6 commits into
mainfrom
rosmar_touchmetadatadocument_with_touchxattrwithcas

Conversation

@bbrks
Copy link
Copy Markdown
Member

@bbrks bbrks commented May 22, 2026

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:

  • Added TestTouchMetadataDocument in bootstrap_test.go to verify that BootstrapConnection.TouchMetadataDocument enforces CAS correctness—rejecting stale CAS values and bumping the CAS on successful mutation, which is critical for blocking racing writers during registry rollback.
  • Added TestTouchPreservesCAS in bucket_gocb_test.go to confirm that standard Touch and GetAndTouchRaw operations 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:

  • Updated getDefaultDataStore in rosmar_cluster.go to 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.
  • Modified TouchMetadataDocument in rosmar_cluster.go to use TouchXattrWithCas, 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

Copilot AI review requested due to automatic review settings May 22, 2026 13:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TouchMetadataDocument to perform a CAS-checked xattr mutation (TouchXattrWithCas) instead of touching the whole document.
  • Add tests to ensure TouchMetadataDocument rejects stale CAS values and bumps CAS on success, and that standard Touch/GetAndTouchRaw preserve CAS.
  • Bump the github.com/couchbaselabs/rosmar dependency 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.

@bbrks bbrks force-pushed the rosmar_touchmetadatadocument_with_touchxattrwithcas branch from b6558db to b11871b Compare May 25, 2026 12:36
@bbrks bbrks requested a review from gregns1 May 25, 2026 12:37
@bbrks bbrks force-pushed the rosmar_touchmetadatadocument_with_touchxattrwithcas branch from 09c1510 to fca2822 Compare May 25, 2026 12:44
@bbrks bbrks merged commit 3f6d4b9 into main May 26, 2026
28 checks passed
@bbrks bbrks deleted the rosmar_touchmetadatadocument_with_touchxattrwithcas branch May 26, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants