Conversation
1. Support for ignoring binlog events that exceed chunk boundary values. 2. Support for binlog merge processing.
When there is only one column in a unique index, merging of DML binlog events is permitted.
…tionRangeMaxValues is nil Add handling for the case when MigrationIterationRangeMaxValues is nil
…reads The merge DML optimization (PR github#1378) used REPLACE...SELECT FROM source to batch-apply events, which reads live table state instead of the binlog row images. This breaks correctness when events arrive during throttle, after kill/restart, or before cutover drains completely. Changes: - Replace source-read REPLACE with parameterized REPLACE...VALUES using binlog after-images (sharedColumnArgs from BuildDML*Query) - Use BuildColumnsPreparedValues for correct timezone/enum/JSON handling - Fix nil MigrationIterationRangeMaxValues check (was returning true) - Remove dead generateReplaceQuery (unsafe source-read version) - Use mergedEntry struct to avoid unsafe string key reconstruction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
Author
|
Superseded by new PR from rebased branch (pr-1378-rebased on current master). |
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.
Summary
Ports the merge-DML batching optimization from upstream PR github#1378 to current master, adapting it to the refactored builder-pattern API.
What this does
When
--is-merge-dml-eventis enabled and the unique key is memory-comparable (all numeric columns):REPLACE INTO ... VALUES (row1), (row2), ...DELETE ... WHERE (pk) IN (val1, val2, ...)Performance
Benchmarked on the original PR github#1378 branch:
Key correctness fix over github#1378
Uses
BuildColumnsPreparedValues(MappedSharedColumns)ingenerateBatchedReplaceQueryto generate proper per-column conversion tokens (convert_tz(?, ...),ELT(?, ...), etc.) instead of plain?placeholders. This prevents data corruption for timezone, enum, and JSON columns.Files changed
go/sql/types.go: AddCompareValueFunc,FormatValueFuncon Column;IsMemoryComparable,FormatValueson UniqueKeygo/sql/builder.go: ExportBuildColumnsPreparedValuesgo/base/context.go: AddTotalDMLEventsIgnored,IsMergeDMLEventsgo/logic/inspect.go: ComputeIsMemoryComparableand set compare/format funcs for numeric columnsgo/logic/applier.go: Merge-DML logic (dedup map, batched REPLACE/DELETE, range filtering)go/logic/applier_test.go: Unit tests for batch query generation and range filteringgo/logic/migrator.go: Branch to merged apply path, add Ignored counter to statusgo/cmd/gh-ost/main.go:--is-merge-dml-eventflagdoc/command-line-flags.md: DocumentationRelationship to upstream
This is a clean port of the optimization from PR github#1378 (by @kolbe), rebased onto current master with my correctness fix applied. The original branch was 125 commits behind master and used the old standalone function API.