Skip to content

Commit eb11918

Browse files
authored
Online DDL: new message_timestamp column in schema_migrations table (#16633)
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
1 parent 81ed314 commit eb11918

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ func testScheduler(t *testing.T) {
13201320
for _, row := range rs.Named().Rows {
13211321
message := row["message"].ToString()
13221322
require.Contains(t, message, "errno 1146")
1323+
require.False(t, row["message_timestamp"].IsNull())
13231324
}
13241325
})
13251326

@@ -1463,6 +1464,7 @@ func testScheduler(t *testing.T) {
14631464
for _, row := range rs.Named().Rows {
14641465
message := row["message"].ToString()
14651466
require.Contains(t, message, vuuids[2]) // Indicating this migration failed due to vuuids[2] failure
1467+
require.False(t, row["message_timestamp"].IsNull())
14661468
}
14671469
}
14681470
})

go/vt/sidecardb/schema/onlineddl/schema_migrations.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations
4242
`migration_context` varchar(1024) NOT NULL DEFAULT '',
4343
`ddl_action` varchar(16) NOT NULL DEFAULT '',
4444
`message` text NOT NULL,
45+
`message_timestamp` timestamp(6) NULL DEFAULT NULL,
4546
`eta_seconds` bigint NOT NULL DEFAULT '-1',
4647
`rows_copied` bigint unsigned NOT NULL DEFAULT '0',
4748
`table_rows` bigint NOT NULL DEFAULT '0',

go/vt/vttablet/onlineddl/schema.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ const (
209209
migration_uuid=%a
210210
`
211211
sqlUpdateMessage = `UPDATE _vt.schema_migrations
212-
SET message=%a
212+
SET
213+
message=%a,
214+
message_timestamp=NOW(6)
213215
WHERE
214216
migration_uuid=%a
215217
`

0 commit comments

Comments
 (0)