test(migration): re-enable FixDifferences in TestCutoverAtomicityWithConcurrentWrites#824
Merged
Merged
Conversation
…ConcurrentWrites The `useTestCutover` hook had a side effect of disabling FixDifferences on the checksum, so any copy-phase / applier-path row loss surfaced as a "checksum mismatch" error before partial cutover ran. The intent was to turn the test into a strict probe of issue block#746. That stricter invariant is not what spirit actually offers in production: the `KeyAboveHighWatermark` optimization in HasChanged silently drops events whose key is above the chunker's high watermark, on the assumption that the chunker's later `SELECT FROM original` will pick them up. The binlog/visibility race documented in block#746 means that SELECT can miss recently-committed rows under sufficient parallel-commit load on Linux Docker. In production this is harmless because the checksum's repair pass (FixDifferences=true, the default) re-copies any missed rows before cutover. In the test it surfaced as the well-known flake on composite_unbuffered (and intermittently the other variants). This change decouples FixDifferences from useTestCutover so the test runs the production checksum behaviour. useTestCutover still routes cutover through `partialRenameForTest` so the _old/_new comparison remains a real probe of the cutover protocol's atomicity guarantees. The accompanying test docstring documents why we no longer probe without FixDifferences and what we lose by that. Further test-only fix for issue block#746 (block#746). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aparajon
approved these changes
May 6, 2026
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
In #746 we discovered that MySQL has a read-after-write violation where some changes are not immediately visible. This was proved in a reproduction script in #820 which requires no spirit code.
Spirit is now safe from this bug.
Why this it test was flaky
This test contained a different case of the same problem. There is a race where the repl client may ignore a row because it is above the high watermark knowing the copier will copy the up to date version when it gets to it. But the copier copies too soon after, and MySQL violates read-after-write.
The 'fix' for this is that we need to disable key above watermark before we start the checksum (which we already do) and fix any of the read-after-write races introduced during copying (which we already do in production, we just disabled for this test intentionally to catch algorithmic issues).
So the fix for this test is just to allow FixDifferences for this test.
To spell it out