-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: ignore reorg elem error when the job is cancelling #41383
ddl: ignore reorg elem error when the job is cancelling #41383
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 |
@@ -770,6 +770,10 @@ func (w *worker) HandleDDLJobTable(d *ddlCtx, job *model.Job) (int64, error) { | |||
// and retry later if the job is not cancelled. | |||
schemaVer, runJobErr = w.runDDLJob(d, t, job) | |||
|
|||
d.mu.RLock() |
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.
Does this code only for test?
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.
Yes.
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.
Do we have a way to execute these three lines codes only in test?
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.
The overhead is negligible.
Please also check the other methods of this interface. All of them are written in this style.
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.
I know the lock and a nil function call and unlock overhead is very small. Just want to know if there is a way like c "debug micro" that only debug mode has this 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.
LGTM
/retest |
1 similar comment
/retest |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: a034004
|
What problem does this PR solve?
Issue Number: close #41381
Problem Summary:
The root cause is the write-conflict between DDL job's transaction and
ADMIN CANCEL
transaction. The latter wins and aborts the DDL job's transaction. As a result, the "duplicate entry" error is lost.DDL worker starts to handle the cancelling case. It finds that the job is in write-reorg state, and tries to pick up the work by getting reorg handle. However, the reorg handle is cleaned by another previous transaction.
What is changed and how it works?
This PR ignores the "reorg element not exist" error when the job is cancelling.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.