-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make clickhouse
binary a self extracting executable.
#34755
Make clickhouse
binary a self extracting executable.
#34755
Comments
@yakov-olkhovskiy AFAICS this issue is still not resolved, since #38447 only generates such binary, but it is not used anywhere. Am I missing something? Or the initial plan had been changed? |
@azat |
not finished yet |
Another idea is just to compress debug-symbols. Found an interesting article. It says that the best option is to use
and for binary with compressed debug symbols
We can then even use
This is much more simpler than writing our own compressor / decompressor and dealing with tons of CMake code and arguments escaping. And it will simplify debugging a lot without installing additional |
@nikitamikhaylov There was already an attempt to do so, by seems that internal DWARF interpreter cannot handle compressed debug symbols - #18952 (comment) And adding this support may make it slower and this will increase random latencies when the stack will be unwinded from non-cached locations, while extracting it each time at start may take some extra time, which also not a good way to go for me. So, not sure that it will be better, plus right now, the major problem I guess is the artifacts size not the official packages size, since later does not created too often, unlike artifacts. |
@azat I saw problem with Dwarf parser only when using
And |
Use case
odbc-bridge
andlibrary-bridge
in single-binary ClickHouse downloads despite the fact that they are separate binaries.Describe the solution you'd like
Compile a tool that can compress and decompress with ZSTD. It can use the official zstd framing format but not necessarily. It should support compression by blocks of size around 10..100 MiB (to avoid too high memory usage) and checksums. It should not depend on glibc version, and even better if it will be statically linked. Maybe two tools - one for compression and another for decompression.
Post-build rule will compress
clickhouse
(and possiblyclickhouse-odbc-bridge
andclickhouse-jdbc-bridge
) binary into blob and then include it into the decompressor withllvm-objcopy
as a custom ELF section (alternatively - maybe we can concatenate it after the decompressor binary).Decompressor should check the free space in the current directory, decompress the content into temporary file with a similar name (like
clickhouse.tmp
), performfsync
, rename the current binary to a file with similar name (like.compressed
), rename the decompressed binary to the original name, delete the compressed binary and run the decompressed binary with the same arguments.If
clickhouse-odbc-bridge
andclickhouse-odbc-bridge
binaries are present, they should be extracted into current directory andclickhouse install
script should check if they are present.Describe alternatives you've considered
There are existing specialized tools for compressing executables (like UPX). But zstd will do it better.
Additional context
A shortcut for
clickhouse install
in the decompressor can be implemented to avoid extra file copies (first into current directory then to the install destination like/usr/bin
).It makes sense to parallelize decompression.
The text was updated successfully, but these errors were encountered: