File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ type MigrationContext struct {
100
100
isThrottled bool
101
101
throttleReason string
102
102
throttleMutex * sync.Mutex
103
+ IsPostponingCutOver int64
103
104
104
105
OriginalTableColumns * sql.ColumnList
105
106
OriginalTableUniqueKeys [](* sql.UniqueKey )
Original file line number Diff line number Diff line change @@ -381,12 +381,14 @@ func (this *Migrator) stopWritesAndCompleteMigration() (err error) {
381
381
}
382
382
if base .FileExists (this .migrationContext .PostponeCutOverFlagFile ) {
383
383
// Throttle file defined and exists!
384
+ atomic .StoreInt64 (& this .migrationContext .IsPostponingCutOver , 1 )
384
385
log .Debugf ("Postponing final table swap as flag file exists: %+v" , this .migrationContext .PostponeCutOverFlagFile )
385
386
return true , nil
386
387
}
387
388
return false , nil
388
389
},
389
390
)
391
+ atomic .StoreInt64 (& this .migrationContext .IsPostponingCutOver , 0 )
390
392
391
393
if this .migrationContext .TestOnReplica {
392
394
return this .stopWritesAndCompleteMigrationOnReplica ()
@@ -699,7 +701,9 @@ func (this *Migrator) printStatus(writers ...io.Writer) {
699
701
700
702
var etaSeconds float64 = math .MaxFloat64
701
703
eta := "N/A"
702
- if isThrottled , throttleReason := this .migrationContext .IsThrottled (); isThrottled {
704
+ if atomic .LoadInt64 (& this .migrationContext .IsPostponingCutOver ) > 0 {
705
+ eta = "postponing cut-over"
706
+ } else if isThrottled , throttleReason := this .migrationContext .IsThrottled (); isThrottled {
703
707
eta = fmt .Sprintf ("throttled, %s" , throttleReason )
704
708
} else if progressPct > 100.0 {
705
709
eta = "Due"
You can’t perform that action at this time.
0 commit comments