Skip to content

Commit

Permalink
ddl: make code changes smaller and easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala committed Dec 6, 2022
1 parent 0c93aa8 commit ae5b21f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ddl/backfilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ func (dc *ddlCtx) sendTasksAndWait(scheduler *backfillScheduler, totalAddedCount
if err == nil {
err = dc.isReorgRunnable(reorgInfo.Job)
}
dc.getReorgCtx(reorgInfo.Job).setNextKey(nextKey)

if err != nil {
// Update the reorg handle that has been processed.
Expand All @@ -478,6 +477,7 @@ func (dc *ddlCtx) sendTasksAndWait(scheduler *backfillScheduler, totalAddedCount
}

// nextHandle will be updated periodically in runReorgJob, so no need to update it here.
dc.getReorgCtx(reorgInfo.Job).setNextKey(nextKey)
metrics.BatchAddIdxHistogram.WithLabelValues(metrics.LblOK).Observe(elapsedTime.Seconds())
logutil.BgLogger().Info("[ddl] backfill workers successfully processed batch",
zap.ByteString("element type", reorgInfo.currElement.TypeKey),
Expand Down
1 change: 1 addition & 0 deletions ddl/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ func (w *worker) updateCurrentElement(t table.Table, reorgInfo *reorgInfo) error
// Then the handle range of the rest elements' is [originalStartHandle, originalEndHandle].
if i == startElementOffsetToResetHandle+1 {
reorgInfo.StartKey, reorgInfo.EndKey = originalStartHandle, originalEndHandle
w.getReorgCtx(reorgInfo.Job).setNextKey(reorgInfo.StartKey)
}

// Update the element in the reorgCtx to keep the atomic access for daemon-worker.
Expand Down

0 comments on commit ae5b21f

Please sign in to comment.