Add rsyncable option to gzip and zstd compression #310
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.
Currently this requires linking a patched or static version of the
libraries, where support for "rsyncable" compression has been added.
For zstd specifically, this also requires defining a special macro
-DZSTD_STATIC_LINKING_ONLY=1, before #include <zstd.h> (in flags).Assuming that the static libraries have been installed under /opt:
The original patch for zlib seems lost, but resurrected it from deltarpm
https://svn.uhulinux.hu/packages/dev/zlib/patches/02-rsync.patchFor zstd it is now included by default (since version 1.3.8), but it still a
"experimental parameter" and thus requires static linking like above.
The idea behind rsyncable is to add some "synchronization points",
using a rolling hash instead of a fixed size, to help with delta transfer.
The output format is compatible, but the extra hash makes it slower...
Thus it is not supported for lz4, and not recommended for fast zstd*.
* compression levels below 6 or so, i.e. normally used with 9 or 15
"The rsync algorithm": https://rsync.samba.org/tech_report/
gzip -9 --rsyncableThe pigz implementation uses a faster hash, than the original gzip.
zstd -9 --rsyncable