MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / updateCCVSettings

Method updateCCVSettings

db/database.go:1685–1710  ·  view source on GitHub ↗

updateCCVSettings performs a management query to determine the latest crossClusterVersioning and max cas settings.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1683
1684// updateCCVSettings performs a management query to determine the latest crossClusterVersioning and max cas settings.
1685func (db *DatabaseContext) updateCCVSettings(ctx context.Context) error {
1686 cbStore, ok := base.AsCouchbaseBucketStore(db.Bucket)
1687 if !ok {
1688 // for rosmar, ECCV is always enabled, mark starting cas as 0
1689 db.CachedCCVEnabled.Store(true)
1690 for vbNo := range db.numVBuckets {
1691 db.CachedCCVStartingCas.Store(base.VBNo(vbNo), 0)
1692 }
1693 return nil
1694 }
1695
1696 // Fetch from Couchbase Server
1697 enabled, maxCAS, err := cbStore.GetCCVSettings(ctx)
1698 if err != nil {
1699 return fmt.Errorf("Unable to retrieve server's CCV Starting CAS: %w", err)
1700 }
1701
1702 db.CachedCCVEnabled.Store(enabled)
1703 if !enabled {
1704 db.CachedCCVStartingCas.Clear()
1705 }
1706 for vbNo, cas := range maxCAS {
1707 db.CachedCCVStartingCas.Store(vbNo, cas)
1708 }
1709 return nil
1710}
1711
1712func (c *DatabaseCollection) updateAllPrincipalsSequences(ctx context.Context) error {
1713 users, roles, err := c.allPrincipalIDs(ctx)

Callers 1

NewDatabaseContextFunction · 0.95

Calls 6

AsCouchbaseBucketStoreFunction · 0.92
VBNoTypeAlias · 0.92
StoreMethod · 0.80
ErrorfMethod · 0.80
GetCCVSettingsMethod · 0.65
ClearMethod · 0.65

Tested by

no test coverage detected