Skip to content

Commit 1773f33

Browse files
author
Shlomi Noach
committed
keeping track of delta rows
on concurrent count(*) this means we re-apply delta onto new estimate
1 parent 553f4c8 commit 1773f33

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

go/base/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ type MigrationContext struct {
9595

9696
TableEngine string
9797
RowsEstimate int64
98+
RowsDeltaEstimate int64
9899
UsedRowsEstimateMethod RowsEstimateMethod
99100
HasSuperPrivilege bool
100101
OriginalBinlogFormat string

go/logic/applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error {
890890
// no error
891891
atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1)
892892
if this.migrationContext.CountTableRows {
893-
atomic.AddInt64(&this.migrationContext.RowsEstimate, rowDelta)
893+
atomic.AddInt64(&this.migrationContext.RowsDeltaEstimate, rowDelta)
894894
}
895895
return nil
896896
}

go/logic/migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
962962
elapsedTime := this.migrationContext.ElapsedTime()
963963
elapsedSeconds := int64(elapsedTime.Seconds())
964964
totalRowsCopied := this.migrationContext.GetTotalRowsCopied()
965-
rowsEstimate := atomic.LoadInt64(&this.migrationContext.RowsEstimate)
965+
rowsEstimate := atomic.LoadInt64(&this.migrationContext.RowsEstimate) + atomic.LoadInt64(&this.migrationContext.RowsDeltaEstimate)
966966
var progressPct float64
967967
if rowsEstimate == 0 {
968968
progressPct = 100.0

0 commit comments

Comments
 (0)