[core] Replay index file changes when restoring MergeTreeWriter - #10260
Open
LuciferYang wants to merge 1 commit into
Open
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
The restore constructor replayed the pending increment's data, changelog and compaction files but dropped newIndexFiles and deletedIndexFiles. On the checkpoint path taken by a CDC schema-change replace, the primary-key index maintainers finish and accept pending builds and merge their index file changes into that increment; after restore the changes were silently lost, so accepted payloads never reached the index manifest while replaced payloads stayed as zombie entries. Carry the index file changes through the replay and re-emit them on the next prepareCommit. Assisted-by: GLM-5.3
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.
Purpose
MergeTreeWriter's restore constructor replayed the pending increment's data files, changelog and compaction files but dropped the index file changes inDataIncrementandCompactIncrement.On the CDC schema-change path,
StoreSinkWriteImpl.replacerunscheckpoint()thenrestore()in process. Duringcheckpoint()the primary-key index maintainer finishes and accepts a pending build and merges its index file additions and deletions into the writer state increment, advancing its own state past that build. Onrestore()the new writer dropped those changes and the maintainer had nothing left to re-emit, so the accepted payloads never reached the index manifest and the replaced payloads stayed as zombie entries.This carries
newIndexFilesanddeletedIndexFilesfrom both the data and compact increments through the restore replay and re-emits them on the nextprepareCommit.This closes #10258.
Tests
Added
MergeTreeWriterCloseFailureTest.testRestoreReplayKeepsIndexFiles: it builds a restore increment carrying a new payload in the data increment and a removed payload in the compact increment, restores a writer from it, and asserts the nextprepareCommitre-emits both. The assertion fails against the pre-fix constructor and passes with the fix.API and Format
No.
Documentation
No.