Move table mode for gh-ost
I maintainer di solito rispondono entro 10 giorni
@ericyan ci sta già lavorando.
Dal 18/8/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
This document specifies the work needed inside gh-ost to support a new move table mode, in which one or more tables are copied from a source MySQL cluster to a target MySQL cluster, with a cooperative cutover protocol coordinated via hooks.
Scope
In scope:
- One or more tables in a single gh-ost run, sharing one source binlog stream.
- GTID-only operation.
- gh-ost issues the source
RENAME TABLEitself; ACL changes and feature-flag flips are delegated to hook scripts.
Explicitly deferred or out of scope:
- Schema transformation (
--alter) combined with move. - File+position binlog drain (non-GTID).
- Inline checksumming or target-binlog monitoring (use
pt-table-checksumexternally). - Revert / rollback of a completed move.
- Source-side grant cleanup.
Design
Move table mode is enabled by a single new flag --move-tables=t1,t2,.... The mode reuses the existing inspector, binlog streamer, chunk iterator, throttler, hook executor, and checkpoint mechanism, while introducing a second database connection (the target), per-table runtime state, and a cooperative cutover protocol driven by gh-ost.
Architecture overview
┌──────────────────────┐ ┌──────────────────────┐
│ Source MySQL │ │ Target MySQL │
│ │ │ │
│ ┌─────────┐ │ │ ┌─────────┐ │
│ │ table_A │◄── Inspector reads ──┐ │ │ table_A │ │
│ │ table_B │ │ │ │ table_B │ │
│ └─────────┘ │ │ │ └─────────┘ │
│ │ │ │ ▲ │
│ Binlog ────────────────► EventsStreamer │ │ │
│ │ │ │ Applier writes ────┘
│ │ gh-ost │ │
│ │ process │ ┌─────────┐ │
│ │ │ │ │ _ghk │ │
│ │ └───────│──│checkpoint│ │
│ │ │ └─────────┘ │
└──────────────────────┘ └──────────────────────┘
Key principle: limit changes to the hot code path (eg. binlog streamer). All move-table-specific logic lives in higher layers — the migrator (cutover orchestration and multi-table iteration) and the applier (where it connects and what tables it writes to).
Connection model
| Connection | Standard mode | Move table mode |
|---|---|---|
| Inspector | reads from source | reads from source (unchanged) |
| Binlog streamer | reads from source | reads from source (unchanged) |
| Applier | writes to source-side master | writes to target master |
| Cutover | issues RENAME on source |
issues RENAME on source (short-lived, reuses inspector connection config) |
Cutover protocol
The read cutover is the application repoints its reads to the target while writes still flow to the source. The write cutover is the actual "cutover", in which gh-ost issues a single atomic RENAME TABLE on the source, captures @@gtid_executed as the drain marker, waits until the applier has reached that GTID, and fires on-success so the hook can unlock the target write user and flip the application's write feature flag.
- Lingua principale
- Go
- Stelle
- 13.6k
- Fork
- 1.4k
- Merge medio
- 9g 19h
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/gh-ost
-
`--resume` without `--execute` drops the ghost table it correctly skipped alteringForse già presa @ajm188 l’ha presa 55 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 10 giorni
-
[Suggestion] Apply simple validation to alter commandForse già presa @drkemp187 l’ha presa 106 giorni fa. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
github/gh-ost#1431 · 4 commenti ·
I maintainer di solito rispondono entro 10 giorni
-
Migration hangs when --attempt-instant-ddl succeedsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 10 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 10 giorni
-
Atomic cut-over always fails on MySQL 9.1+: information_schema.processlist errors out (3854) while another session runs a non-BMP utf8mb4 statementForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
github/gh-ost#1780 · 1 commento ·
I maintainer di solito rispondono entro 10 giorni
Tutte le issue di github/gh-ost
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
prime-radiant-inc/evener#6325 ·
I maintainer di solito rispondono entro 1 giorno
-
team:library-maintainers
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
padok-team/burrito#1208 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
bazel-contrib/rules_go#4784 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
betterleaks/betterleaks#484 ·
I maintainer di solito rispondono entro 1 giorno