From 65280107422b177d0fba478d9c9c64a5fbe9b818 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Thu, 5 May 2016 09:18:19 +0300 Subject: [PATCH] Adding ETA starting at 2% progress --- go/logic/migrator.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/go/logic/migrator.go b/go/logic/migrator.go index 9343227e6..83e4068f7 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -550,6 +550,18 @@ func (this *Migrator) printStatus() { eta := "N/A" if isThrottled, throttleReason := this.migrationContext.IsThrottled(); isThrottled { eta = fmt.Sprintf("throttled, %s", throttleReason) + } else if progressPct > 100.0 { + eta = "Due" + } else if progressPct >= 2.0 { + elapsedRowCopySeconds := this.migrationContext.ElapsedRowCopyTime().Seconds() + totalExpectedSeconds := elapsedRowCopySeconds * float64(rowsEstimate) / float64(totalRowsCopied) + etaSeconds := totalExpectedSeconds - elapsedRowCopySeconds + etaDuration := time.Duration(etaSeconds) * time.Second + if etaDuration >= 0 { + eta = base.PrettifyDurationOutput(etaDuration) + } else { + eta = "Due" + } } status := fmt.Sprintf("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Elapsed: %+v(copy), %+v(total); ETA: %s", totalRowsCopied, rowsEstimate, progressPct,