You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If there's already a metadataID assigned to this database in the registry (including other config groups), use that
766
-
defaultMetadataIDInUse:=false
766
+
defaultMetadataIDDb:=""
767
767
for_, cg:=rangeregistry.ConfigGroups {
768
768
fordbName, db:=rangecg.Databases {
769
769
ifdbName==config.Name {
770
+
base.InfofCtx(ctx, base.KeyConfig, "Using metadata ID=%q from registry for db %q", base.MD(db.MetadataID), base.MD(dbName))
770
771
returndb.MetadataID
771
772
}
772
773
ifdb.MetadataID==defaultMetadataID {
773
-
defaultMetadataIDInUse=true
774
+
// do not return standardMetadataID here in case there was a different metadata ID assigned to this database
775
+
defaultMetadataIDDb=config.Name
774
776
}
775
777
}
776
778
}
777
779
778
780
// If the default metadata ID is already in use in the registry by a different database, use standard ID.
779
-
ifdefaultMetadataIDInUse {
781
+
ifdefaultMetadataIDDb!="" {
782
+
base.InfofCtx(ctx, base.KeyConfig, "Using metadata ID %q for db %q since the default metadata ID is already in use by db %q", base.MD(standardMetadataID), base.MD(config.Name), base.MD(defaultMetadataIDDb))
780
783
returnstandardMetadataID
781
784
}
782
-
783
785
// If the database config doesn't include _default._default, use standard ID
base.InfofCtx(ctx, base.KeyConfig, "Using metadata ID %q for db %q since _default._default collection is not a collection targeted by this db", base.MD(standardMetadataID), base.MD(config.Name))
base.InfofCtx(ctx, base.KeyConfig, "Using metadata ID %q for db %q because db uses the default collection, and _sync:syncInfo in the default collection specifies the non-default metadata ID %q", base.MD(standardMetadataID), base.MD(config.Name), base.MD(syncInfo.MetadataID))
808
812
returnstandardMetadataID
809
813
}
810
814
815
+
base.InfofCtx(ctx, base.KeyConfig, "Using default metadata ID %q for db %q", base.MD(defaultMetadataID), base.MD(config.Name))
811
816
returndefaultMetadataID
812
-
813
817
}
814
818
815
819
// standardMetadataID returns either the dbName or a base64 encoded SHA256 hash of the dbName, whichever is shorter.
0 commit comments