Skip to content

Commit

Permalink
Online DDL: even more logging (vitessio#10615) (vitessio#798)
Browse files Browse the repository at this point in the history
* clean error message upon RETRY

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

* auditing change of status, change of message, termination, finding stale migration

Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored and rohit-nayak-ps committed Jul 15, 2022
1 parent 60dbccc commit 533e96d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/vt/vttablet/onlineddl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,7 @@ func (e *Executor) readPendingMigrationsUUIDs(ctx context.Context) (uuids []stri

// terminateMigration attempts to interrupt and hard-stop a running migration
func (e *Executor) terminateMigration(ctx context.Context, onlineDDL *schema.OnlineDDL) (foundRunning bool, err error) {
log.Infof("terminateMigration: request to terminate %s", onlineDDL.UUID)
// It's possible the killing the migration fails for whatever reason, in which case
// the logic will retry killing it later on.
// Whatever happens in this function, this executor stops owning the given migration.
Expand Down Expand Up @@ -3313,7 +3314,8 @@ func (e *Executor) reviewStaleMigrations(ctx context.Context) error {
if err != nil {
return err
}
message := fmt.Sprintf("stale migration %s: found running but indicates no liveness", onlineDDL.UUID)
log.Infof("reviewStaleMigrations: stale migration found: %s", onlineDDL.UUID)
message := fmt.Sprintf("stale migration %s: found running but indicates no liveness in the past %v minutes", onlineDDL.UUID, staleMigrationMinutes)
if onlineDDL.TabletAlias != e.TabletAliasString() {
// This means another tablet started the migration, and the migration has failed due to the tablet failure (e.g. primary failover)
if err := e.updateTabletFailure(ctx, onlineDDL.UUID); err != nil {
Expand Down Expand Up @@ -3635,6 +3637,7 @@ func (e *Executor) updateTabletFailure(ctx context.Context, uuid string) error {
}

func (e *Executor) updateMigrationStatus(ctx context.Context, uuid string, status schema.OnlineDDLStatus) error {
log.Infof("updateMigrationStatus: transitioning migration: %s into status: %s", uuid, string(status))
query, err := sqlparser.ParseAndBind(sqlUpdateMigrationStatus,
sqltypes.StringBindVariable(string(status)),
sqltypes.StringBindVariable(uuid),
Expand All @@ -3659,6 +3662,7 @@ func (e *Executor) updateDDLAction(ctx context.Context, uuid string, actionStr s
}

func (e *Executor) updateMigrationMessage(ctx context.Context, uuid string, message string) error {
log.Infof("updateMigrationMessage: uuid=%s, message=%s", uuid, message)
query, err := sqlparser.ParseAndBind(sqlUpdateMessage,
sqltypes.StringBindVariable(message),
sqltypes.StringBindVariable(uuid),
Expand Down
2 changes: 2 additions & 0 deletions go/vt/vttablet/onlineddl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ const (
tablet=%a,
retries=retries + 1,
tablet_failure=0,
message='',
ready_timestamp=NULL,
started_timestamp=NULL,
liveness_timestamp=NULL,
Expand All @@ -277,6 +278,7 @@ const (
tablet=%a,
retries=retries + 1,
tablet_failure=0,
message='',
ready_timestamp=NULL,
started_timestamp=NULL,
liveness_timestamp=NULL,
Expand Down

0 comments on commit 533e96d

Please sign in to comment.