Skip to content
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: move update version function to a proper place #40817

Merged
merged 11 commits into from
Jan 29, 2023
4 changes: 3 additions & 1 deletion ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ func doReorgWorkForCreateIndexMultiSchema(w *worker, d *ddlCtx, t *meta.Meta, jo
done, ver, err = doReorgWorkForCreateIndex(w, d, t, job, tbl, indexInfo)
if done {
job.MarkNonRevertible()
if err == nil {
ver, err = updateVersionAndTableInfo(d, t, job, tbl.Meta(), true)
}
}
// We need another round to wait for all the others sub-jobs to finish.
return false, ver, err
Expand Down Expand Up @@ -877,7 +880,6 @@ func doReorgWorkForCreateIndex(w *worker, d *ddlCtx, t *meta.Meta, job *model.Jo
return false, ver, err
}
indexInfo.BackfillState = model.BackfillStateInapplicable // Prevent double-write on this index.
ver, err = updateVersionAndTableInfo(d, t, job, tbl.Meta(), true)
return true, ver, err
default:
return false, 0, dbterror.ErrInvalidDDLState.GenWithStackByArgs("backfill", indexInfo.BackfillState)
Expand Down