Skip to content

[core] Replay index file changes when restoring MergeTreeWriter - #10260

Open
LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-063-fulltext-drop
Open

LuciferYang wants to merge 1 commit into
apache:masterfrom
LuciferYang:m/core-063-fulltext-drop

Conversation

@LuciferYang

Copy link
Copy Markdown
Contributor

Purpose

MergeTreeWriter's restore constructor replayed the pending increment's data files, changelog and compaction files but dropped the index file changes in DataIncrement and CompactIncrement.

On the CDC schema-change path, StoreSinkWriteImpl.replace runs checkpoint() then restore() in process. During checkpoint() 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. On restore() 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 newIndexFiles and deletedIndexFiles from both the data and compact increments through the restore replay and re-emits them on the next prepareCommit.

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 next prepareCommit re-emits both. The assertion fails against the pre-fix constructor and passes with the fix.

API and Format

No.

Documentation

No.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MergeTreeWriter restore drops pending index file changes, corrupting the PK index manifest

1 participant