Skip to content

Commit ddbb08e

Browse files
committed
changefeedccl/kvfeed: add log for table that encountered schema change
This patch adds a log documenting the table(s) that encountered schema changes and caused the kv feed to restart/exit, which will be useful for debugging. Release note: None
1 parent 95d95a6 commit ddbb08e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/ccl/changefeedccl/kvfeed/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ go_library(
3636
"//pkg/util/span",
3737
"//pkg/util/timeutil",
3838
"@com_github_cockroachdb_errors//:errors",
39+
"@com_github_cockroachdb_redact//:redact",
3940
],
4041
)
4142

pkg/ccl/changefeedccl/kvfeed/kv_feed.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/cockroachdb/cockroach/pkg/util/span"
3232
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
3333
"github.com/cockroachdb/errors"
34+
"github.com/cockroachdb/redact"
3435
)
3536

3637
// MonitoringConfig is a set of callbacks which the kvfeed calls to provide
@@ -392,8 +393,15 @@ func (f *kvFeed) run(ctx context.Context) (err error) {
392393
return err
393394
}
394395
if log.V(2) {
395-
log.Infof(ctx, "kv feed encountered table events: %#v", events)
396+
log.Infof(ctx, "kv feed encountered table events at or before %s: %#v", schemaChangeTS, events)
396397
}
398+
var tables []redact.RedactableString
399+
for _, event := range events {
400+
tables = append(tables, redact.Sprintf("table %q (id %d, version %d -> %d)",
401+
redact.Safe(event.Before.GetName()), event.Before.GetID(), event.Before.GetVersion(), event.After.GetVersion()))
402+
}
403+
log.Infof(ctx, "kv feed encountered schema change(s) at or before %s: %s",
404+
schemaChangeTS, redact.Join(", ", tables))
397405

398406
// Detect whether the event corresponds to a primary index change. Also
399407
// detect whether the change corresponds to any change in the set of visible

0 commit comments

Comments
 (0)