Skip to content

Commit

Permalink
Online DDL: more scheduler triggering following successful operations (
Browse files Browse the repository at this point in the history
…vitessio#11701)

* Online DDL: more schedule triggers

Signed-off-by: Shlomi Noach <[email protected]>

* go mod tidy

Signed-off-by: Shlomi Noach <[email protected]>

Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Nov 16, 2022
1 parent 5111d4d commit 1409a75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/vt/vttablet/onlineddl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2168,6 +2168,7 @@ func (e *Executor) scheduleNextMigration(ctx context.Context) error {
onlyScheduleOneMigration.Do(func() {
err = e.updateMigrationStatus(ctx, uuid, schema.OnlineDDLStatusReady)
log.Infof("Executor.scheduleNextMigration: scheduling migration %s; err: %v", uuid, err)
e.triggerNextCheckInterval()
})
if err != nil {
return err
Expand Down Expand Up @@ -2552,6 +2553,7 @@ func (e *Executor) getCompletedMigrationByContextAndSQL(ctx context.Context, onl

// failMigration marks a migration as failed
func (e *Executor) failMigration(ctx context.Context, onlineDDL *schema.OnlineDDL, withError error) error {
defer e.triggerNextCheckInterval()
_ = e.updateMigrationStatusFailedOrCancelled(ctx, onlineDDL.UUID)
if withError != nil {
_ = e.updateMigrationMessage(ctx, onlineDDL.UUID, withError.Error())
Expand Down Expand Up @@ -3607,6 +3609,7 @@ func (e *Executor) reviewStaleMigrations(ctx context.Context) error {
if err := e.updateMigrationStatus(ctx, onlineDDL.UUID, schema.OnlineDDLStatusFailed); err != nil {
return err
}
defer e.triggerNextCheckInterval()
_ = e.updateMigrationStartedTimestamp(ctx, uuid)
// Because the migration is stale, it may not update completed_timestamp. It is essential to set completed_timestamp
// as this is then used when cleaning artifacts
Expand Down

0 comments on commit 1409a75

Please sign in to comment.