diff --git a/pkg/ddl/backfilling.go b/pkg/ddl/backfilling.go index 8c5ca71b0eed6..33155f01e07a7 100644 --- a/pkg/ddl/backfilling.go +++ b/pkg/ddl/backfilling.go @@ -388,6 +388,11 @@ func splitTableRanges(t table.PhysicalTable, store kv.Storage, startKey, endKey zap.Int64("physicalTableID", t.GetPhysicalID()), zap.String("start key", hex.EncodeToString(startKey)), zap.String("end key", hex.EncodeToString(endKey))) + if len(startKey) == 0 && len(endKey) == 0 { + logutil.BgLogger().Info("split table range from PD, get noop table range", zap.String("category", "ddl"), zap.Int64("physicalTableID", t.GetPhysicalID())) + return []kv.KeyRange{}, nil + } + kvRange := kv.KeyRange{StartKey: startKey, EndKey: endKey} s, ok := store.(tikv.Storage) if !ok { @@ -673,9 +678,6 @@ func (dc *ddlCtx) writePhysicalTableRecord(sessPool *sess.Pool, t table.Physical if err := dc.isReorgRunnable(reorgInfo.Job.ID, false); err != nil { return errors.Trace(err) } - if startKey == nil && endKey == nil { - return nil - } failpoint.Inject("MockCaseWhenParseFailure", func(val failpoint.Value) { //nolint:forcetypeassert