Skip to content

Commit e4ed801

Browse files
author
Shlomi Noach
committed
noting posponing status
1 parent 29aead6 commit e4ed801

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

go/base/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ type MigrationContext struct {
100100
isThrottled bool
101101
throttleReason string
102102
throttleMutex *sync.Mutex
103+
IsPostponingCutOver int64
103104

104105
OriginalTableColumns *sql.ColumnList
105106
OriginalTableUniqueKeys [](*sql.UniqueKey)

go/logic/migrator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,14 @@ func (this *Migrator) stopWritesAndCompleteMigration() (err error) {
381381
}
382382
if base.FileExists(this.migrationContext.PostponeCutOverFlagFile) {
383383
// Throttle file defined and exists!
384+
atomic.StoreInt64(&this.migrationContext.IsPostponingCutOver, 1)
384385
log.Debugf("Postponing final table swap as flag file exists: %+v", this.migrationContext.PostponeCutOverFlagFile)
385386
return true, nil
386387
}
387388
return false, nil
388389
},
389390
)
391+
atomic.StoreInt64(&this.migrationContext.IsPostponingCutOver, 0)
390392

391393
if this.migrationContext.TestOnReplica {
392394
return this.stopWritesAndCompleteMigrationOnReplica()
@@ -699,7 +701,9 @@ func (this *Migrator) printStatus(writers ...io.Writer) {
699701

700702
var etaSeconds float64 = math.MaxFloat64
701703
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 {
703707
eta = fmt.Sprintf("throttled, %s", throttleReason)
704708
} else if progressPct > 100.0 {
705709
eta = "Due"

0 commit comments

Comments
 (0)