keeping track of delta rows

on concurrent count(*) this means we re-apply delta onto new estimate
This commit is contained in:
Shlomi Noach 2016-08-24 12:16:34 +02:00
parent 553f4c8d13
commit 1773f338c2
3 changed files with 3 additions and 2 deletions

View File

@ -95,6 +95,7 @@ type MigrationContext struct {
TableEngine string
RowsEstimate int64
RowsDeltaEstimate int64
UsedRowsEstimateMethod RowsEstimateMethod
HasSuperPrivilege bool
OriginalBinlogFormat string

View File

@ -890,7 +890,7 @@ func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error {
// no error
atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1)
if this.migrationContext.CountTableRows {
atomic.AddInt64(&this.migrationContext.RowsEstimate, rowDelta)
atomic.AddInt64(&this.migrationContext.RowsDeltaEstimate, rowDelta)
}
return nil
}

View File

@ -962,7 +962,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
elapsedTime := this.migrationContext.ElapsedTime()
elapsedSeconds := int64(elapsedTime.Seconds())
totalRowsCopied := this.migrationContext.GetTotalRowsCopied()
rowsEstimate := atomic.LoadInt64(&this.migrationContext.RowsEstimate)
rowsEstimate := atomic.LoadInt64(&this.migrationContext.RowsEstimate) + atomic.LoadInt64(&this.migrationContext.RowsDeltaEstimate)
var progressPct float64
if rowsEstimate == 0 {
progressPct = 100.0