Skip to content

Commit 57a7b11

Browse files
craig[bot]andyyang890taroface
committed
137359: changefeedccl/kvfeed: add log for table that encountered schema change r=rharding6373 a=andyyang890 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. Fixes cockroachdb#136624 Closes cockroachdb#134963 Release note: None 137432: docgen: remove unused BEGIN diagram r=yuzefovich a=taroface cockroachdb#137135 added `begin_stmt` to the .bzl files for SQL diagram generation. However, this diagram is no longer used, and doesn't seem to be generated by `docgen` upon local testing. Removing `begin_stmt` and `begin_stmt.bnf` worked in cockroachdb#137111, so this PR applies the same update to `master` and backports to 24.1-3. (cc `@rickystewart)` Epic: none Release note: None Co-authored-by: Andy Yang <yang@cockroachlabs.com> Co-authored-by: Ryan Kuo <ryank@cockroachlabs.com>
3 parents a4d45a4 + ddbb08e + 95025db commit 57a7b11

File tree

7 files changed

+10
-7
lines changed

7 files changed

+10
-7
lines changed

docs/generated/sql/bnf/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ FILES = [
7373
"backup",
7474
"backup_options",
7575
"begin_transaction",
76-
"begin_stmt",
7776
"call",
7877
"cancel_all_jobs",
7978
"cancel_job",

docs/generated/sql/bnf/begin_stmt.bnf

Lines changed: 0 additions & 2 deletions
This file was deleted.

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

pkg/gen/bnf.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ BNF_SRCS = [
7272
"//docs/generated/sql/bnf:analyze_stmt.bnf",
7373
"//docs/generated/sql/bnf:backup.bnf",
7474
"//docs/generated/sql/bnf:backup_options.bnf",
75-
"//docs/generated/sql/bnf:begin_stmt.bnf",
7675
"//docs/generated/sql/bnf:begin_transaction.bnf",
7776
"//docs/generated/sql/bnf:call.bnf",
7877
"//docs/generated/sql/bnf:cancel_all_jobs.bnf",

pkg/gen/diagrams.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ DIAGRAMS_SRCS = [
7272
"//docs/generated/sql/bnf:analyze.html",
7373
"//docs/generated/sql/bnf:backup.html",
7474
"//docs/generated/sql/bnf:backup_options.html",
75-
"//docs/generated/sql/bnf:begin.html",
7675
"//docs/generated/sql/bnf:begin_transaction.html",
7776
"//docs/generated/sql/bnf:call.html",
7877
"//docs/generated/sql/bnf:cancel.html",

pkg/gen/docs.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ DOCS_SRCS = [
8585
"//docs/generated/sql/bnf:analyze_stmt.bnf",
8686
"//docs/generated/sql/bnf:backup.bnf",
8787
"//docs/generated/sql/bnf:backup_options.bnf",
88-
"//docs/generated/sql/bnf:begin_stmt.bnf",
8988
"//docs/generated/sql/bnf:begin_transaction.bnf",
9089
"//docs/generated/sql/bnf:call.bnf",
9190
"//docs/generated/sql/bnf:cancel_all_jobs.bnf",

0 commit comments

Comments
 (0)