-
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: fix the ddl txn commit may be conflict with reorg txn #24668
Conversation
Signed-off-by: AilinKid <[email protected]>
[REVIEW NOTIFICATION] This pull request has not been approved. 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 writing |
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
Signed-off-by: AilinKid <[email protected]>
@@ -1024,10 +1024,9 @@ func (w *worker) doModifyColumnTypeWithData( | |||
return ver, nil | |||
} | |||
if needRollbackData(err) { | |||
if err1 := t.RemoveDDLReorgHandle(job, reorgInfo.elements); err1 != nil { | |||
if err1 := reorgInfo.CleanReorgMeta(); err1 != nil { | |||
logutil.BgLogger().Warn("[ddl] run modify column job failed, RemoveDDLReorgHandle failed, can't convert job to rollback", |
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 need update this log?
@@ -561,7 +561,7 @@ func (w *worker) onCreateIndex(d *ddlCtx, t *meta.Meta, job *model.Job, isPK boo | |||
if kv.ErrKeyExists.Equal(err) || errCancelledDDLJob.Equal(err) || errCantDecodeRecord.Equal(err) { | |||
logutil.BgLogger().Warn("[ddl] run add index job failed, convert job to rollback", zap.String("job", job.String()), zap.Error(err)) | |||
ver, err = convertAddIdxJob2RollbackJob(t, job, tblInfo, indexInfo, err) | |||
if err1 := t.RemoveDDLReorgHandle(job, reorgInfo.elements); err1 != nil { | |||
if err1 := reorgInfo.CleanReorgMeta(); err1 != nil { | |||
logutil.BgLogger().Warn("[ddl] run add index job failed, convert job to rollback, RemoveDDLReorgHandle failed", zap.String("job", job.String()), zap.Error(err1)) |
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.
Ditto.
@@ -707,3 +724,14 @@ func (r *reorgInfo) UpdateReorgMeta(startKey kv.Key) error { | |||
} | |||
return nil | |||
} | |||
|
|||
func (r *reorgInfo) CleanReorgMeta() error { |
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.
It seems that this function is similar to RemoveDDLReorgHandle
, could we use a similar name?
@@ -220,7 +237,7 @@ func (w *worker) runReorgJob(t *meta.Meta, reorgInfo *reorgInfo, tblInfo *model. | |||
case model.ActionModifyColumn: | |||
metrics.GetBackfillProgressByLabel(metrics.LblModifyColumn).Set(100) | |||
} | |||
if err1 := t.RemoveDDLReorgHandle(job, reorgInfo.elements); err1 != nil { | |||
if err1 := reorgInfo.CleanReorgMeta(); err1 != nil { |
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.
This txn and DDL txn are not the same txn. There may be data and schema out of sync. I think this plan can be further optimized
This pr is regarded as a kind of improvement. |
@AilinKid: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@AilinKid Please resolve the conflicts. |
got |
won't fix it yet, it will be refactored as a whole latter |
Signed-off-by: AilinKid [email protected]
What problem does this PR solve?
Issue Number: close #24427
Problem Summary:
What is changed and how it works?
What's Changed:
Check List
Tests
Release note