@@ -906,14 +906,8 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
906
906
907
907
var etaSeconds float64 = math .MaxFloat64
908
908
eta := "N/A"
909
- if atomic .LoadInt64 (& this .migrationContext .CountingRowsFlag ) > 0 && ! this .migrationContext .ConcurrentCountTableRows {
910
- eta = "counting rows"
911
- } else if atomic .LoadInt64 (& this .migrationContext .IsPostponingCutOver ) > 0 {
912
- eta = "postponing cut-over"
913
- } else if isThrottled , throttleReason := this .migrationContext .IsThrottled (); isThrottled {
914
- eta = fmt .Sprintf ("throttled, %s" , throttleReason )
915
- } else if progressPct > 100.0 {
916
- eta = "Due"
909
+ if progressPct >= 100.0 {
910
+ eta = "due"
917
911
} else if progressPct >= 1.0 {
918
912
elapsedRowCopySeconds := this .migrationContext .ElapsedRowCopyTime ().Seconds ()
919
913
totalExpectedSeconds := elapsedRowCopySeconds * float64 (rowsEstimate ) / float64 (totalRowsCopied )
@@ -922,10 +916,20 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
922
916
etaDuration := time .Duration (etaSeconds ) * time .Second
923
917
eta = base .PrettifyDurationOutput (etaDuration )
924
918
} else {
925
- eta = "Due "
919
+ eta = "due "
926
920
}
927
921
}
928
922
923
+ state := "migrating"
924
+ if atomic .LoadInt64 (& this .migrationContext .CountingRowsFlag ) > 0 && ! this .migrationContext .ConcurrentCountTableRows {
925
+ state = "counting rows"
926
+ } else if atomic .LoadInt64 (& this .migrationContext .IsPostponingCutOver ) > 0 {
927
+ eta = "due"
928
+ state = "postponing cut-over"
929
+ } else if isThrottled , throttleReason := this .migrationContext .IsThrottled (); isThrottled {
930
+ state = fmt .Sprintf ("throttled, %s" , throttleReason )
931
+ }
932
+
929
933
shouldPrintStatus := false
930
934
if rule == HeuristicPrintStatusRule {
931
935
if elapsedSeconds <= 60 {
@@ -951,12 +955,13 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
951
955
952
956
currentBinlogCoordinates := * this .eventsStreamer .GetCurrentBinlogCoordinates ()
953
957
954
- status := fmt .Sprintf ("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Time: %+v(total), %+v(copy); streamer: %+v; ETA: %s" ,
958
+ status := fmt .Sprintf ("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Time: %+v(total), %+v(copy); streamer: %+v; State: %s; ETA: %s" ,
955
959
totalRowsCopied , rowsEstimate , progressPct ,
956
960
atomic .LoadInt64 (& this .migrationContext .TotalDMLEventsApplied ),
957
961
len (this .applyEventsQueue ), cap (this .applyEventsQueue ),
958
962
base .PrettifyDurationOutput (elapsedTime ), base .PrettifyDurationOutput (this .migrationContext .ElapsedRowCopyTime ()),
959
963
currentBinlogCoordinates ,
964
+ state ,
960
965
eta ,
961
966
)
962
967
this .applier .WriteChangelog (
0 commit comments