-
Notifications
You must be signed in to change notification settings - Fork 5.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
ddl: fix corrupted table meta after rollback a reorganize partition job #42479
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/retest |
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.
LGTM, just some suggestion for more stable test.
ddl/partition_test.go
Outdated
go func() { | ||
tk2 := testkit.NewTestKit(t, store) | ||
tk2.MustExec("use test") | ||
err := tk2.ExecToErr("alter table t1 reorganize partition p0, p1, p2, p3, p4 into( partition pnew values less than (10000000))") | ||
ddlDone <- err | ||
}() | ||
|
||
showDDLJobStart := time.Now() | ||
jobID := "" | ||
schemaState := "" | ||
for time.Since(showDDLJobStart) < time.Minute { | ||
rows := tk.MustQuery("admin show ddl jobs where JOB_TYPE='alter table reorganize partition'").Rows() | ||
if len(rows) == 0 { | ||
time.Sleep(100 * time.Millisecond) | ||
continue | ||
} | ||
|
||
require.Equal(t, 1, len(rows)) | ||
jobID = rows[0][0].(string) | ||
schemaState = rows[0][4].(string) | ||
if schemaState != "write reorganization" { | ||
time.Sleep(500 * time.Millisecond) | ||
continue | ||
} | ||
break | ||
} |
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.
One could also use a hook/callback for better control, like in this example or this example.
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.
Good idea! I've updated the PR
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.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 9b8fb14
|
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 061851f
|
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #42448
The reorganize partition job did not handle the cancel operation. After
admin cancel ddl jobs ...
command, DDL job will be set to cancelled directly without rolling back.What is changed and how it works?
Do rolling back when job is cancelled by user.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.