From fe793254199fa80dd46e68462dcce8ddb535a049 Mon Sep 17 00:00:00 2001 From: crazycs Date: Thu, 4 Jun 2020 11:58:55 +0800 Subject: [PATCH] ddl: shouldn't ignore change when the job state is rollback done (#17633) --- ddl/ddl_worker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ddl/ddl_worker.go b/ddl/ddl_worker.go index c0dac3437c..6a26a2295f 100644 --- a/ddl/ddl_worker.go +++ b/ddl/ddl_worker.go @@ -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() }