@@ -895,6 +895,8 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
895895 } else {
896896 progressPct = 100.0 * float64 (totalRowsCopied ) / float64 (rowsEstimate )
897897 }
898+ // we take the opportunity to update migration context with progressPct
899+ this .migrationContext .SetProgressPct (progressPct )
898900 // Before status, let's see if we should print a nice reminder for what exactly we're doing here.
899901 shouldPrintMigrationStatusHint := (elapsedSeconds % 600 == 0 )
900902 if rule == ForcePrintStatusAndHintRule {
@@ -911,7 +913,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
911913 eta := "N/A"
912914 if progressPct >= 100.0 {
913915 eta = "due"
914- } else if progressPct >= 1.0 {
916+ } else if progressPct >= 0.1 {
915917 elapsedRowCopySeconds := this .migrationContext .ElapsedRowCopyTime ().Seconds ()
916918 totalExpectedSeconds := elapsedRowCopySeconds * float64 (rowsEstimate ) / float64 (totalRowsCopied )
917919 etaSeconds = totalExpectedSeconds - elapsedRowCopySeconds
@@ -958,12 +960,13 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
958960
959961 currentBinlogCoordinates := * this .eventsStreamer .GetCurrentBinlogCoordinates ()
960962
961- status := fmt .Sprintf ("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Time: %+v(total), %+v(copy); streamer: %+v; State: %s; ETA: %s" ,
963+ status := fmt .Sprintf ("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Time: %+v(total), %+v(copy); streamer: %+v; Lag: %.2fs, State: %s; ETA: %s" ,
962964 totalRowsCopied , rowsEstimate , progressPct ,
963965 atomic .LoadInt64 (& this .migrationContext .TotalDMLEventsApplied ),
964966 len (this .applyEventsQueue ), cap (this .applyEventsQueue ),
965967 base .PrettifyDurationOutput (elapsedTime ), base .PrettifyDurationOutput (this .migrationContext .ElapsedRowCopyTime ()),
966968 currentBinlogCoordinates ,
969+ this .migrationContext .GetCurrentLagDuration ().Seconds (),
967970 state ,
968971 eta ,
969972 )
0 commit comments