feat(compaction): wire real CompactManager into MergeTreeWriter for key-table compaction#198
Closed
feat(compaction): wire real CompactManager into MergeTreeWriter for key-table compaction#198
Conversation
|
|
Copilot
AI
changed the title
[WIP] Review changes made in PR #195
feat(compaction): wire real CompactManager into MergeTreeWriter for key-table compaction
Mar 25, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Prior to this change,
MergeTreeWriterheld noCompactManagerand itsCompact()/Sync()/CompactNotCompleted()methods returnedNotImplemented. Key-value tables had no compaction at the framework layer.Core new components
MergeTreeCompactManager— orchestrates compaction for KV tables: picks units viaCompactStrategy, submitsMergeTreeCompactTaskto executor, applies results back toLevelsMergeTreeCompactTask— handles the rewrite-vs-upgrade decision per section of sorted runs; usesIntervalPartitionto detect overlapping files; supportsDeletionFileSupplierfor DV-enabled tablesFileRewriteCompactTask— simpler per-file rewrite task for lookup-mode full compactionCancellationController— atomic bool wrapped in a shared object; passed into all rewriters so in-flight compaction can be cancelled onClose()Interface changes
CompactManager::AddNewFile()now returnsStatus(wasvoid); all implementors updatedMergeTreeWriterctor gains aCompactManagerparameter;Compact/Syncare now real implementations that flush buffered data, trigger compaction, and sync resultsLookupLevels::levels_promoted fromunique_ptrtoshared_ptrso it can be shared withMergeTreeCompactManagerMergeTreeCompactRewriterand subclasses gain aCancellationControllerparameterWriteContext/AbstractFileStoreWrite/KeyValueFileStoreWritegainIOManagerand a separatekey_comparator_for_compact(view-free, for min/max key comparison inLevels)New config options
Tests
MergeTreeCompactManagerTest— 13 unit tests covering level routing, full compaction, stop-trigger enforcement, and reentrant-full-compaction rejectionKeyValueCompactionInteTest— integration tests for IO-exception recovery and stream-write full compactionMergeTreeWriterTest/LookupMergeTreeCompactRewriterTestupdated to passNoopCompactManagerwhere the new ctor requires a manager⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.