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-3586: [3.1.4 backport] log bucket and groupID during config search #6667

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions db/background_mgr_attachment_compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ func (a *AttachmentCompactionManager) handleAttachmentCompactionRollbackError(ct
// to rollback any phase for attachment compaction we need to purge all persisted dcp metadata
err = a.PurgeDCPMetadata(ctx, dataStore, database, keyPrefix)
if err != nil {
base.WarnfCtx(ctx, "error occurred during purging of dcp metadata: %w", err)
base.WarnfCtx(ctx, "error occurred during purging of dcp metadata: %s", err)
return false, err
}
if phase == MarkPhase {
// initialise new compaction run as we want to start the phase mark again in event of rollback
err = a.Init(ctx, options, nil)
if err != nil {
base.WarnfCtx(ctx, "error on initialization of new run after rollback has been indicated, %w", err)
base.WarnfCtx(ctx, "error on initialization of new run after rollback has been indicated: %s", err)
return false, err
}
} else {
Expand Down
20 changes: 10 additions & 10 deletions rest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1454,23 +1454,23 @@ func (sc *ServerContext) migrateV30Configs(ctx context.Context) error {
if getErr == base.ErrNotFound {
continue
} else if getErr != nil {
base.InfofCtx(ctx, base.KeyConfig, "Unable to retrieve 3.0 config during config migration for bucket: %s, groupID: %s: %w", base.MD(bucketName), base.MD(groupID), getErr)
base.InfofCtx(ctx, base.KeyConfig, "Unable to retrieve 3.0 config during config migration for bucket: %s, groupID: %s: %s", base.MD(bucketName), base.MD(groupID), getErr)
continue
}

base.InfofCtx(ctx, base.KeyConfig, "Found legacy persisted config for database %s - migrating to db registry.", base.MD(dbConfig.Name))
base.InfofCtx(ctx, base.KeyConfig, "Found legacy persisted config for database %s in bucket %s, groupID %s - migrating to db registry.", base.MD(dbConfig.Name), base.MD(bucketName), base.MD(groupID))
_, insertErr := sc.BootstrapContext.InsertConfig(ctx, bucketName, groupID, &dbConfig)
if insertErr != nil {
if insertErr == base.ErrAlreadyExists {
base.DebugfCtx(ctx, base.KeyConfig, "Found legacy config for database %s, but already exists in registry.", base.MD(dbConfig.Name))
base.DebugfCtx(ctx, base.KeyConfig, "Found legacy config for database %s in bucket %s, groupID: %s, but already exists in registry.", base.MD(dbConfig.Name), base.MD(bucketName), base.MD(groupID))
} else {
base.InfofCtx(ctx, base.KeyConfig, "Unable to persist migrated v3.0 config for bucket %s groupID %s: %w", base.MD(bucketName), base.MD(groupID), insertErr)
base.InfofCtx(ctx, base.KeyConfig, "Unable to persist migrated v3.0 config for bucket %s groupID %s: %s", base.MD(bucketName), base.MD(groupID), insertErr)
continue
}
}
removeErr := sc.BootstrapContext.Connection.DeleteMetadataDocument(ctx, bucketName, PersistentConfigKey30(ctx, groupID), legacyCas)
if removeErr != nil {
base.InfofCtx(ctx, base.KeyConfig, "Failed to remove legacy config for database %s.", base.MD(dbConfig.Name))
base.InfofCtx(ctx, base.KeyConfig, "Failed to remove legacy config for database %s in bucket %s, groupID %s: %s", base.MD(dbConfig.Name), base.MD(bucketName), base.MD(groupID), base.MD(removeErr))
}
}
return nil
Expand Down Expand Up @@ -1555,7 +1555,7 @@ func (sc *ServerContext) _fetchDatabase(ctx context.Context, dbName string) (fou
cnf.CertPath = sc.Config.Bootstrap.X509CertPath
cnf.KeyPath = sc.Config.Bootstrap.X509KeyPath
}
base.TracefCtx(ctx, base.KeyConfig, "Got config for bucket %q with cas %d", bucket, cas)
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))
return true, nil
}

