Repository navigation
Cherry pick #131720 to 26.10: Compress the debug sections of the packaged .debug files with zstd - #132042
Merged
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` (#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 #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]>
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 #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]>
…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: #131720 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Compress the debug sections of the packaged `.debug` files with zstd
Resolve the Dockerfile conflicts against the 26.10 images and add `ProgramHeaderType::LOAD`, which `getLoadedSegmentsEnd` needs and 26.10 lacks. 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.
Original pull-request #131720
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job