Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 #136624
Closes #134963

Release note: None

137432: docgen: remove unused BEGIN diagram r=yuzefovich a=taroface

 #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 #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 <[email protected]>
Co-authored-by: Ryan Kuo <[email protected]>
  • Loading branch information
3 people committed Dec 13, 2024
3 parents a4d45a4 + ddbb08e + 95025db commit 57a7b11
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion docs/generated/sql/bnf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ FILES = [
"backup",
"backup_options",
"begin_transaction",
"begin_stmt",
"call",
"cancel_all_jobs",
"cancel_job",
Expand Down
2 changes: 0 additions & 2 deletions docs/generated/sql/bnf/begin_stmt.bnf

This file was deleted.

1 change: 1 addition & 0 deletions pkg/ccl/changefeedccl/kvfeed/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ go_library(
"//pkg/util/span",
"//pkg/util/timeutil",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_redact//:redact",
],
)

Expand Down
10 changes: 9 additions & 1 deletion pkg/ccl/changefeedccl/kvfeed/kv_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/span"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/redact"
)

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

// Detect whether the event corresponds to a primary index change. Also
// detect whether the change corresponds to any change in the set of visible
Expand Down
1 change: 0 additions & 1 deletion pkg/gen/bnf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ BNF_SRCS = [
"//docs/generated/sql/bnf:analyze_stmt.bnf",
"//docs/generated/sql/bnf:backup.bnf",
"//docs/generated/sql/bnf:backup_options.bnf",
"//docs/generated/sql/bnf:begin_stmt.bnf",
"//docs/generated/sql/bnf:begin_transaction.bnf",
"//docs/generated/sql/bnf:call.bnf",
"//docs/generated/sql/bnf:cancel_all_jobs.bnf",
Expand Down
1 change: 0 additions & 1 deletion pkg/gen/diagrams.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ DIAGRAMS_SRCS = [
"//docs/generated/sql/bnf:analyze.html",
"//docs/generated/sql/bnf:backup.html",
"//docs/generated/sql/bnf:backup_options.html",
"//docs/generated/sql/bnf:begin.html",
"//docs/generated/sql/bnf:begin_transaction.html",
"//docs/generated/sql/bnf:call.html",
"//docs/generated/sql/bnf:cancel.html",
Expand Down
1 change: 0 additions & 1 deletion pkg/gen/docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ DOCS_SRCS = [
"//docs/generated/sql/bnf:analyze_stmt.bnf",
"//docs/generated/sql/bnf:backup.bnf",
"//docs/generated/sql/bnf:backup_options.bnf",
"//docs/generated/sql/bnf:begin_stmt.bnf",
"//docs/generated/sql/bnf:begin_transaction.bnf",
"//docs/generated/sql/bnf:call.bnf",
"//docs/generated/sql/bnf:cancel_all_jobs.bnf",
Expand Down

0 comments on commit 57a7b11

Please sign in to comment.