-
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: release table name as soon as it is no longer referenced #13908
Conversation
f3c72df
to
3fb0fe7
Compare
Reviewed 3 of 3 files at r1. pkg/sql/drop.go, line 980 at r1 (raw file):
that's not what idempotent means; this function will fail on retry. this is to prevent trampling unexpected values. I'd just remove the comment. pkg/sql/drop.go, line 983 at r1 (raw file):
pkg/sql/drop.go, line 993 at r1 (raw file):
nit:
pkg/sql/drop_test.go, line 324 at r1 (raw file):
as suggested below, consider moving this pkg/sql/drop_test.go, line 339 at r1 (raw file):
this is an odd use for a waitgroup. how about an unbuffered error channel, instead? that also has the benefit of moving error handling to the main goroutine. something like
so as not to hold up the callback itself. pkg/sql/drop_test.go, line 388 at r1 (raw file):
this is an odd use for a waitgroup. how about an unbuffered error channel, instead? that also has the benefit of moving error handling to the main goroutine. Comments from Reviewable |
pkg/sql/drop.go, line 980 at r1 (raw file):
changed to
Comments from Reviewable |
Review status: 2 of 3 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. pkg/sql/drop.go, line 983 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/drop.go, line 993 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/drop_test.go, line 324 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Not sure what this suggestion is. I've changed the code to use a chan error. pkg/sql/drop_test.go, line 339 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/drop_test.go, line 388 at r1 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Does this also resolve #12123? |
It doesn't. We cannot resolve #12123 without some tradeoffs because the descriptors are cached across the cluster. In other words there is no transactional drop/create of a table, but we can change the behavior to be more user friendly. |
LGTM Review status: 1 of 3 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/sql/drop_test.go, line 398 at r2 (raw file):
maybe say in this comment that the hook recreated the table. Or even better, move this drop into the hook. pkg/sql/drop_test.go, line 403 at r2 (raw file):
I think you can remove this assertion since you've copied it in the knob, right? pkg/sql/drop_test.go, line 409 at r2 (raw file):
can this and the next checks be moved into the hook, before the table is recreated? If so, I think that'd be better since the test would be a little tighter. Comments from Reviewable |
Review status: 1 of 3 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/sql/drop_test.go, line 398 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Moved the DROP completely. See comment below. pkg/sql/drop_test.go, line 403 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
True, and so now I do not need to even DROP the table any more. Removed Drop from the hook. The hook is only used to check that the name can be used. pkg/sql/drop_test.go, line 409 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Only the nameKey can be moved there and I've done that. Comments from Reviewable |
When dropping a table, the table name would be released only after the table was truncated. Table truncation can take a long time and it doesn't make for a good user experience when a user expects a name for a dropped table to be available almost immediately. fixes cockroachdb#7348
I've also added a counter to check that the DROP table retry actually happens Review status: 1 of 3 files reviewed at latest revision, 9 unresolved discussions. Comments from Reviewable |
Reviewed 1 of 2 files at r2, 1 of 1 files at r3. pkg/sql/drop_test.go, line 385 at r3 (raw file):
this is incorrect. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. pkg/sql/drop_test.go, line 385 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
good catch! Comments from Reviewable |
When dropping a table, the table name would be released only after
the table was truncated. Table truncation can take a long time and
it doesn't make for a good user experience when a user expects a
name for a dropped table to be available almost immediately.
fixes #7348
This change is