Skip to content
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-4005 Perform mou bucket capability check once per database initialization #6939

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion db/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ type DatabaseContext struct {
MetadataKeys *base.MetadataKeys // Factory to generate metadata document keys
RequireResync base.ScopeAndCollectionNames // Collections requiring resync before database can go online
CORS *auth.CORSConfig // CORS configuration
EnableMou bool // Write _mou xattr when performing metadata-only update. Set based on bucket capability on connect
}

type Scope struct {
Expand Down Expand Up @@ -417,6 +418,9 @@ func NewDatabaseContext(ctx context.Context, dbName string, bucket base.Bucket,
UserFunctionTimeout: defaultUserFunctionTimeout,
}

// Check if server version supports multi-xattr operations, required for mou handling
dbContext.EnableMou = bucket.IsSupported(sgbucket.BucketStoreFeatureMultiXattrSubdocOperations)

// Initialize metadata ID and keys
metaKeys := base.NewMetadataKeys(options.MetadataID)
dbContext.MetadataKeys = metaKeys
Expand Down Expand Up @@ -1971,7 +1975,7 @@ func (context *DatabaseContext) UseViews() bool {
}

func (context *DatabaseContext) UseMou() bool {
return context.Bucket.IsSupported(sgbucket.BucketStoreFeatureMultiXattrSubdocOperations)
return context.EnableMou
}

// UseQueryBasedResyncManager returns if query bases resync manager should be used for Resync operation
Expand Down
Loading