-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-5024 Remove non multisubdoc xattr support #7897
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR removes legacy code paths that supported non-multisubdoc xattr operations in Couchbase Server versions prior to 7.6. Since Sync Gateway 4.0+ requires CBS 7.6 or higher, the multisubdoc xattr feature is always available, eliminating the need for conditional logic and fallback mechanisms.
Key changes:
- Removed
EnableMouandUseMou()checks throughout the codebase - Simplified xattr operations by assuming multisubdoc support is always available
- Cleaned up test code that conditionally skipped tests or used different code paths based on CBS version
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rest/importtest/import_test.go | Removed test skip for multisubdoc feature check |
| db/util_testing.go | Removed fallback code for single-xattr deletion in purgeWithDCPFeed |
| db/import_test.go | Removed conditional logic for MOU xattr testing |
| db/import.go | Removed useMou() conditional checks |
| db/database_collection.go | Simplified xattr key collection and removed useMou() helper |
| db/database.go | Removed EnableMou field, initialization, and UseMou() method |
| db/crud.go | Removed useMou() check when writing MOU xattr |
| db/background_mgr_resync_dcp_test.go | Removed test skip for multisubdoc feature check |
| base/collection_xattr_test.go | Removed conditional test case additions based on multisubdoc support |
| base/collection_xattr.go | Removed fallback logic for single/dual xattr operations |
| base/bucket_gocb_test.go | Removed conditional test behavior based on multisubdoc support |
| doc.MetadataOnlyUpdate = computeMetadataOnlyUpdate(doc.Cas, doc.RevSeqNo, doc.MetadataOnlyUpdate) | ||
|
|
||
| _, rawSyncXattr, rawVvXattr, rawMouXattr, rawGlobalXattr, err := updatedDoc.MarshalWithXattrs() | ||
| updatedDoc := sgbucket.UpdatedDoc{ | ||
| Doc: nil, // Resync does not require document body update | ||
| Xattrs: map[string][]byte{ | ||
| base.SyncXattrName: rawSyncXattr, | ||
| base.VvXattrName: rawVvXattr, | ||
| base.MouXattrName: rawMouXattr, | ||
| }, | ||
| Expiry: updatedExpiry, | ||
| } | ||
| if db.useMou() { | ||
| updatedDoc.Xattrs[base.MouXattrName] = rawMouXattr | ||
| if doc.MetadataOnlyUpdate.HexCAS == expandMacroCASValueString { | ||
| updatedDoc.Spec = append(updatedDoc.Spec, sgbucket.NewMacroExpansionSpec(XattrMouCasPath(), sgbucket.MacroCas)) | ||
| } | ||
| if doc.MetadataOnlyUpdate.HexCAS == expandMacroCASValueString { |
Copilot
AI
Nov 26, 2025
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.
The variable updatedDoc shadows the outer variable updatedDoc from line 1852. Consider renaming one of them (e.g., rename the sgbucket.UpdatedDoc to updatedDocData) to avoid confusion.
CBG-5024 Remove non multisubdoc xattr support
Code cleanup of dead code pathways in post Sync Gateway 4.0. This does not do all the tasks described in CBG-5024 to make code review processes easier.
Pre-review checklist
fmt.Print,log.Print, ...)base.UD(docID),base.MD(dbName))docs/apiIntegration Tests
GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGatewayIntegration/176/