Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 committed Nov 21, 2018
1 parent a239b28 commit 8d307e9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,8 @@ func (w *addIndexWorker) handleBackfillTask(d *ddlCtx, task *reorgIndexTask) *ad
handleRange := *task
result := &addIndexResult{addedCount: 0, nextHandle: handleRange.startHandle, err: nil}
lastLogCount := 0
startTime := time.Now()
lastLogTime := time.Now()
startTime := lastLogTime

for {
taskCtx, err := w.backfillIndexInTxn(handleRange)
Expand All @@ -815,10 +816,11 @@ func (w *addIndexWorker) handleBackfillTask(d *ddlCtx, task *reorgIndexTask) *ad
mergeAddIndexCtxToResult(&taskCtx, result)
w.ddlWorker.reorgCtx.increaseRowCount(int64(taskCtx.addedCount))

if result.scanCount-lastLogCount >= 30000 {
if num := result.scanCount - lastLogCount; num >= 30000 {
lastLogCount = result.scanCount
log.Infof("[ddl-reorg] worker(%v), finish batch addedCount:%v backfill, task addedCount:%v, task scanCount:%v, nextHandle:%v",
w.id, taskCtx.addedCount, result.addedCount, result.scanCount, taskCtx.nextHandle)
log.Infof("[ddl-reorg] worker(%v), finish batch addedCount:%v backfill, task addedCount:%v, task scanCount:%v, nextHandle:%v, avg row time(ms):%v",
w.id, taskCtx.addedCount, result.addedCount, result.scanCount, taskCtx.nextHandle, time.Since(lastLogTime).Seconds()*1000/float64(num))
lastLogTime = time.Now()
}

handleRange.startHandle = taskCtx.nextHandle
Expand Down

0 comments on commit 8d307e9

Please sign in to comment.