-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
changefeedccl: protect system.comments and system.zones #130622
changefeedccl: protect system.comments and system.zones #130622
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @stevendanna)
pkg/ccl/changefeedccl/protected_timestamps.go
line 49 at r1 (raw file):
// We protect system.descriptors because a changefeed needs all of the history // of table descriptors to version data. tablesToProtect := make(descpb.IDs, 0, targets.NumUniqueTables()+1)
fyi might want to consider updating this number
pkg/ccl/changefeedccl/protected_timestamps.go
line 74 at r1 (raw file):
return nil }) addTablePrefix(keys.DescriptorTableID)
should we also add it here?
pkg/ccl/changefeedccl/protected_timestamps_test.go
line 510 at r1 (raw file):
row := sqlDB.QueryRow(t, fmt.Sprintf("SELECT range_id FROM [SHOW RANGES FROM TABLE %s.%s]", tableName, databaseName)) var rangeID int64 row.Scan(&rangeID)
Could there ever be more than one range?
pkg/ccl/changefeedccl/protected_timestamps_test.go
line 513 at r1 (raw file):
refreshPTSReaderCache(s.Clock().Now(), tableName, databaseName) t.Logf("enqueuing range %d for mvccGC", rangeID) sqlDB.Exec(t, `SELECT crdb_internal.kv_enqueue_replica($1, 'mvccGC', true)`, rangeID)
Wanted to double check my understanding: this would trigger a manual synchronous GC on the range for the tables and we would expect it to not affect the tables that are protected by the PTS?
pkg/ccl/changefeedccl/protected_timestamps_test.go
line 520 at r1 (raw file):
sqlDB.Exec(t, "ALTER TABLE foo ADD COLUMN d STRING") time.Sleep(2 * time.Second) // If you want to GC all sytem tables:
nit: s/sytem/system/
The catalog reader reads from system.descriptor, system.comments, and system.zones when reading a table descriptor from disk. We were only protecting system.descriptors. Further, the test here previously wasn't testing anything because it was only forcing the GC-threshold to 1 second before read timestamp it was using. Informs cockroachdb#128806 Release note (bug fix): Fix bug that could prevent a CHANGEFEED from being able to resume after being paused for prolonged period of time.
6501995
to
e315bd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890)
pkg/ccl/changefeedccl/protected_timestamps.go
line 49 at r1 (raw file):
Previously, andyyang890 (Andy Yang) wrote…
fyi might want to consider updating this number
Done.
pkg/ccl/changefeedccl/protected_timestamps.go
line 74 at r1 (raw file):
Previously, andyyang890 (Andy Yang) wrote…
should we also add it here?
Done. Nice catch!
pkg/ccl/changefeedccl/protected_timestamps_test.go
line 510 at r1 (raw file):
Previously, andyyang890 (Andy Yang) wrote…
Could there ever be more than one range?
In production absolutely. In this test, it would be very surprising.
pkg/ccl/changefeedccl/protected_timestamps_test.go
line 513 at r1 (raw file):
Previously, andyyang890 (Andy Yang) wrote…
Wanted to double check my understanding: this would trigger a manual synchronous GC on the range for the tables and we would expect it to not affect the tables that are protected by the PTS?
Yes, this will run the replica through the MVCC GC queue synchronously. The true
as the final argument is for skipShouldQueue
which means we will alway run the queue's process
callback which is what handles running the GC process.
The GC might affect tables even with the PTS record in place, but we expect that the gc threshold to not advance past the PTS. Thus we expect any read at ts
to proceed even after sleeping for a little bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @stevendanna)
bors r=andyyang890 |
Adds `system.role_members` to the list of system tables that are protected by changefeeds. Fixes: cockroachdb#128806 See also: cockroachdb#130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd.
Adds `system.role_members` to the list of system tables that are protected by changefeeds. Fixes: cockroachdb#128806 See also: cockroachdb#130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd.
Adds `system.role_members` to the list of system tables that are protected by changefeeds. Informs: cockroachdb#128806 See also: cockroachdb#130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd.
131027: changefeedccl: protect system.role_members using protected timestamps r=rharding6373 a=asg0451 Adds `system.role_members` to the list of system tables that are protected by changefeeds. Informs: #128806 See also: #130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd. Co-authored-by: Miles Frankel <[email protected]>
Adds `system.role_members` to the list of system tables that are protected by changefeeds. Informs: cockroachdb#128806 See also: cockroachdb#130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd.
Adds `system.role_members` to the list of system tables that are protected by changefeeds. Informs: cockroachdb#128806 See also: cockroachdb#130622 Release note (bug fix): Fix a bug which could result in changefeeds using cdc queries failing due to a system table being GC'd.
The catalog reader reads from system.descriptor, system.comments, and system.zones when reading a table descriptor from disk. We were only protecting system.descriptors.
Further, the test here previously wasn't testing anything because it was only forcing the GC-threshold to 1 second before read timestamp it was using.
Informs #128806
Release note (bug fix): Fix bug that could prevent a CHANGEFEED from being able to resume after being paused for prolonged period of time.