Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
River2000i committed Jul 18, 2024
1 parent 154b2c0 commit 38e4538
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/ddl/backfilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,17 @@ type localRowCntListener struct {
// prevPhysicalRowCnt records the row count from previous physical tables (partitions).
prevPhysicalRowCnt int64
// curPhysicalRowCnt records the row count of current physical table.
curPhysicalRowCnt int64
curPhysicalRowCnt struct {
cnt int64
mu sync.Mutex
}
}

func (s *localRowCntListener) Written(rowCnt int) {
newCurPhysicalRowCnt := atomic.AddInt64(&s.curPhysicalRowCnt, int64(rowCnt))
s.reorgCtx.setRowCount(s.prevPhysicalRowCnt + newCurPhysicalRowCnt)
s.curPhysicalRowCnt.mu.Lock()
s.curPhysicalRowCnt.cnt += int64(rowCnt)
s.reorgCtx.setRowCount(s.prevPhysicalRowCnt + s.curPhysicalRowCnt.cnt)
s.curPhysicalRowCnt.mu.Unlock()
s.counter.Add(float64(rowCnt))
}

Expand Down

0 comments on commit 38e4538

Please sign in to comment.