Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
adf8a6e
dummy commit
meiji163 Feb 2, 2024
e87e2ab
Bump golangci/golangci-lint-action from 4 to 6 (#1414)
dependabot[bot] May 7, 2024
59db6fa
chore: fix some function names (#1417)
overallteach Jun 2, 2024
ef238ee
Double the time waiting post replication restart
andyedison Jun 11, 2024
1e1fbcb
Ensure `-attempt-instant-ddl` respects `-execute` flag (#1440)
timvaillancourt Aug 14, 2024
48cb9ab
Refine `wait_timeout` override to be at cut-over only (#1406)
timvaillancourt Aug 15, 2024
1e25e71
Add logic to ensure replication has started instead of assuming it ha…
andyedison Oct 14, 2024
df7fba3
Revert unintended change
andyedison Oct 14, 2024
ea5708e
Merge branch 'master' into adjust-wait-post-repl-restart
andyedison Oct 14, 2024
0a0d1f4
Do not lock rows when copying.
arthurschreiber Oct 20, 2024
96f841a
Switch all unit tests to use `stretchr/testify` for assertions.
arthurschreiber Oct 21, 2024
db9c69a
Use testcontainers to spawn MySQL server container in unit tests.
arthurschreiber Oct 21, 2024
00f450d
Merge pull request #1456 from github/arthur/use-stretchr-testify
arthurschreiber Oct 21, 2024
b34b86d
Make linter happy,
arthurschreiber Oct 21, 2024
9af3a07
Merge pull request #1458 from github/arthur/use-testcontainers
arthurschreiber Oct 21, 2024
412346e
Use query builders for DML event queries
danieljoos Oct 22, 2024
590f875
Merge branch 'master' of https://github.com/github/gh-ost into arthur…
arthurschreiber Oct 22, 2024
16a88d8
Add `for share nowait` option.
arthurschreiber Oct 22, 2024
095fb26
Fix linter issues.
arthurschreiber Oct 22, 2024
a91c386
Only specify `for share nowait` on transactional tables.
arthurschreiber Oct 22, 2024
4608dcb
Temporarily moving one check on column lists to `DMLUpdateQueryBuilde…
danieljoos Oct 23, 2024
ab74e99
Add doc comments and remove old DML query builder functions
danieljoos Oct 23, 2024
5ddeb21
Only use `NOWAIT` on MySQL 8.
arthurschreiber Oct 23, 2024
30f28c2
Merge pull request #1455 from github/arthur/dont-lock-rows
arthurschreiber Oct 23, 2024
5c0829a
Merge branch 'master' into danieljoos-dml-query-builders
arthurschreiber Oct 23, 2024
a834c00
Merge pull request #1459 from github/danieljoos-dml-query-builders
arthurschreiber Oct 23, 2024
a7e4601
use multiStatements to apply DML
meiji163 Oct 23, 2024
90d6148
fix test
meiji163 Oct 23, 2024
2a3318c
conn.Raw not working
meiji163 Oct 24, 2024
1bd2b0b
Fix named value building.
arthurschreiber Oct 24, 2024
c1b6000
add arthurscreiber's review suggestions
meiji163 Oct 24, 2024
2e62f2a
set session outside of transaction
meiji163 Oct 24, 2024
7c30fb0
Merge pull request #1462 from github/meiji163/multi-stmt
arthurschreiber Oct 25, 2024
a6ccd3f
fix: onSuccess hook to run after INSTANT (#1463)
artemvovk Oct 31, 2024
42c0f08
Tweak the testcontainers setup (#1460)
arthurschreiber Nov 18, 2024
0676116
fix build script exit code and fix typo in README (#1472)
whhe Nov 20, 2024
dbd3d71
Docker setup for localtests (#1479)
meiji163 Dec 13, 2024
4b0ac90
Bump golang.org/x/crypto in the go_modules group across 1 directory (…
dependabot[bot] Dec 17, 2024
690b1e1
fix: use cut-over-lock-timeout for instant DDL (#1468)
artemvovk Dec 17, 2024
d22c11c
Merge branch 'master' into adjust-wait-post-repl-restart
meiji163 Dec 17, 2024
09052e6
use last second copy rate to project ETA (#1231)
morgo Dec 18, 2024
1f548bc
Merge branch 'master' into adjust-wait-post-repl-restart
andyedison Dec 18, 2024
19cf183
Merge pull request #1422 from github/adjust-wait-post-repl-restart
andyedison Dec 18, 2024
0fe1190
Fix generated column in unique key error (#1461)
meiji163 Dec 18, 2024
d5ab048
upgrade net v0.24.0 -> v0.33.0 (#1482)
meiji163 Dec 19, 2024
ad5d3ea
Improve logic to include originalUniqueKey in sharedUniqueKeys (#1453)
htmsousa Jan 5, 2025
be413cf
Add MySQL 8.4 Support (#1494)
chen-anders Feb 10, 2025
2ea0e60
Prevent exponential backoff from overflowing. (#1491)
burnison Feb 10, 2025
d8672f7
Fix TLS verify error when gh-ost discovers the replication master (#1…
petervandoros Feb 24, 2025
7ea3047
Avoid logging MySQL connection configs (#1501)
meiji163 Feb 28, 2025
0263a20
Fix #1502 Add triggers support (#1503)
yakirgb Mar 3, 2025
5713a29
Update status format in docs (#1512)
coding-chimp Mar 14, 2025
9d6e3e9
Upgrade go to 1.23.0, `net` module to 0.36.0 (#1511)
dependabot[bot] Mar 18, 2025
5c3e42a
upgrade golang builder images (#1519)
meiji163 Mar 19, 2025
eedac87
PanicOnWarnings option to detect SQL warnings and fail the copy proce…
grodowski Mar 26, 2025
801ebab
Remove restriction on password length and bump go-mysql to 1.11.0 (#1…
joshvarner Apr 3, 2025
9059f30
Final cleanup after InstantDDL (#1520)
pasha132 Apr 7, 2025
d651ae9
Bump github.com/containerd/containerd from 1.7.18 to 1.7.27 in the go…
dependabot[bot] Apr 7, 2025
4502796
Use docker for CI replica tests, deprecate dbdeployer (#1529)
meiji163 Apr 8, 2025
d864119
Bump golang.org/x/net in the go_modules group across 1 directory
dependabot[bot] May 9, 2025
5c88f54
Merge pull request #1534 from github/dependabot/go_modules/go_modules…
jdramosf May 9, 2025
7c18055
Remove counts from CalculateNextIterationRangeEndValues that caused p…
grodowski Jun 5, 2025
fb3d71d
Fix output for `binary` keys in `-verbose` mode. (#1559)
burnison Jun 5, 2025
7c40d9e
Add copier test, upgrade testcontainers (#1567)
meiji163 Jun 25, 2025
7c3b9a1
Before the successful renaming, a session accessed the ghost table, w…
abaowhy Jun 27, 2025
70b65bd
Add postpone-cut-over-flag-file interactive command (#1561)
yktakaha4 Jul 1, 2025
65f88c6
Fix conversion bug when string data comes from binlog (#1571)
mattbooks Jul 24, 2025
7cc7cc8
Align max dml-batch-size with the implementation (#1575)
yktakaha4 Aug 12, 2025
b897def
fix(applier): added support for unique text column, they are mapped t…
markmarkmarkthebest Sep 22, 2025
9258cbe
Add sysbench localtest (#1590)
meiji163 Oct 8, 2025
57df4b4
add toxiproxy option for localtests (#1591)
meiji163 Oct 10, 2025
6b676f1
Bump actions/setup-go from 5 to 6 (#1581)
dependabot[bot] Oct 10, 2025
4f5e58c
Panic if InitiateHeartbeat exhausts retries to avoid looping infinite…
meiji163 Oct 10, 2025
005043d
Add GTID support for binlog streaming (#1584)
meiji163 Oct 10, 2025
0284a97
Add languages to codeql matrix (#1570)
bkungl Oct 13, 2025
1557a95
Resume from checkpoint (#1595)
meiji163 Oct 16, 2025
bba7359
Fix lexographical comparison of binlog filenames (#1604)
grodowski Nov 6, 2025
1b7933a
Potential fix for code scanning alert no. 5: Workflow does not contai…
cinderellasecure Nov 6, 2025
215dee4
escape table name in ReadLastCheckpoint (#1610)
meiji163 Nov 24, 2025
ec02c37
Revertible Migration (#1607)
meiji163 Nov 25, 2025
982eefb
Change checkpoint binlog coordinates field to TEXT (#1611)
meiji163 Dec 5, 2025
cc2dd7f
Add flag --skip-metadata-lock-check (#1616)
meiji163 Jan 16, 2026
a1e9c9d
fix: add missing error check for WriteChangelogState in initiateAppli…
ajm188 Jan 30, 2026
aadbb79
Fix problems when altering a column from `binary` to `varbinary` (#1628)
jorendorff Feb 10, 2026
c6f95cc
Fix 4 trigger handling bugs (#1626)
yakirgb Feb 10, 2026
c72b237
Create a hook to capture copy batch errors and retries (#1638)
meiji163 Mar 5, 2026
753cf88
Fix data loss when inserting duplicate values during a migration (#1633)
ggilder Mar 9, 2026
f7862c0
Add support for go 1.25 (#1634)
ggilder Mar 9, 2026
b000b24
Replace usage of `Fatale` with context cancellation (#1639)
ggilder Mar 12, 2026
67cc636
Improve tests for various error scenarios (#1642)
ggilder Mar 17, 2026
b9652c3
Add retry logic for instant DDL on lock wait timeout (#1651)
yosefbs Mar 18, 2026
0d5c737
Fix local tests by making .gopath writable to avoid toolchain rm perm…
grodowski Mar 24, 2026
8f274f7
Fix handling of warnings on DML batches (#1643)
ggilder Mar 27, 2026
8bc63f0
Fix abort/retry interaction (#1655)
ggilder Apr 2, 2026
0270a28
Add `GH_OST_INSTANT_DDL` for gh-ost-on-success hook (#1658)
meiji163 Apr 8, 2026
a3d0115
Fix Warning 1300 for varbinary columns with bytes invalid as utf8mb4 …
ggilder Apr 22, 2026
a6a5f49
Prevent heartbeat race condition after cutover completion (#1664)
jakubpliszka Apr 29, 2026
4deeadf
Prevent permanent worker deadlock when cutover times out waiting for …
VarunChandola Apr 29, 2026
b13e116
Fix OOM when allEventsUpToLockProcessed buffer equals MaxRetries() (#…
dnovitski Apr 30, 2026
29c0c33
Retry attempt InstantDDL up to `--default-retries` (#1667)
meiji163 Apr 30, 2026
4d37b8a
Update golangci-lint to v2.11 (#1657)
meiji163 May 1, 2026
4d38923
Upgrade to go1.25.9 (#1668)
meiji163 May 1, 2026
494570d
Prevent throttle() from blocking forever when context is cancelled (#…
ggilder May 11, 2026
e62debe
Add MigrationContext.Hooks for in-process hook implementations (#1675)
olsonjp May 14, 2026
b9ff6a6
Bump golang.org/x/crypto from 0.37.0 to 0.45.0 in the go_modules grou…
dependabot[bot] May 15, 2026
fe459a9
Do not report extremely high HeartbeatLag values until the first hear…
grodowski May 19, 2026
154d214
Handle context cancellation in consumeRowCopyComplete to prevent dead…
jakubpliszka May 19, 2026
72cf229
Fix resume data loss: route heartbeat coords through applyEventsQueue…
grodowski May 26, 2026
e59af3a
Add Datadog/statsd with simple client emitting startup (#1689)
forge33 May 27, 2026
59f400f
Add Go runtime metrics to statsd reporting (#1690)
forge33 May 27, 2026
c636347
Add GET_LOCK to prevent concurrent migrations of the same table (#1693)
jakubpliszka May 28, 2026
251b08d
Use os.TempDir() for test socket path (#1694)
ericyan May 29, 2026
835f537
Improve performance for tables with composite primary keys (#1686)
coding-chimp Jun 1, 2026
83aaa70
Disable CGO for release builds (#1697)
meiji163 Jun 4, 2026
8f3182d
Add design spec for cross-schema migration via ghost_migration_schema
BarShauli555 Jun 14, 2026
9520c12
migration-schema-cutover-impl
BarShauli555 Jun 14, 2026
937a051
migration-schema-cutover-impl
BarShauli555 Jun 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ Here are a few things you can do that will increase the likelihood of your pull
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

## Development Guidelines

### Channel Safety

When working with channels in goroutines, it's critical to prevent deadlocks that can occur when a channel receiver exits due to an error while senders are still trying to send values. Always use `base.SendWithContext` for channel sends to avoid deadlocks:

```go
// ✅ CORRECT - Uses helper to prevent deadlock
if err := base.SendWithContext(ctx, ch, value); err != nil {
return err // context was cancelled
}

// ❌ WRONG - Can deadlock if receiver exits
ch <- value
```

Even if the destination channel is buffered, deadlocks could still occur if the buffer fills up and the receiver exits, so it's important to use `SendWithContext` in those cases as well.

## Resources

- [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: CI
permissions:
contents: read

on: [pull_request]

Expand All @@ -11,7 +13,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:

strategy:
fail-fast: false
matrix:
language: [ 'actions', 'go' ]

runs-on: ubuntu-latest # windows-latest and ubuntu-latest are supported. macos-latest is not supported at this time.

Expand All @@ -26,6 +28,8 @@ jobs:

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v9
with:
version: v1.54.2
version: v2.11
49 changes: 36 additions & 13 deletions .github/workflows/replica-tests.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
name: migration tests
permissions:
contents: read

on: [pull_request]

jobs:
build:

runs-on: ubuntu-20.04
docker-tests:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version: [mysql-5.7.25,mysql-8.0.16,PerconaServer-8.0.21]
image: ['mysql/mysql-server:5.7.41','mysql:8.0.41','mysql:8.4.3','percona/percona-server:8.0.41-32']
env:
TEST_MYSQL_IMAGE: ${{ matrix.image }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install sysbench
run: |
sudo apt-get update
sudo apt-get install -y sysbench

- name: Setup environment
run: script/docker-gh-ost-replica-tests up

- name: Run tests
run: script/docker-gh-ost-replica-tests run

- name: Set artifact name
if: failure()
run: |
ARTIFACT_NAME=$(echo "${{ matrix.image }}" | tr '/:' '-')
echo "ARTIFACT_NAME=test-logs-${ARTIFACT_NAME}" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/gh-ost-test.*
retention-days: 7

- name: migration tests
env:
TEST_MYSQL_VERSION: ${{ matrix.version }}
run: script/cibuild-gh-ost-replica-tests
- name: Teardown environment
if: always()
run: script/docker-gh-ost-replica-tests down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/libexec/
/.vendor/
.idea/
*.tmp
35 changes: 25 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
run:
timeout: 5m
version: "2"
linters:
disable:
- errcheck
enable:
- bodyclose
- containedctx
Expand All @@ -11,20 +8,38 @@ linters:
- durationcheck
- errname
- errorlint
- execinquery
- gofmt
- ifshort
- misspell
- nilerr
- nilnil
- noctx
- nolintlint
- nosprintfhostport
- prealloc
- rowserrcheck
- sqlclosecheck
- unconvert
- unparam
- unused
- wastedassign
- whitespace
disable:
- errcheck
- noctx
- prealloc
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion Dockerfile.packaging
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-bullseye
FROM golang:1.25.9-bookworm

RUN apt-get update
RUN apt-get install -y ruby ruby-dev rubygems build-essential
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22-bullseye
FROM golang:1.25.9-bookworm
LABEL maintainer="github@github.com"

RUN apt-get update
Expand All @@ -8,4 +8,4 @@ RUN rm -rf /var/lib/apt/lists/*
COPY . /go/src/github.com/github/gh-ost
WORKDIR /go/src/github.com/github/gh-ost

CMD ["script/test"]
CMD ["script/test", "-short=1"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d

`gh-ost` is a Go project; it is built with Go `1.15` and above. To build on your own, use either:
- [script/build](https://github.com/github/gh-ost/blob/master/script/build) - this is the same build script used by CI hence the authoritative; artifact is `./bin/gh-ost` binary.
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost-release`

Generally speaking, `master` branch is stable, but only [releases](https://github.com/github/gh-ost/releases) are to be used in production.

Expand Down
11 changes: 6 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
#
#

RELEASE_VERSION=
buildpath=
Expand All @@ -26,7 +24,7 @@ function build {
echo "Building ${osname}-${GOARCH} binary"
export GOOS
export GOARCH
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
CGO_ENABLED="${CGO_ENABLED:-0}" go build -ldflags "$ldflags" -o "$buildpath/$target" go/cmd/gh-ost/main.go

if [ $? -ne 0 ]; then
echo "Build failed for ${osname} ${GOARCH}."
Expand Down Expand Up @@ -72,11 +70,14 @@ main() {
build macOS osx darwin amd64
build macOS osx darwin arm64

bin_files=$(find $buildpath/gh-ost* -type f -maxdepth 1)
echo "Binaries found in:"
find $buildpath/gh-ost* -type f -maxdepth 1
echo "$bin_files"

echo "Checksums:"
(cd $buildpath && shasum -a256 gh-ost* 2>/dev/null)
(shasum -a256 $bin_files 2>/dev/null)

echo "Build Success!"
}

main "$@"
54 changes: 51 additions & 3 deletions doc/command-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ By default, `gh-ost` would like you to connect to a replica, from where it figur

If, for some reason, you do not wish `gh-ost` to connect to a replica, you may connect it directly to the master and approve this via `--allow-on-master`.

### allow-setup-metadata-lock-instruments

`--allow-setup-metadata-lock-instruments` allows gh-ost to enable the [`metadata_locks`](https://dev.mysql.com/doc/refman/8.0/en/performance-schema-metadata-locks-table.html) table in `performance_schema`, if it is not already enabled. This is used for a safety check before cut-over.
See also: [`skip-metadata-lock-check`](#skip-metadata-lock-check)

### approve-renamed-columns

When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try and associate the old column name with new column name. Otherwise, the new structure may also look like some column was dropped and another was added.
Expand Down Expand Up @@ -64,6 +69,15 @@ It is not reliable to parse the `ALTER` statement to determine if it is instant
### binlogsyncer-max-reconnect-attempts
`--binlogsyncer-max-reconnect-attempts=0`, the maximum number of attempts to re-establish a broken inspector connection for sync binlog. `0` or `negative number` means infinite retry, default `0`

### checkpoint

`--checkpoint` enables periodic checkpoints of the gh-ost's state so that gh-ost can resume a migration from the checkpoint with `--resume`. Checkpoints are written to a separate table named `_${original_table_name}_ghk`. It is recommended to use with `--gtid` for checkpoints.
See also: [`resuming-migrations`](resume.md)

### checkpoint-seconds

`--checkpoint-seconds` specifies the seconds between checkpoints. Default is 300.

### conf

`--conf=/path/to/my.cnf`: file where credentials are specified. Should be in (or contain) the following format:
Expand Down Expand Up @@ -119,7 +133,7 @@ See also: [`skip-foreign-key-checks`](#skip-foreign-key-checks)

`gh-ost` reads event from the binary log and applies them onto the _ghost_ table. It does so in batched writes: grouping multiple events to apply in a single transaction. This gives better write throughput as we don't need to sync the transaction log to disk for each event.

The `--dml-batch-size` flag controls the size of the batched write. Allowed values are `1 - 100`, where `1` means no batching (every event from the binary log is applied onto the _ghost_ table on its own transaction). Default value is `10`.
The `--dml-batch-size` flag controls the size of the batched write. Allowed values are `1 - 1000`, where `1` means no batching (every event from the binary log is applied onto the _ghost_ table on its own transaction). Default value is `10`.

Why is this behavior configurable? Different workloads have different characteristics. Some workloads have very large writes, such that aggregating even `50` writes into a transaction makes for a significant transaction size. On other workloads write rate is high such that one just can't allow for a hundred more syncs to disk per second. The default value of `10` is a modest compromise that should probably work very well for most workloads. Your mileage may vary.

Expand Down Expand Up @@ -160,6 +174,10 @@ Table name prefix to be used on the temporary tables.

Add this flag when executing on a 1st generation Google Cloud Platform (GCP).

### gtid

Add this flag to enable support for [MySQL replication GTIDs](https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html) for replication positioning. This requires `gtid_mode` and `enforce_gtid_consistency` to be set to `ON`.

### heartbeat-interval-millis

Default 100. See [`subsecond-lag`](subsecond-lag.md) for details.
Expand Down Expand Up @@ -202,9 +220,11 @@ List of metrics and threshold values; topping the threshold of any will cause th

Typically `gh-ost` is used to migrate tables on a master. If you wish to only perform the migration in full on a replica, connect `gh-ost` to said replica and pass `--migrate-on-replica`. `gh-ost` will briefly connect to the master but otherwise will make no changes on the master. Migration will be fully executed on the replica, while making sure to maintain a small replication lag.

### mysql-wait-timeout
### panic-on-warnings

When this flag is set, `gh-ost` will panic when SQL warnings indicating data loss are encountered when copying data. This flag helps prevent data loss scenarios with migrations touching unique keys, column collation and types, as well as `NOT NULL` constraints, where `MySQL` will silently drop inserted rows that no longer satisfy the updated constraint (also dependent on the configured `sql_mode`).

If set to a value greater than zero, causes `gh-ost` to set a provided [MySQL `wait_timeout`](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) for MySQL sessions opened by `gh-ost`, specified in seconds.
While `panic-on-warnings` is currently disabled by defaults, it will default to `true` in a future version of `gh-ost`.

### postpone-cut-over-flag-file

Expand All @@ -220,13 +240,25 @@ Optionally involve the process ID, for example: `--replica-server-id=$((10000000
It's on you to choose a number that does not collide with another `gh-ost` or another running replica.
See also: [`concurrent-migrations`](cheatsheet.md#concurrent-migrations) on the cheatsheet.

### resume

`--resume` attempts to resume a migration that was previously interrupted from the last checkpoint. The first `gh-ost` invocation must run with `--checkpoint` and have successfully written a checkpoint in order for `--resume` to work.
See also: [`resuming-migrations`](resume.md)

### serve-socket-file

Defaults to an auto-determined and advertised upon startup file. Defines Unix socket file to serve on.
### skip-foreign-key-checks

By default `gh-ost` verifies no foreign keys exist on the migrated table. On servers with large number of tables this check can take a long time. If you're absolutely certain no foreign keys exist (table does not reference other table nor is referenced by other tables) and wish to save the check time, provide with `--skip-foreign-key-checks`.

### skip-metadata-lock-check

By default `gh-ost` performs a check before the cut-over to ensure the rename session holds the exclusive metadata lock on the table. In case `performance_schema.metadata_locks` cannot be enabled on your setup, this check can be skipped with `--skip-metadata-lock-check`.
:warning: Disabling this check involves the small chance of data loss in case a session accesses the ghost table during cut-over. See https://github.com/github/gh-ost/pull/1536 for details.

See also: [`allow-setup-metadata-lock-instruments`](#allow-setup-metadata-lock-instruments)

### skip-strict-mode

By default `gh-ost` enforces STRICT_ALL_TABLES sql_mode as a safety measure. In some cases this changes the behaviour of other modes (namely ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE, and NO_ZERO_IN_DATE) which may lead to errors during migration. Use `--skip-strict-mode` to explicitly tell `gh-ost` not to enforce this. **Danger** This may have some unexpected disastrous side effects.
Expand Down Expand Up @@ -301,3 +333,19 @@ Makes the _old_ table include a timestamp value. The _old_ table is what the ori
### tungsten

See [`tungsten`](cheatsheet.md#tungsten) on the cheatsheet.

### use-migration-schema

When provided, gh-ost creates the ghost, changelog and checkpoint tables in a
dedicated `ghost_migration_schema` database instead of alongside the original
table. At cut-over the tables are swapped across schemas: the migrated table is
renamed into the original schema and the original table is moved into
`ghost_migration_schema` as the `_del` table.

Requirements and limitations:

- The `ghost_migration_schema` database must already exist; gh-ost does not create it.
- The migration user needs `CREATE`/`ALTER`/`DROP`/`INSERT`/`SELECT`/`LOCK` privileges on both the original schema and `ghost_migration_schema`.
- Only the atomic cut-over is supported; combining with `--cut-over=two-step` is rejected.
- Not supported together with revert operations.
- Downstream replicas must also have the `ghost_migration_schema` database present.
Loading