Skip to content

Bump zxc from 0.14.0 to 1.0.0 - #131071

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
actueleai:bump-zxc-v1.0.0
Nov 13, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
actueleai:bump-zxc-v1.0.0

Conversation

@actueleai

@actueleai actueleai commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Bumps zxc from v0.14.0 to v1.0.0, the first stable release (format frozen), which replaces the option structs with per-context parameters and moves to wire format v9.

ClickHouse-side changes

  • src/Compression/CompressionCodecZXC.cpp — dropped the zxc_compress_opts_t/zxc_decompress_opts_t blocks in favour of the one-shot calls, whose checksum default matches the previous checksum_enabled = 0.
  • utils/list-licenses/list-licenses.sh — zxc 1.0.0 moved the MIT notice of the bundled rapidhash from LICENSE to THIRD_PARTY_NOTICES; a top-level THIRD_PARTY_NOTICES file of a contrib library is now listed in system.licenses as an additional row, so the notice stays embedded in the binary.

Behaviour changes

  • Wire format v8 → v9: existing CODEC(ZXC) parts become unreadable after upgrade, and v9 parts are unreadable by older servers (CANNOT_DECOMPRESS, zxc error -5). ZXC is experimental (enable_zxc_codec); 0.13 → 0.14 broke the format the same way.

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Update the experimental ZXC codec to zxc 1.0.0 (format v9). Existing format-v8 ZXC data must be rewritten with another codec (or exported using the previous ClickHouse version) before upgrading. Older servers cannot read newly written format-v9 data; avoid mixed-version use of ZXC and rewrite new data before downgrading.


Workflow [PR]
Sync PR [sync-upstream/pr/131071]

Version info

  • Merged into: 26.11.1.2215-master (included in 26.11 and later)

Upstream release notes: https://github.com/hellobertrand/zxc/blob/v1.0.0/CHANGELOG

Notable upstream changes:

