Repository navigation
feat(table): compact primary-key tables with deletion vectors - #1255
Merged
JingsongLi merged 4 commits intoOct 30, 2026
Merged
Conversation
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
Follow-up to #1254, extracted from #1251. Enable incremental primary-key compaction for
deletion-vectors.enabled=true,merge-engine=deduplicate, and changelog producersnone,inputandlookup. Small L0 writes can become visible to ordinary DV scans while large historical runs remain in place.Brief change log
deletion_vector_indexmodule. Primary-key and Data Evolution compaction also share commit-time manifest reading, per-bucket container preparation, index replacement and generated-file cleanup. Keep lookup-position union and stable row-ID remapping as the respective mask transformations.Tests
Six DV integration tests cover
none/input/lookupacross fixed and dynamic buckets, exact cross-batch physical DV positions, default scans without merge-on-read, retained history and old snapshots, DELETE-only output and before-image metadata, selected-input mask filtering/retirement, shared index ranges, latest HASH preservation, concurrent L0 writes, independent DV union, changed input/hit masks, removed targets, schema-mode overrides, serialized-result validation and retries. Consecutive updates verify that deletion masks for multiple historical files remain in one bucket container and that old snapshots stay readable. Two commit regressions inject CAS loss and a lost publication response, and distinguish unchanged masks repacked into new containers from actual selected-mask changes. All three repairs have RED/GREEN regression evidence. Data Evolution retry fault injection also verifies failed-attempt DV cleanup and retention after a lost publication response, including an intervening DELETE.4,674 library unit tests and 193 related integration tests passed with
--test-threads=4; six existing unit tests were ignored. All 70 PK compaction tests passed alongside append/Data Evolution compaction, DV writes, incremental/streaming reads and partial-update state, predicate deletes, external data paths and custom data directories. A dense-vector unit regression verifies memory accounting follows bitmap container storage rather than four bytes for every deleted row.cargo fmt --all -- --check,git diff --check, andcargo clippy --locked -p paimon --lib --test pk_compact_test -- -D warnings -A clippy::nonminimal_boolpassed. The allowance covers existing repository findings with the local toolchain.Behavior was checked against Java
LookupLevels,LookupMergeTreeCompactRewriter,LookupChangelogMergeFunctionWrapper,MergeTreeCompactManagerand conflict detection at Apache Paimon commit5be7e2dd1f.API and Format
The compaction API is unchanged.
CompactResultadds defaulteddeletion_vector_updates; uncommitted DV results must retain this metadata, including an explicit empty list.CompactTaskremains flat and commit resolution does not receive tasks. Lookup artifacts advance to private disposable format v2 for physical positions; table data and DV index formats use existing readers/writers.Documentation
Updated compaction and SQL guides with DV scope, local-cache requirements, physical deletion/commit behavior, row limits and mode-migration restrictions.