changefeedccl: block db-level changefeed creation for non-empty tableset#154163
changefeedccl: block db-level changefeed creation for non-empty tableset#154163log-head wants to merge 2 commits intocockroachdb:masterfrom
Conversation
|
This works if there's sufficient time between creating the db-level changefeed and going from 0->1 tables in the database. Otherwise, through planning the changefeed, the table descriptors are being fetched at times where they don't exist. I'm still fiddling with a follow-up commit to fix the timestamp where table descriptors are queried. |
| } | ||
| var watcher *tableset.Watcher | ||
| watcherChan := make(chan []tableset.TableDiff) | ||
| if targets.NumUniqueTables() == 0 { |
There was a problem hiding this comment.
Should be a more explicit way to tell whether this is a db-level changefeed.
| schemaTSOverride = earliestTimestamp | ||
| fmt.Printf("schemaTSOverride: %s\n", schemaTSOverride) | ||
| for _, diff := range diffs { | ||
| if diff.AsOf.LessEq(earliestTimestamp) { |
There was a problem hiding this comment.
Add comment that this is changes only at this timestamp, so add then drop should not work.
| if watcher == nil { | ||
| continue | ||
| } | ||
| unchanged, diffs, err := watcher.PopUnchangedUpTo(ctx, execCfg.Clock.Now()) |
There was a problem hiding this comment.
Use the time we're getting from t.C, rather than Clock.Now()
On startup, the changefeed should not be started until there exist tables in the database to watch. If no tables exist at the time of startup, then a tableset watcher is created and polled; the changefeed will be started from where there is first a target table. Fixes: cockroachdb#147371 Epic: CRDB-1421 Release note: none
… creation When a changefeed is planned and executed, there are several places where target table descriptors are fetched. With a db-level changefeed, the set of tables can change during changefeed startup. Now, the timestamp is set to the initial high water for retrieving table descriptors. Fixes: cockroachdb#154549 Epic: CRDB-1421 Release note: None
fdc8d53 to
b1e8e86
Compare
Potential Bug(s) DetectedThe three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation. Next Steps: After you review the findings, please tag the issue as follows:
|
On startup, the changefeed should not be started until there exist tables in the database to watch. If no tables exist at the time of startup, then a tableset watcher is created and polled; the changefeed will be started from where there is first a target table.
Fixes: #148833
Epic: CRDB-1421
Release note: none