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

Method checkForUpgrade

db/crud.go:3474–3485  ·  view source on GitHub ↗

Checks whether a document has a mobile xattr. Used when running in non-xattr mode to support no downtime upgrade.

(ctx context.Context, key string, unmarshalLevel DocumentUnmarshalLevel)

Source from the content-addressed store, hash-verified

3472
3473// Checks whether a document has a mobile xattr. Used when running in non-xattr mode to support no downtime upgrade.
3474func (c *DatabaseCollection) checkForUpgrade(ctx context.Context, key string, unmarshalLevel DocumentUnmarshalLevel) (*Document, *sgbucket.BucketDocument) {
3475 // If we are using xattrs or Couchbase Server doesn't support them, an upgrade isn't going to be in progress
3476 if c.UseXattrs() || !c.dataStore.IsSupported(sgbucket.BucketStoreFeatureXattrs) {
3477 return nil, nil
3478 }
3479
3480 doc, rawDocument, err := c.GetDocWithXattrs(ctx, key, unmarshalLevel)
3481 if err != nil || doc == nil || !doc.HasValidSyncData() {
3482 return nil, nil
3483 }
3484 return doc, rawDocument
3485}
3486
3487// legacyRevToHybridLogicalVector will take a legacy revID and convert it to a HybridLogicalVector, used for when a
3488// document doesn't have hlv defined (it is a legacy pre upgraded doc).

Callers 2

GetDocumentWithRawMethod · 0.95
DocChangedMethod · 0.80

Calls 4

UseXattrsMethod · 0.95
GetDocWithXattrsMethod · 0.95
HasValidSyncDataMethod · 0.80
IsSupportedMethod · 0.45

Tested by

no test coverage detected