Skip to content

Commit 1c56d1f

Browse files
author
Shlomi Noach
authored
Merge pull request #85 from github/unpostpone
supporting 'unpostpone' command
2 parents b583458 + 37e3c94 commit 1c56d1f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

go/logic/migrator.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ type Migrator struct {
6767
allEventsUpToLockProcessedInjectedFlag int64
6868
inCutOverCriticalActionFlag int64
6969
cleanupImminentFlag int64
70+
userCommandedUnpostponeFlag int64
7071
// copyRowsQueue should not be buffered; if buffered some non-damaging but
7172
// excessive work happens at the end of the iteration as new copy-jobs arrive befroe realizing the copy is complete
7273
copyRowsQueue chan tableWriteFunc
@@ -447,6 +448,9 @@ func (this *Migrator) cutOver() (err error) {
447448
if this.migrationContext.PostponeCutOverFlagFile == "" {
448449
return false, nil
449450
}
451+
if atomic.LoadInt64(&this.userCommandedUnpostponeFlag) > 0 {
452+
return false, nil
453+
}
450454
if base.FileExists(this.migrationContext.PostponeCutOverFlagFile) {
451455
// Throttle file defined and exists!
452456
atomic.StoreInt64(&this.migrationContext.IsPostponingCutOver, 1)
@@ -792,6 +796,7 @@ throttle-query=<query> # Set a new throttle-query
792796
throttle-control-replicas=<replicas> #
793797
throttle # Force throttling
794798
no-throttle # End forced throttling (other throttling may still apply)
799+
unpostpone # Bail out a cut-over postpone; proceed to cut-over
795800
panic # panic and quit without cleanup
796801
help # This message
797802
`)
@@ -846,6 +851,15 @@ help # This message
846851
{
847852
atomic.StoreInt64(&this.migrationContext.ThrottleCommandedByUser, 0)
848853
}
854+
case "unpostpone", "no-postpone", "cut-over":
855+
{
856+
if atomic.LoadInt64(&this.migrationContext.IsPostponingCutOver) > 0 {
857+
atomic.StoreInt64(&this.userCommandedUnpostponeFlag, 1)
858+
fmt.Fprintf(writer, "Unpostponed\n")
859+
} else {
860+
fmt.Fprintf(writer, "You may only invoke this when gh-ost is actively postponing migration. At this time it is not.\n")
861+
}
862+
}
849863
case "panic":
850864
{
851865
err := fmt.Errorf("User commanded 'panic'. I will now panic, without cleanup. PANIC!")

0 commit comments

Comments
 (0)