Repository navigation
Promote the ZXC codec to beta - #131397
Conversation
zxc 1.0.0 (ClickHouse#131071) freezes the wire format at v9; the upstream author confirmed that later formats will be additive and that every future decoder reads v9, and an audit of the 1.0.0 code found no defect. Since ClickHouse#116337 a codec's maturity is the declared tier of its gate setting, so moving `enable_zxc_codec` from EXPERIMENTAL to BETA is the whole promotion: the gate error, `system.codecs.tier`, `system.settings.tier` and `allow_feature_tier` all follow from it. `allow_feature_tier` 1 and 2 now allow the setting; 3 still rejects it. The 26.8 history record stays as released; a 26.11 record documents the move, in the same shape as the other "moved to Beta" records. The rest of the diff is text naming the tier: the codec docs badge and note, the native protocol spec, the `01222_system_codecs` reference, the three assertions on the gate message in `test_experimental_codec_config_default` and two test comments. The default stays `false`. 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; 2 findings; 1 full pass).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-48:20261113-175700 |
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261113-173100 |
|
Workflow [PR], commit [c6353db] Summary: ✅
AI ReviewSummaryPR #131397, reviewed at Final VerdictStatus: ✅ Approve |
I did, and a long time ago even with 0.* versions! It is a pareto-optimal algorithm between LZ4 and ZSTD, and sometimes it beats LZ4 by every measure - quite an achievement. I'd say it is one-in-ten-years finding! |
|
When I first saw zxc, I was in shock - like I see a miracle. Before it, I've reviewed and tried many related algorithms: LZSSE, Lizard, Iguana, LZTurbo, but none of them were working up to our standards. The fact that zxc exists is unbelievable, but it does. |
|
I was dreaming about something like this since when we replaced QuickLZ with LZ4 and since when Yann Collet published ZHuff and then the first version of ZSTD - also 0.x, and with bugs and data corruption that we quickly found :) |
|
Measured numbers for this. ClickBench
So on x86 it reads at LZ4 speed with 8% less storage but writes slower; on AArch64 it reads about 1.3x faster than both. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units8 translation units recompiled, 19 s compile time in total, 8 of them have a recent master baseline. |
rienath
left a comment
There was a problem hiding this comment.
I've ran a few benchmarks on datasets that first came to mind. We see that ZXC(3) is roughly LZ4 with a worse write path. 1–10% smaller files and similar hot-read speed, but inserts at 0.65–0.77x and merges at 0.47–0.70x of LZ4, and on two of three it’s also slower than the current default. A few percent of disk doesn’t justify that write cost, so I’d lean towards not promoting this codec to beta.
| Dataset | Codec | Size, MB | Insert, MB/CPU-s | Merge, MB/CPU-s | Hot scan, MB/CPU-s | Hot queries, s |
|---|---|---|---|---|---|---|
| TPC-H SF10 | Current default | 2,578 | 198 | 310 | 1,212 | 2.59 |
ZXC(3) as default |
4,007 (+55%) | 162 (0.82x) | 255 (0.82x) | 2,143 (1.77x) | 2.00 (0.77x) | |
LZ4 |
4,419 (+71%) | 248 (1.25x) | 547 (1.76x) | 2,171 (1.79x) | 1.92 (0.74x) | |
ZSTD(1) |
2,537 (-2%) | 200 (1.01x) | 312 (1.01x) | 1,086 (0.90x) | 2.72 (1.05x) | |
| TPC-DS SF10 | Current default | 3,908 | 187 | 280 | 1,052 | 25.92 |
ZXC(3) as default |
5,945 (+52%) | 186 (0.99x) | 295 (1.05x) | 1,956 (1.86x) | 22.50 (0.87x) | |
LZ4 |
5,981 (+53%) | 242 (1.29x) | 538 (1.92x) | 1,808 (1.72x) | 22.95 (0.89x) | |
ZSTD(1) |
3,873 (-1%) | 197 (1.05x) | 295 (1.05x) | 935 (0.89x) | 26.36 (1.02x) | |
| hits, 100M rows | Current default | 9,409 | 240 | 231 | 1,460 | 4.67 |
ZXC(3) as default |
14,112 (+50%) | 194 (0.81x) | 191 (0.83x) | 1,914 (1.31x) | 3.96 (0.85x) | |
LZ4 |
15,286 (+62%) | 280 (1.17x) | 271 (1.17x) | 1,788 (1.22x) | 4.09 (0.88x) | |
ZSTD(1) |
10,213 (+9%) | 243 (1.01x) | 229 (0.99x) | 1,231 (0.84x) | 4.76 (1.02x) |
However, I don't want to block you if you've made up your mind @alexey-milovidov
|
Same picture here, and a faster level does not change it. Single-threaded
Levels 1-2 cost about as much CPU as LZ4 but are larger than LZ4. Level 3 is the first one smaller, at 2.8x the CPU of LZ4, and it is also slower to write than |
9901351
Related: #131071
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
ZXCcompression codec is promoted from experimental to beta. It is still enabled with theenable_zxc_codecsetting, which servers withallow_feature_tierset to 1 or 2 now allow.Description
This follows #131071 (zxc 1.0.0, merged), which moved ZXC to wire format v9, frozen as of 1.0. I checked the format guarantee and audited the zxc 1.0.0 code: no code defect, and two upstream issues about docs and fuzz coverage (analysis). The upstream author confirmed that later formats will be additive and every future decoder reads v9 (comment).
The change is the tier of
enable_zxc_codec(EXPERIMENTAL->BETA) plus a26.11history record; the26.8record is unchanged. Since #116337 a codec's maturity is the tier of its gate setting, sosystem.codecs.tier,system.settings.tier, the gate error ("is in beta and not yet recommended for production use") andallow_feature_tierfollow from it. The rest of the diff is text naming the tier: the codec docs badge and note, the native protocol spec, the01222_system_codecsreference, the three assertions on the gate message intest_experimental_codec_config_default, and two test comments. The default staysfalse.Validation: the fix binary reports
Betainsystem.codecsandsystem.settings, and acceptsSET enable_zxc_codec = 1withallow_feature_tier1 and 2 (master rejects it asEXPERIMENTAL; 3 rejects it asBETA). The 10 related stateless tests pass, the 3 edited ones 150/150 with random settings, and01222_system_codecswith the new reference fails against master only on theZXCrow.test_experimental_codec_config_defaultpasses 5/5; its 3 gated cases fail with the old assertions on the fix binary and with the new ones on master.Workflow [PR]
Sync PR [sync-upstream/pr/131397]
Version info
26.11.1.2342-master(included in26.11and later)