-
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
sql: delete descriptor when function is dropped #96385
sql: delete descriptor when function is dropped #96385
Conversation
8fcf122
to
bcd525d
Compare
hmm.. looks like the |
3694c5b
to
0bd725a
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.
Reviewed 8 of 8 files at r1, 9 of 9 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @chengxiong-ruan)
pkg/jobs/jobspb/jobs.proto
line 808 at r1 (raw file):
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID" ]; repeated uint32 dropped_functions = 12 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb.ID"];
Nit: Maybe a comment here
pkg/upgrade/upgrades/delete_descriptors_of_dropped_functions.go
line 66 at r2 (raw file):
const batchSize = 50 for curID := 1; curID <= maxID; curID += batchSize {
What does the batching buy is here or what are we trying to avoid by doing it?
Previously, fqazi (Faizan Qazi) wrote…
I think this is just in case there're too many descriptors which is rare though. But I think it's just nicer to do small batch to avoid one heavy operation. |
Previously, fqazi (Faizan Qazi) wrote…
will do |
Previously, in legacy schema changer, descriptor stayed as a orphan recrod in system.descriptor when a function is dropped. While this is not a big issue, we should keep data clean. This PR adds schema change job logic to handle the deletions. Fixes: cockroachdb#95364 Release note: None
This commit adds an upgrade to delete orphan descriptors of functions dropped through legacy schema changer before 23.1. Release note: None
0bd725a
to
0a8e800
Compare
Previously, chengxiong-ruan (Chengxiong Ruan) wrote…
done |
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 @ajwerner and @chengxiong-ruan)
pkg/upgrade/upgrades/delete_descriptors_of_dropped_functions.go
line 66 at r2 (raw file):
Previously, chengxiong-ruan (Chengxiong Ruan) wrote…
I think this is just in case there're too many descriptors which is rare though. But I think it's just nicer to do small batch to avoid one heavy operation.
I think implicitly each delete will get its own KV batch, so this might not be necessary. Thinking the SQL layer would handle the select side nicely, but I'm okay with it.
TFTR! |
This PR was included in a batch that was canceled, it will be automatically retried |
Build failed (retrying...): |
Build succeeded: |
Fixes: #95364
sql: delete descriptor when function is dropped
Previously, in legacy schema changer, descriptor stayed as
a orphan recrod in system.descriptor when a function is dropped.
While this is not a big issue, we should keep data clean.
This PR adds schema change job logic to handle the deletions.
upgrades: add upgrade to delete dropped function descriptors
This commit adds an upgrade to delete orphan descriptors of
functions dropped through legacy schema changer before 23.1.