Skip to content

Commit 6990c1f

Browse files
authored
ddl: remove reorg ctx when current instance is not owner (#55050)
close #54897
1 parent d2304c8 commit 6990c1f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/ddl/backfilling.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,12 @@ func (dc *ddlCtx) writePhysicalTableRecord(sessPool *sess.Pool, t table.Physical
674674
totalAddedCount := job.GetRowCount()
675675

676676
startKey, endKey := reorgInfo.StartKey, reorgInfo.EndKey
677-
678677
if err := dc.isReorgRunnable(reorgInfo.Job.ID, false); err != nil {
678+
if errors.ErrorEqual(err, dbterror.ErrNotOwner) {
679+
// This instance is not DDL owner, we remove reorgctx proactively
680+
// to avoid being used later.
681+
dc.removeReorgCtx(reorgInfo.ID)
682+
}
679683
return errors.Trace(err)
680684
}
681685

0 commit comments

Comments
 (0)