Fixes the cutover rename+gtid selection and drain logic#1707
Merged
zacharysierakowski merged 3 commits intoJun 12, 2026
Merged
Conversation
732581d
into
womoruyi/move-tables-1.5-cutover
6 checks passed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens correctness and operator-safety of move-tables cooperative cutover by ensuring rename+GTID capture are connection-pinned, drain completion also accounts for queued work, and move-tables runs are gated by an explicit postpone flag file (with a move-tables-appropriate cutover timeout default).
Changes:
- Pin T1 (RENAME) + T2 (GTID capture) to a single DB connection and improve T3 drain completion logic by also checking streamer/apply backlogs.
- Make
--postpone-cut-over-flag-filerequired for--move-tables, and default--cut-over-lock-timeout-secondsto 60s in move-tables mode (while preserving explicit user overrides). - Update local move-tables scripts/docs and add a helper script to continuously insert rows on the source primary.
Show a summary per file
| File | Description |
|---|---|
| script/move-tables/setup | Forces local replicas to be read-only to prevent accidental replica-only mutations and to fail cutover rename when pointed at a replica. |
| script/move-tables/README.md | Updates example invocation for move-tables to use primary and require postpone flag file. |
| script/move-tables/insert-source-primary-loop | Adds a helper script to generate continuous source-side writes for testing drain/cutover behavior. |
| go/logic/migrator.go | Updates move-tables orchestration: earlier flag-file creation, T1/T2 pinning, drain timeout reuse, and backlog-aware drain completion. |
| go/logic/migrator_move_tables_cutover_test.go | Adjusts drain-timeout test to use CutOverLockTimeoutSeconds and adds coverage for “queued DML prevents premature drain success”. |
| go/cmd/gh-ost/main.go | Enforces required postpone flag for move-tables and sets move-tables default cutover-lock-timeout to 60s unless user specified. |
| go/base/context.go | Allows CutOverLockTimeoutSeconds up to 60s in move-tables mode. |
| go/base/context_test.go | Adds tests asserting timeout range differs by mode (standard vs move-tables). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 1
Comment on lines
+998
to
+1002
| pinnedConn, err := mgtr.inspector.db.Conn(context.Background()) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to pin connection for T1/T2: %w", err) | ||
| } | ||
| defer pinnedConn.Close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
re: https://github.com/github/database-infrastructure/issues/8209
targets: #1704
Description
Applies some suggestions and fixes on top of #1704.
Details