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
base.DebugfCtx(ctx, base.KeyConfig, "Database %q already removed from server context after acquiring write lock - do not need to remove not removing database", base.MD(dbName))
1635
+
continue
1636
+
}
1632
1637
// It's possible that the "deleted" database was not written to the server until after sc.FetchConfigs had returned...
1633
1638
// we'll need to pay for the cost of getting the config again now that we've got the write lock to double-check this db is definitely ok to remove...
1634
-
found, _, err:=sc._fetchDatabase(ctx, dbName)
1635
-
iferr!=nil {
1636
-
base.InfofCtx(ctx, base.KeyConfig, "Error fetching config for database %q to check whether we need to remove it: %v", dbName, err)
base.DebugfCtx(ctx, base.KeyConfig, "Found config for database %q after acquiring write lock - not removing database", base.MD(dbName))
1642
+
continue
1643
+
}
1644
+
ifbase.IsTemporaryKvError(getConfigErr) {
1645
+
base.InfofCtx(ctx, base.KeyConfig, "Transient error fetching config for database %q to check whether we need to remove it, will not be removed: %v", base.MD(dbName), getConfigErr)
1646
+
continue
1637
1647
}
1648
+
1638
1649
if!found {
1639
-
base.InfofCtx(ctx, base.KeyConfig, "Database %q was running on this node, but config was not found on the server - removing database", base.MD(dbName))
1650
+
base.InfofCtx(ctx, base.KeyConfig, "Database %q was running on this node, but config was not found on the server - removing database (%v)", base.MD(dbName), getConfigErr)
1640
1651
sc._removeDatabase(ctx, dbName)
1641
-
} else {
1642
-
base.DebugfCtx(ctx, base.KeyConfig, "Found config for database %q after acquiring write lock - not removing database", base.MD(dbName))
base.DebugfCtx(ctx, base.KeyConfig, "%q did not contain config in group %q", bucket, sc.Config.Bootstrap.ConfigGroupID)
1764
+
returnfalse, cnf, err
1765
+
}
1766
+
iferr!=nil {
1767
+
base.DebugfCtx(ctx, base.KeyConfig, "unable to fetch config in group %q from bucket %q: %v", sc.Config.Bootstrap.ConfigGroupID, bucket, err)
1768
+
returnfalse, cnf, err
1769
+
}
1767
1770
1768
-
ifcnf.Name!=dbName {
1769
-
base.TracefCtx(ctx, base.KeyConfig, "%q did not contain config in group %q for db %q", bucket, sc.Config.Bootstrap.ConfigGroupID, dbName)
1770
-
returnfalse, err
1771
-
}
1771
+
ifcnf.Name=="" {
1772
+
cnf.Name=bucket
1773
+
}
1772
1774
1773
-
cnf.cfgCas=cas
1775
+
ifcnf.Name!=dbName {
1776
+
base.TracefCtx(ctx, base.KeyConfig, "%q did not contain config in group %q for db %q", bucket, sc.Config.Bootstrap.ConfigGroupID, dbName)
1777
+
returnfalse, cnf, err
1778
+
}
1774
1779
1775
-
// TODO: This code is mostly copied from FetchConfigs, move into shared function with DbConfig REST API work?
1780
+
cnf.cfgCas=cas
1776
1781
1777
-
// inherit properties the bootstrap config
1778
-
cnf.CACertPath=sc.Config.Bootstrap.CACertPath
1782
+
// inherit properties the bootstrap config
1783
+
cnf.CACertPath=sc.Config.Bootstrap.CACertPath
1779
1784
1780
-
// We need to check for corruption in the database config (CC. CBG-3292). If the fetched config doesn't match the
1781
-
// bucket name we got the config from we need to maker this db context as corrupt. Then remove the context and
1782
-
// in memory representation on the server context.
1783
-
ifbucket!=cnf.GetBucketName() {
1784
-
sc._handleInvalidDatabaseConfig(ctx, bucket, cnf)
1785
-
returntrue, fmt.Errorf("mismatch in persisted database bucket name %q vs the actual bucket name %q. Please correct db %q's config, groupID %q.", base.MD(cnf.Bucket), base.MD(bucket), base.MD(cnf.Name), base.MD(sc.Config.Bootstrap.ConfigGroupID))
1786
-
}
1787
-
bucketCopy:=bucket
1788
-
// no corruption detected carry on as usual
1789
-
cnf.Bucket=&bucketCopy
1785
+
// We need to check for corruption in the database config (CC. CBG-3292). If the fetched config doesn't match the
1786
+
// bucket name we got the config from we need to maker this db context as corrupt. Then remove the context and
1787
+
// in memory representation on the server context.
1788
+
ifbucket!=cnf.GetBucketName() {
1789
+
sc._handleInvalidDatabaseConfig(ctx, bucket, cnf)
1790
+
returntrue, cnf, fmt.Errorf("mismatch in persisted database bucket name %q vs the actual bucket name %q. Please correct db %q's config, groupID %q.", base.MD(cnf.Bucket), base.MD(bucket), base.MD(cnf.Name), base.MD(sc.Config.Bootstrap.ConfigGroupID))
1791
+
}
1792
+
bucketCopy:=bucket
1793
+
// no corruption detected carry on as usual
1794
+
cnf.Bucket=&bucketCopy
1790
1795
1791
-
// any authentication fields defined on the dbconfig take precedence over any in the bootstrap config
base.TracefCtx(ctx, base.KeyConfig, "Got database config %s for bucket %q with cas %d and groupID %q", base.MD(dbName), base.MD(bucket), cas, base.MD(sc.Config.Bootstrap.ConfigGroupID))
1799
-
returntrue, nil
1796
+
// any authentication fields defined on the dbconfig take precedence over any in the bootstrap config
base.TracefCtx(ctx, base.KeyConfig, "Got database config %s for bucket %q with cas %d and groupID %q", base.MD(dbName), base.MD(bucket), cas, base.MD(sc.Config.Bootstrap.ConfigGroupID))
0 commit comments