Repository navigation
Compress the debug sections of the packaged .debug files with zstd - #131720
Conversation
`clickhouse.debug` grew over 2^32 bytes (4,311,106,992 on amd64 at edfbc33), and nfpm 2.20.0 stores 32-bit file sizes in rpm packages, so the `clickhouse-common-static-dbg` rpm records the size modulo 2^32 and fails to install with `cpio: Digest mismatch` (ClickHouse#126943). Produce the split debug file with `--compress-debug-sections=zstd` (1.32 GB on amd64, 1.37 GB on arm64). The flag is in the `--only-keep-debug` call, before `--add-gnu-debuglink`, so the debuglink CRC is computed over the shipped file. The unstripped binary is unchanged. CI's gdb in `clickhouse/cctools` was built without zstd: bfd's configure looks for libzstd with pkg-config, and neither `libzstd-dev` nor `pkg-config` was installed, so the support was dropped silently. Install both and pass `--with-zstd`, so a missing libzstd fails the image build. Without this, the Upgrade check's gdb cannot read the compressed debug file and prints `??` for every frame of the stripped packaged binary. A SPLIT_DEBUG_SYMBOLS=ON build with an objcopy that lacks zstd support now fails in the post-build step. ClickHouse's own Dwarf reader skips compressed sections, so stack traces of installed packages lose file:line until it can read them (follow-up requested in ClickHouse#126943). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The release builds produce the split debug files with `--compress-debug-sections=zstd`. `ch_find_program` takes llvm-objcopy from the compiler's directory first, so whenever the PGO+BOLT toolchain in /usr/local/bin provides the compiler (with clang-22: `Using objcopy: /usr/local/bin/llvm-objcopy` in the 58726cc release build logs), the release builds use its llvm-objcopy, which is built with LLVM_ENABLE_ZSTD=OFF and fails with "LLVM was not built with LLVM_ENABLE_ZSTD". Build both toolchain stages with zstd and install libzstd-dev in the image the toolchain is built in, as was done for zlib. It applies from the next toolchain rebuild; until then the clang-23 builds use apt's llvm-objcopy-23, which has zstd. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; round 1: 2 findings, round 2 on the final head: 0 findings) plus my own review (1 blocker, fixed).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261115-014200 |
|
Workflow [PR], commit [afa8dc6] Summary: ✅
AI ReviewSummaryCompresses packaged debug sections with zstd, selects zlib for tools without zstd support, and enables zstd in CI's debugger and toolchain. Reviewed head Compressed-file consumer coverage: Missing context / blind spots
ClickHouse-Specific Rule Notes
Final Verdict✅ Approve the reviewed changes. No additional code changes requested; retain the documented companion-PR merge order and complete the full CI rerun. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 7 s compile time in total, 7 of them have a recent master baseline. |
The release builds take `llvm-objcopy` from the compiler's directory. With
clang-22 that is the PGO toolchain, built with `LLVM_ENABLE_ZSTD=OFF` until
it is rebuilt with the previous commit, so `--compress-debug-sections=zstd`
failed the build ("LLVM was not built with LLVM_ENABLE_ZSTD"): the merge
queue entry stacked on ClickHouse#131710 (Revert "Use clang-23") failed
`Build (amd_illumos)` this way.
CMake now checks that `objcopy` accepts zstd by compressing a copy of
itself and uses zlib otherwise. zlib-compressed sections are readable by
the gdb CI has today.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The merge queue entry stacked on #131710 failed |
…le size `collectSymbolsFromELF` set `address_end` from the size of the file it reads symbols from, which is the separate `.debug` file when one exists. With compressed debug sections that file is smaller than the executable's code, so `SymbolIndex::thisObject` and `findObject` returned `nullptr`: stack frames lost their names and `StackTrace::resolveAddressForStorage` stored zero offsets. Derive the end from the highest loaded segment in the program headers instead. Verified on aarch64 with a 240 MB zstd-compressed `clickhouse.debug` next to a binary whose segments end at ~670 MB: `system.stack_trace` threads with nonzero, symbolized frames went from 0/29 to 25/29 (the same as without a debug file). Review: ClickHouse#131720 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
e7e1427
|
This is needed in 26.10, which is failing constantly on |
Cherry pick #131720 to 26.10: Compress the debug sections of the packaged `.debug` files with zstd
…d `.debug` files with zstd
Backport #131720 to 26.10: Compress the debug sections of the packaged `.debug` files with zstd
Closes: #126943
Related: #131710
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The debug sections of
clickhouse.debugandclickhouse-keeper.debugin the-dbgpackages are now compressed with zstd (4.3 GB -> 1.3 GB; zlib if the build'sobjcopylacks zstd), so theclickhouse-common-static-dbgrpm stays under the 4 GiB file size limit of the rpm packager and can be installed again. Reading zstd-compressed files with gdb requires gdb 13 or newer built with zstd support.Description
Install packages (amd_release, rpm)/(arm_release, rpm)fails withcpio: Digest mismatchonclickhouse.debugon master since #117346 and on every 26.10 build since 2026-11-13 (report). The file grew over 2^32 bytes and nfpm 2.20.0 stores 32-bit file sizes in rpm.The split debug file is now produced with
--compress-debug-sections=zstd, in the sameobjcopycall so the.gnu_debuglinkCRC covers the shipped file; CMake falls back to zlib when thatobjcopyhas no zstd. Two CI tools lacked zstd and are now built with it: the gdb inclickhouse/cctools, and the PGO toolchain, whosellvm-objcopythe release builds use when it provides the compiler (clang-22, #131710); until it is rebuilt, those builds write zlib.SymbolIndexbounded the executable by the size of its.debugfile (238 MB in a PR build, below the 768 MB image), so higher frames lost their names; it now uses thePT_LOADsegments. The symbolizer skips compressed sections, so installed packages' stack traces keep function names but lose file:line until the follow-up PR from #126943, which should merge first or together.Reverting #117346 (#131710) restores only 85 MB (amd64) / 55 MB (arm64) of headroom.
Validation on master
edfbc33b's packages rebuilt with nfpm 2.20.0: the dbg rpm installs with the CI command andrpm -Vis clean (the uncompressed one reproducesDigest mismatch); the rebuilt gdb resolves file:line from it; LLVM 23 built with zstd in the toolchain's image writes the sections; the current toolchain'sllvm-objcopytakes the zlib fallback, which CI's gdb 18.1 reads. A greenInstall packageshere does not exercise the 4 GiB case.Workflow [PR]
Sync PR [sync-upstream/pr/131720]
Version info
26.11.1.2398-master(included in26.11and later)26.10.5.36