-
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
schemachanger: Refactor tests for concurrent schema changer behaviors #108451
schemachanger: Refactor tests for concurrent schema changer behaviors #108451
Conversation
be61133
to
b9dd59f
Compare
CI tests are flaky tests unrelated to this PR. Ready for a look! |
nice work! quick question, do you know if the new test would have been able to catch the bug described here? #106933 |
@rafiss yes but with a different error! So I looked at that PR that fixes the bug. It essentially added two lines as listed below. So I did the following:
|
This commit recognizes that there were previously three redundant tests about concurrent schema changer behavior so it deletes them and rewrite it to a simpler one. Release note: None
…hanger behavior This commit adds an integration style test for concurrent schema changer behaviors where we run multiple DDLs for an extended period of time on a few descriptors and assert that they all eventually finish and the descriptors end up in the expected state. Release note: None
b9dd59f
to
c02d1f3
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.
@Xiang-Gu This is excellent stuff! A couple of suggestions for improvements, the transaction one can be ignored.
Reviewed 2 of 2 files at r1, 1 of 2 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Xiang-Gu)
pkg/sql/schemachanger/schemachanger_test.go
line 635 at r2 (raw file):
scName = newSCName t.Logf("RENAME SCHEMA TO %v", newSCName) } else if isPQErrWithCode(err, pgcode.UndefinedDatabase) {
Would it make sense to use catalog queries here instead and transactions, that way, we get retry errors instead. But I think we can't because of declarative based on our slack conversation.
pkg/sql/schemachanger/schemachanger_test.go
line 643 at r2 (raw file):
// A goroutine that renames table `testdb.testsc.t` randomly. go repeatWorkWithInterval("rename-tbl-worker", renameTblInterval, func() error {
ctxgroup is a cleaner pattern here and would simplify the code
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 @fqazi)
pkg/sql/schemachanger/schemachanger_test.go
line 643 at r2 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
ctxgroup is a cleaner pattern here and would simplify the code
I explored ctxgroup
but its functionality is not suitable for our case here.
Namely, ctxgourp
allows us to spawn workers, and wait for them to complete. Here we want the main routine to let workers work indefinitely and signal them to finish once a time up fires.
TFTR! |
Build succeeded: |
Fix #108140
Fix #107223
Epic: None
Release note: None