Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Online DDL: new message_timestamp column in schema_migrations table #16633

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why timestamp(6) and not a normal timestamp like other columns?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practice tells me that I always end up "upgrading" a timetstamp to timestamp(6). I just appreciate the granularity, especially when it comes to critical points such as cutover where it can really clarify what's going on.

`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
Loading