Move table mode for gh-ost
Maintainer thường phản hồi trong vòng 10 ngày
@ericyan đang làm issue này rồi.
Từ ngày 18/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 13.6k
- Fork
- 1.4k
- Merge trung bình
- 9 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/gh-ost
-
`--resume` without `--execute` drops the ghost table it correctly skipped alteringCó thể đã có người làm @ajm188 đã nhận 55 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 10 ngày
-
[Suggestion] Apply simple validation to alter commandCó thể đã có người làm @drkemp187 đã nhận 106 ngày trước. Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
github/gh-ost#1431 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
-
Migration hangs when --attempt-instant-ddl succeedsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 10 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 10 ngày
-
Atomic cut-over always fails on MySQL 9.1+: information_schema.processlist errors out (3854) while another session runs a non-BMP utf8mb4 statementCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
github/gh-ost#1780 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 10 ngày
Tất cả issue của github/gh-ost
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
prime-radiant-inc/evener#6325 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
team:library-maintainers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
padok-team/burrito#1208 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bazel-contrib/rules_go#4784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
betterleaks/betterleaks#484 ·
Maintainer thường phản hồi trong vòng 1 ngày