ddl: shouldn't ignore change when the job state is rollback done (#17633)

This commit is contained in:
crazycs
2020-06-04 11:58:55 +08:00
committed by GitHub
parent 1379ba4678
commit fe79325419

View File

@ -474,11 +474,12 @@ func (w *worker) handleDDLJobQueue(d *ddlCtx) error {
err = w.finishDDLJob(t, job)
return errors.Trace(err)
}
if runJobErr != nil && !job.IsRollingback() {
if runJobErr != nil && !job.IsRollingback() && !job.IsRollbackDone() {
// If the running job meets an error
// and the job state is rolling back, it means that we have already handled this error.
// Some DDL jobs (such as adding indexes) may need to update the table info and the schema version,
// then shouldn't discard the KV modification.
// And the job state is rollback done, it means the job was already finished, also shouldn't discard too.
// Otherwise, we should discard the KV modification when running job.
txn.Discard()
}