From 3ca1142f29a7bc933dd9bfc1d229bb1c7d1a3e46 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:05:35 +0300 Subject: [PATCH] New 'message_timestamp' column in 'schema_migrations' table Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- .../endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go | 2 ++ go/vt/sidecardb/schema/onlineddl/schema_migrations.sql | 1 + go/vt/vttablet/onlineddl/schema.go | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go b/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go index cf942de1aa8..33cd9ea4305 100644 --- a/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go +++ b/go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go @@ -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()) } }) @@ -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()) } } }) diff --git a/go/vt/sidecardb/schema/onlineddl/schema_migrations.sql b/go/vt/sidecardb/schema/onlineddl/schema_migrations.sql index 82d0c221f0e..0e1b8ecde11 100644 --- a/go/vt/sidecardb/schema/onlineddl/schema_migrations.sql +++ b/go/vt/sidecardb/schema/onlineddl/schema_migrations.sql @@ -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', diff --git a/go/vt/vttablet/onlineddl/schema.go b/go/vt/vttablet/onlineddl/schema.go index 28e32e7dab4..34d12298754 100644 --- a/go/vt/vttablet/onlineddl/schema.go +++ b/go/vt/vttablet/onlineddl/schema.go @@ -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 `