[core] Speed up row-id manifest sorting - #9135
Open
leaves12138 wants to merge 13 commits into
Open
Conversation
leaves12138
force-pushed
the
codex/manifest-radix-sort
branch
from
August 10, 2026 04:03
0add9d0 to
ada84ad
Compare
leaves12138
marked this pull request as ready for review
August 10, 2026 15:30
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.
What changed
paimon-format/.../avro/primitiveInternalRoworManifestEntryobjectsmanifest-sort.run-merge-optimize.enabledas a fallback switchWhy
Full row-id manifest compaction currently materializes every
ManifestEntry, feeds all entries through the external sorter, and encodes every surviving entry again. Large data-evolution tables therefore spend substantial CPU time, cumulative heap allocation, and temporary-disk I/O in this path even when their manifests already consist of a small number of sorted runs.The new manifest-only Avro path reads just the primitive fields needed for classification and ordering, interns partition data, and merges already-sorted runs directly. When an encoded record or compressed Avro block can be reused safely, it is copied without materializing a full entry or encoding it again. Fragmented input still falls back to the existing bounded external sorter.
Performance
The benchmark uses the production snapshot 7537 metadata fixture on Linux x86_64:
-XmxlimitTotal allocation during sortis cumulative allocation, calculated by summing JVM per-thread allocation deltas across the measured sort interval. It is GC-reclaimable allocation volume, not live heap or RSS.Peak RSSis the maximum resident set reported by/usr/bin/time -vfor the Maven/Surefire benchmark command.Spill values count compressed temporary files created by the sorter only; they exclude source-manifest reads and final output-manifest writes. External sort first wrote 1,080,034,577 bytes across 273 runs. Because this exceeded the 128-file-handle limit, two fan-in operations wrote another 506,977,657 and 1,007,390,265 bytes. The final run-merge path created no sorter spill files.
Result equivalence
Both paths produced exactly 26,095,685 output entries. Their logical encoded-record SHA-256 was identical:
afe6fcdaff7e8b2e7d047c199164c19457ced5b3cb2adaadd32c48cf11a1cdf5Validation
AvroFileFormatTestcases covering primitive projection, nullable/nested fields, reader reuse, and large Zstd blocksManifestFileMetaTestcases covering row-id order, secondary keys, exact DELETE identifiers, raw identity fields, many partitions, fragmented fallback, read amplification, block stats, configured partition fields, missing row-id stats, and minor compactionByteArrayKeyTestcases plus 12 binary-manifest identifier/projection casesmvn -pl paimon-format,paimon-core -am -DskipTests compilewith checkstyle, Spotless, and enforcer enabled