Repository navigation
Report true uncompressed size for packed skip-index substreams - #109272
Merged
Algunenano merged 5 commits intoJul 7, 2026
Merged
Algunenano merged 5 commits into
Algunenano merged 5 commits into
Conversation
A skip-index substream bundled into skp_idx.packed had its data_uncompressed_bytes reported as the compressed size, because the packed archive index stores only the on-disk (compressed) size per virtual file. For highly compressible indexes (a bloom_filter over low-cardinality strings can reach 1000x) this undercounts the uncompressed size by orders of magnitude, and wrongly suppresses distributed_index_analysis, which gates activation on data_uncompressed via ReadFromMergeTree::get_indexes_size. Recover the uncompressed size for packed compressed substreams by walking the compressed block headers (payload skipped, never decompressed) instead of approximating it as the compressed size. The non-packed path is unchanged; it still reads the uncompressed size from checksums.txt. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [549020b] Summary: ✅
AI ReviewSummaryThis PR extends Final Verdict✅ No blocking review findings. |
Member
Author
|
This is failing in the case of writing since the index is not yet finalize. I could hack it, but maybe it's simpler to add the file size to the packed format and bump the version. Having a look |
…ead of reading it back at finalize
…version at finalize/writePackedIndex
…uncompressed-size Resolve conflicts against master's storage refactor (public existsFile / getFileSize / prepareRead / readFileIfExists now delegate to protected *Impl overrides, with packed-archive routing centralized in the base wrapper via getArchiveReaderForFile): - DataPartStorageOnDiskFull.h: drop the getFileSize override (now getFileSizeImpl), keep the new getPackedFileUncompressedSize override. - DataPartStorageOnDiskBase.cpp: adopt master's copyArchiveEntryTo helper and carry the uncompressed size over inside it, so both archive-rewrite paths keep v1 accounting. - IMergeTreeDataPart.cpp: use master's getFileSizeOrZeroResolved with the getPackedFileUncompressedSize().value_or(size) recovery. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 87/113 (76.99%) · Uncovered code |
Algunenano
enabled auto-merge
July 7, 2026 12:46
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…x-uncompressed-size Report true uncompressed size for packed skip-index substreams
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-ClickHouse__ClickHouse
that referenced
this pull request
Nov 3, 2026
…s on 26.6 Since ClickHouse#109272 the skip-index writer emits the `skp_idx.packed` archive in format 1, which the 26.6 reader rejects with UNKNOWN_FORMAT_VERSION, so the "stay fully readable on older versions" claim in the entry of ClickHouse#111816 is wrong. The entry now names the operations that fail on 26.6 and the settings that keep a rollback to 26.6 possible. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
A skip-index substream bundled into
skp_idx.packedreported itsdata_uncompressed_bytesas the compressed size, because the packed archive index stored only the on-disk (compressed) size per virtual file. For highly compressible indexes (abloom_filterover low-cardinality strings can reach 1000x) this undercounts the uncompressed size by orders of magnitude insystem.data_skipping_indicesandsystem.parts, and wrongly suppressesdistributed_index_analysis, which gates activation ondata_uncompressedviadistributed_index_analysis_min_indexes_bytes_to_activate.The uncompressed size is now recorded in the archive index at write time (the writer already knows it), so it is served from the in-memory index while writing and from the on-disk index on load, without ever reading the payload back. The non-packed layout is unchanged; it still reads the uncompressed size from
checksums.txt.This bumps the packed-archive format to v1 to carry the extra field. The version is chosen per archive, not globally:
skp_idx.packedwrites v1, whilestatistics.packedkeeps writing v0, so statistics is unaffected by a rolling upgrade. An older server would reject a v1skp_idx.packed, but packed skip indices are an experimental feature (packed_skip_index_max_bytes), so bumping the format is acceptable. v0 archives (parts written before this change) fall back to reporting the compressed size, as before.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
data_uncompressed_bytesfor skip indices packed intoskp_idx.packed(viapacked_skip_index_max_bytes): the reported uncompressed size was the compressed size, which also could preventdistributed_index_analysisfrom activating.Version info
26.7.1.596(included in26.7and later)