Expand Down Expand Up @@ -1677,20 +1677,20 @@ func (sc *ServerContext) FetchConfigs(ctx context.Context, isInitialStartup bool
fetchedConfigs := make(map[string]DatabaseConfig, len(buckets))
for _, bucket := range buckets {

base.TracefCtx(ctx, base.KeyConfig, "Checking for configs for group %q from bucket %q", sc.Config.Bootstrap.ConfigGroupID, bucket)
base.TracefCtx(ctx, base.KeyConfig, "Checking for configs for group %q from bucket %q", sc.Config.Bootstrap.ConfigGroupID, base.MD(bucket))
configs, err := sc.BootstrapContext.GetDatabaseConfigs(ctx, bucket, sc.Config.Bootstrap.ConfigGroupID)
if err != nil {
// Unexpected error fetching config - SDK has already performed retries, so we'll treat it as a registry removal
// this could be due to invalid JSON or some other non-recoverable error.
if isInitialStartup {
base.WarnfCtx(ctx, "Unable to fetch config for group %q from bucket %q on startup: %v", sc.Config.Bootstrap.ConfigGroupID, bucket, err)
base.WarnfCtx(ctx, "Unable to fetch configs for group %q from bucket %q on startup: %v", sc.Config.Bootstrap.ConfigGroupID, base.MD(bucket), err)
} else {
base.DebugfCtx(ctx, base.KeyConfig, "Unable to fetch config for group %q from bucket %q: %v", sc.Config.Bootstrap.ConfigGroupID, bucket, err)
base.DebugfCtx(ctx, base.KeyConfig, "Unable to fetch configs for group %q from bucket %q: %v", sc.Config.Bootstrap.ConfigGroupID, base.MD(bucket), err)
}
continue
}
if len(configs) == 0 {
base.DebugfCtx(ctx, base.KeyConfig, "Bucket %q did not contain config for group %q", bucket, sc.Config.Bootstrap.ConfigGroupID)
base.DebugfCtx(ctx, base.KeyConfig, "Bucket %q did not contain any configs for group %q", base.MD(bucket), sc.Config.Bootstrap.ConfigGroupID)
continue
}
for _, cnf := range configs {
Expand Down
6 changes: 3 additions & 3 deletions rest/server_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ func (sc *ServerContext) initializeCouchbaseServerConnections(ctx context.Contex
}

if count > 0 {
base.InfofCtx(ctx, base.KeyConfig, "Successfully fetched %d database configs from buckets in cluster", count)
base.InfofCtx(ctx, base.KeyConfig, "Successfully fetched %d database configs for group %q from buckets in cluster", count, sc.Config.Bootstrap.ConfigGroupID)
} else {
base.WarnfCtx(ctx, "Config: No database configs for group %q. Continuing startup to allow REST API database creation", sc.Config.Bootstrap.ConfigGroupID)
}
Expand All @@ -2060,10 +2060,10 @@ func (sc *ServerContext) initializeCouchbaseServerConnections(ctx context.Contex
base.DebugfCtx(ctx, base.KeyConfig, "Fetching configs from buckets in cluster for group %q", sc.Config.Bootstrap.ConfigGroupID)
count, err := sc.fetchAndLoadConfigs(ctx, false)
if err != nil {
base.WarnfCtx(ctx, "Couldn't load configs from bucket when polled: %v", err)
base.WarnfCtx(ctx, "Couldn't load configs from bucket for group %q when polled: %v", sc.Config.Bootstrap.ConfigGroupID, err)
}
if count > 0 {
base.InfofCtx(ctx, base.KeyConfig, "Successfully fetched %d database configs from buckets in cluster", count)
base.InfofCtx(ctx, base.KeyConfig, "Successfully fetched %d database configs for group %d from buckets in cluster", count, sc.Config.Bootstrap.ConfigGroupID)
}
}
}
Expand Down
Loading