Skip to content

Commit

Permalink
ddl: fix the optimization for the empty table(speed up) (#49629) (#49815
Browse files Browse the repository at this point in the history
)

close #49679, close #49682
  • Loading branch information
ti-chi-bot authored Feb 22, 2024
1 parent 0b8d947 commit 99e2a21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ddl/backfilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,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 {
Expand Down Expand Up @@ -685,9 +690,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
Expand Down

0 comments on commit 99e2a21

Please sign in to comment.