Skip to content

Commit

Permalink
Online DDL: new message_timestamp column in schema_migrations tab…
Browse files Browse the repository at this point in the history
…le (#16633)

Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Aug 25, 2024
1 parent 81ed314 commit eb11918
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,7 @@ func testScheduler(t *testing.T) {
for _, row := range rs.Named().Rows {
message := row["message"].ToString()
require.Contains(t, message, "errno 1146")
require.False(t, row["message_timestamp"].IsNull())
}
})

Expand Down Expand Up @@ -1463,6 +1464,7 @@ func testScheduler(t *testing.T) {
for _, row := range rs.Named().Rows {
message := row["message"].ToString()
require.Contains(t, message, vuuids[2]) // Indicating this migration failed due to vuuids[2] failure
require.False(t, row["message_timestamp"].IsNull())
}
}
})
Expand Down
1 change: 1 addition & 0 deletions go/vt/sidecardb/schema/onlineddl/schema_migrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations
`migration_context` varchar(1024) NOT NULL DEFAULT '',
`ddl_action` varchar(16) NOT NULL DEFAULT '',
`message` text NOT NULL,
`message_timestamp` timestamp(6) NULL DEFAULT NULL,
`eta_seconds` bigint NOT NULL DEFAULT '-1',
`rows_copied` bigint unsigned NOT NULL DEFAULT '0',
`table_rows` bigint NOT NULL DEFAULT '0',
Expand Down
4 changes: 3 additions & 1 deletion go/vt/vttablet/onlineddl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ const (
migration_uuid=%a
`
sqlUpdateMessage = `UPDATE _vt.schema_migrations
SET message=%a
SET
message=%a,
message_timestamp=NOW(6)
WHERE
migration_uuid=%a
`
Expand Down

0 comments on commit eb11918

Please sign in to comment.