Skip to content

Commit daed73f

Browse files
author
Shlomi Noach
authored
Merge pull request #232 from github/end-rowcopy-progress
rowcount progress at 100% when row-copy completes
2 parents c3e65d4 + 16fc19b commit daed73f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

go/logic/migrator.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,15 +893,17 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
893893
elapsedSeconds := int64(elapsedTime.Seconds())
894894
totalRowsCopied := this.migrationContext.GetTotalRowsCopied()
895895
rowsEstimate := atomic.LoadInt64(&this.migrationContext.RowsEstimate) + atomic.LoadInt64(&this.migrationContext.RowsDeltaEstimate)
896+
if atomic.LoadInt64(&this.rowCopyCompleteFlag) == 1 {
897+
// Done copying rows. The totalRowsCopied value is the de-facto number of rows,
898+
// and there is no further need to keep updating the value.
899+
rowsEstimate = totalRowsCopied
900+
}
896901
var progressPct float64
897902
if rowsEstimate == 0 {
898903
progressPct = 100.0
899904
} else {
900905
progressPct = 100.0 * float64(totalRowsCopied) / float64(rowsEstimate)
901906
}
902-
if atomic.LoadInt64(&this.rowCopyCompleteFlag) == 1 {
903-
progressPct = 100.0
904-
}
905907
// Before status, let's see if we should print a nice reminder for what exactly we're doing here.
906908
shouldPrintMigrationStatusHint := (elapsedSeconds%600 == 0)
907909
if rule == ForcePrintStatusAndHintRule {

0 commit comments

Comments
 (0)