* Wire format v9 (upstream ClickHouse#452, introduced in 0.15.0) replaces v8. `zxc`
  accepts only its own format version, so data written by the previous pin
  (format v8) is rejected with `ZXC_ERROR_BAD_VERSION` (-5), and v9 data is
  rejected by 0.14.0 in turn. This is a backward-incompatible change for
  existing `ZXC`-compressed data - acceptable only because the `ZXC` codec is
  experimental and off by default behind `enable_zxc_codec`.
* The option structs are gone (upstream ClickHouse#545, ClickHouse#546): `zxc_compress_opts_t` and
  `zxc_decompress_opts_t` are replaced by per-context parameters set one at a
  time. The one-shot `zxc_compress(src, n, dst, cap, level)` and
  `zxc_decompress(src, n, dst, cap)` forms default to no checksum
  (`ZXC_C_CHECKSUM` / `ZXC_D_CHECKSUM` are 0), which is what the codec asked
  for with `checksum_enabled = 0`, so `CompressionCodecZXC` keeps its
  behaviour and only drops the struct handling. Levels 1..7, `zxc_min_level`,
  `zxc_max_level`, `ZXC_PAD_SIZE` (32) and the destination slack the codec
  reserves through `getAdditionalSizeAtTheEndOfBuffer` are unchanged.
* The per-ISA variant set is unchanged: `_default`, `_avx2`, `_avx512` and
  `_neon32`, with the same flag sets and the same `ZXC_FUNCTION_SUFFIX`
  mechanism, and `ZXC_DISABLE_SIMD` still forces the scalar core. Upstream's
  block types are renamed GLO/GHI to SPL/PAK (upstream ClickHouse#538), which is
  internal. `contrib/zxc-cmake/CMakeLists.txt` therefore needs no change.
* `ZXC_DECOMPRESS_TAIL_PAD` drops from 2112 to 2084 bytes (upstream ClickHouse#564); it
  sizes zxc's internal work buffer, not the caller's destination, so the codec
  is unaffected.

Verified locally on AArch64: `_zxc` and `clickhouse` build clean, a round-trip
through `CODEC(ZXC(n))` for every level 1..7 plus the default level reproduces
the input byte for byte, and both directions of the format break are confirmed
(v8 data read by the new binary and v9 data read by the old one fail with
`ZXC_ERROR_BAD_VERSION`). The x86-64 AVX2/AVX512 variants, the x86-64 core and
the `ZXC_DISABLE_SIMD` scalar builds were cross-compiled against the sysroot to
cover the configurations this host cannot build.

Co-Authored-By: Claude Code <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Nov 12, 2026
@clickhouse-gh clickhouse-gh Bot added the can be tested Allows running workflows for external contributors label Nov 12, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [eb118b1]

Summary: ✅


AI Review

Summary

Updates the experimental ZXC codec to zxc 1.0.0 and format v9, adapts the one-shot API calls, and embeds bundled third-party notices in system.licenses. Reviewed revision eb118b181beadd83023fee5b9315db6bd554b412. Both prior findings are addressed: the complete rapidhash MIT notice is preserved, and the changelog explains the format incompatibility and migration steps. No new actionable findings.

Missing context / blind spots
  • ⚠️ No full ClickHouse build or SQL test execution locally: this checkout has no configured build or initialized contrib sources. A focused fixture passed through the actual license collector and C++ generation scripts. Runtime confirmation should come from CI execution of 04545_zxc_codec and 05627_system_licenses_third_party_notices; individual test results were unavailable from the queried report endpoints.
Final Verdict

Status: ✅ Approve. No unresolved review findings or new inline comments.

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. labels Nov 12, 2026
Comment thread contrib/zxc Resolved
Comment thread contrib/zxc Resolved
@clickhouse-gh

clickhouse-gh Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing eb118b181 with master 21809eaaa (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.59, programs/clickhouse-keeper ×0.65 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse _ZN6detail10static_forITk7is_enumN2DB23AttributeUnderlyingTypeEZNS1_29callOnDictionaryAttributeType… 3.3 s 7.0 s +5.1 s (+258%)
Compile time of recompiled translation units

17 translation units recompiled, 8 s compile time in total, 17 of them have a recent master baseline.

Job report

alexey-milovidov and others added 2 commits November 13, 2026 06:43
`zxc` 1.0.0 moved the MIT notice of the bundled `rapidhash` out of `LICENSE`
into `THIRD_PARTY_NOTICES`, which `list-licenses.sh` did not pick up, so the
notice would be lost from the license data embedded into the binary. Emit an
additional row for a top-level `THIRD_PARTY_NOTICES` file of a library (this
also covers `mongo-c-driver`).

Address review: ClickHouse#131071 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131071&sha=latest&name_0=PR&name_1=Docker%20server%20image and provide a fix in a separate PR. If the fix is already in progress, link it here. The Docker server image job hung in the docker-library tests of head-distroless-amd64 after clickhouse-distroless-no-shell until the 18000 s job timeout; it is unrelated to the zxc bump. It looks like it is addressed by #128093.

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Nov 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

This is the same hang as the one on #124125 (2026-10-28), and #128093 is the fix for it.

In this run, head-amd64 and head-alpine-amd64 passed 9/9, then head-distroless-amd64 passed clickhouse-basics and clickhouse-distroless-no-shell. The third test started a linked docker run --rm -i --link ... clickhouse-client (the two Links on the default bridge network warnings at 16:51:32) that never returned. There was no output until the job timeout at 21:34:10, and the dependent jobs were dropped. docker_library.py runs run.sh with no timeout, so one stuck docker run takes the whole 18000 s budget.

#128093 bounds every run.sh call at 600 s with praktika Shell.run(timeout=) (TERM to the process group, KILL 100 s later), in both test_docker_library and validate_bugfix_tests. With it, this run would have failed only the head-distroless-amd64 result within about 12 minutes, keeping the partial output, and the rest of the job would have run. The slowest healthy run.sh in the last 90 days took 176 s. #128093 is green and mergeable, and waits for a review.

It bounds the hang, it does not explain what wedges docker run. CIDB has 2 such 18000 s timeouts in 30 days (#124125 and this PR), both on head-distroless-amd64 after a linked client run, against about 11,000 successful runs. The stuck call printed nothing, so this log cannot tell whether the client or the Docker daemon is stuck.

@clickhouse-gh clickhouse-gh Bot added pr-backward-incompatible Pull request with backwards incompatible changes and removed pr-build Pull request with build/testing/packaging improvement labels Nov 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 13, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, analyze if the on-disk format for zxc is stable. Audit the code of zxc for errors. If found, file issues to their repository. If not, send a PR promoting zxc from experimental to beta.

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm analyzing the zxc 1.0.0 on-disk format stability and auditing the zxc code; I'll follow up here with the upstream issues (if I find defects) or a PR promoting the codec to beta.

@groeneai

Copy link
Copy Markdown
Collaborator

On-disk format. zxc 1.0.0 freezes wire format v9, which is unchanged from 0.15.0. The golden archives and conformance vectors are byte-identical to 0.15.0, and a CI job fails on any byte drift. The maintainer commits that later format changes are additive, so newer readers keep reading v9 (release notes, hellobertrand/zxc#457). One gap: docs/FORMAT.md 10.3 and docs/MIGRATION.md still say a decoder accepts only its own version, so that promise is not normative yet. I filed hellobertrand/zxc#624. As the PR description says, CODEC(ZXC) parts written before this PR (format v8) stay unreadable.

Code audit. I found no defect in the zxc_decompress() path ClickHouse uses, tested with an attacker-chosen frame, an attacker-chosen capacity and exact-size buffers:

  • I reviewed the frame walk, the LZ (SPL/PAK) decoder and the Huffman/RLE literal decoders.
  • libFuzzer with ASan and UBSan, on the _default/_avx2/_avx512 layout of contrib/zxc-cmake with each tier forced in turn: decode, plus round trip at levels 1-7. I also replayed the corpora under MSan.
  • The aarch64 NEON build under qemu, with guard pages after every buffer: 72M mutated decodes and 1.7M round trips.

Upstream's own fuzzing does not reach the SIMD kernels (it builds with -DZXC_ONLY_DEFAULT), and its decoder target cannot see a write past dst_capacity. I filed hellobertrand/zxc#625.

Since the code has no defect, I'll send a PR moving enable_zxc_codec from experimental to beta. It has to land after this PR.

@hellobertrand

Copy link
Copy Markdown

@alexey-milovidov Right, FORMAT.md and MIGRATION.md files need a fix in upstream.

But the release notes state the intended guarantee: format v9 is frozen as of 1.0, and any later format version will be additive. Every future ZXC release will keep reading v9 archives, and more generally a decoder implementing version N will read every version from 9 to N.

Merged via the queue into ClickHouse:master with commit 6a8409f Nov 13, 2026
210 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

The PR moving enable_zxc_codec from experimental to beta: #131397

alexey-milovidov pushed a commit to maxjustus/ClickHouse that referenced this pull request Nov 15, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. manual approve Manual approve required to run CI pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants