Skip to content
Open
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
15 changes: 15 additions & 0 deletions doc/command-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ While the ongoing estimated number of rows is still heuristic, it's almost exact

Without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.

### is-merge-dml-event

When enabled, batched binlog DML events are merged in memory before applying them to the ghost table. Only effective when the migration unique key uses numeric column types (`int`, `bigint`, `decimal`, `float`, etc.).

**Batching:** All DML events in a batch are grouped by type — inserts and updates become a single multi-row `REPLACE INTO`, deletes become a single `DELETE WHERE (pk) IN (...)`.

**Deduplication:** Repeated changes to the same unique key within a batch collapse to the final state (last writer wins).

**Range filtering:** When a binlog event's unique key value is beyond `MigrationIterationRangeMaxValues` but within `MigrationRangeMaxValues`, the event is skipped — that data will be synced by the row-copy chunk. Events beyond `MigrationRangeMaxValues` or below `MigrationIterationRangeMaxValues` are applied normally.

Automatically disabled when:
- The chosen unique key contains non-numeric columns (TEXT, BLOB, JSON, etc.)
- The chosen unique key has nullable columns (NULL breaks comparison and dedup semantics)
- The table has multiple unique indexes (REPLACE semantics are unsafe with secondary unique constraints)

### force-named-cut-over

If given, a `cut-over` command must name the migrated table, or else ignored.
Expand Down
2 changes: 2 additions & 0 deletions go/base/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ type MigrationContext struct {
controlReplicasLagResult mysql.ReplicationLagResult
TotalRowsCopied int64
TotalDMLEventsApplied int64
TotalDMLEventsIgnored int64
DMLBatchSize int64
IsMergeDMLEvents bool
isThrottled bool
throttleReason string
throttleReasonHint ThrottleReasonHint
Expand Down
1 change: 1 addition & 0 deletions go/cmd/gh-ost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func main() {
exponentialBackoffMaxInterval := flag.Int64("exponential-backoff-max-interval", 64, "Maximum number of seconds to wait between attempts when performing various operations with exponential backoff.")
chunkSize := flag.Int64("chunk-size", 1000, "amount of rows to handle in each iteration (allowed range: 10-100,000)")
dmlBatchSize := flag.Int64("dml-batch-size", 10, "batch size for DML events to apply in a single transaction (range 1-1000)")
flag.BoolVar(&migrationContext.IsMergeDMLEvents, "is-merge-dml-event", false, "Merge DML Binlog Event")
defaultRetries := flag.Int64("default-retries", 60, "Default number of retries for various operations before panicking")
flag.BoolVar(&migrationContext.PanicOnWarnings, "panic-on-warnings", false, "Panic when SQL warnings are encountered when copying a batch indicating data loss")
cutOverLockTimeoutSeconds := flag.Int64("cut-over-lock-timeout-seconds", 3, "Max number of seconds to hold locks on tables while attempting to cut-over (retry attempted when lock exceeds timeout) or attempting instant DDL")
Expand Down
Loading