From eb11918f02bd1df569cad6f48fbdf6a8eef83eb3 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Sun, 25 Aug 2024 08:18:16 +0300 Subject: [PATCH] Online DDL: new `message_timestamp` column in `schema_migrations` table (#16633) 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 c4c26aa52fd..9023639fd00 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 `