Conversation
Collaborator
Author
|
This has some implications on code I wanted to do for #8074 / #8057 but I can drop this and determine in a better way if a bucket is a rosmar bucket and add this to DatabaseContext struct if I don't want to do However, the code in Line 2140 in d4290f6 db package since spec.Server == ""
|
bbrks
approved these changes
Feb 23, 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.
Decouple BucketSpec from DatabaseContext
This fixes an issue where
DatabaseContext.BucketSpecwas only set by the initialization ofNewDatabaseContextinserver_context.go. This meant that a call likedb.BucketSpec.IsWalrusBucket()would only be valid if called viaserver_context.goand not in the db package. This addresses problems running unit tests, but does not affect production code.I am planning to add a check for using rosmar bucket to avoid sharded DCP code, and it was adding this code where I realized there was a problem.
I considered alternate approaches, and I'm open to these or others:
BucketSpecas a parameter toDatabaseContextOptions. This would work but I would have had to modify more test code.NewDatabaseContextby either finding bucketSpec after type assertion toGocbV2Bucketor reconstructing the value from rosmar. The problem is that once a rosmar bucket has been opened, I would have to modifyrosmar.Bucketto be able to findBucketSpec.Serversync_gateway/base/bucket.go
Line 287 in 61cf3eb
BucketSpeccode into sgbucket and addBucketStore.GetSpecinterface. However, theBucketSpecis pretty much only gocb options, with the exception of Server (typically rosmar in memory URL, but can be an on disk URL). This felt overkill.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/281/