Skip to content

Add ALP to the adaptive codec pool for Float32/Float64 - #117553

Merged
rienath merged 3 commits into
masterfrom
adaptive-compression-alp
Sep 2, 2026
Merged

rienath merged 3 commits into
masterfrom
adaptive-compression-alp

Conversation

@rienath

@rienath rienath commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

With enable_adaptive_codec_selection, float columns previously selected between the default codec and NONE only. This adds ALP(STD) and ALP(RD) to their candidate pool. For example, with TPC-H SF10 this means 64.5% smaller lineitem column in OSS and 41.5% in Cloud (with 3x and 10x warm reads on a single thread, respectively).

Changelog category (leave one):

  • Experimental Feature

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

Adaptive codec selection (enable_adaptive_codec_selection) now considers the ALP codec for Float32 and Float64 columns.


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

Version info

  • Merged into: 26.9.1.539 (included in 26.9 and later)

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [00a7c03]

Summary: ✅


AI Review

Summary

This PR extends enable_adaptive_codec_selection so Float32 and Float64 columns can choose ALP(STD) or ALP(RD) during merges and mutations, and it adds unit plus stateless coverage for that path. I found one rollout/compatibility issue: the new candidates let an existing MergeTree setting start writing ALP blocks without the dedicated enable_alp_codec opt-in, which also breaks the current mixed-version compatibility envelope for adaptive float columns.

PR Metadata
  • Changelog category: Experimental Feature matches the change.
  • Changelog entry: required and sufficiently specific; it clearly names enable_adaptive_codec_selection and the newly considered codec family.
Findings

⚠️ Majors

  • [src/Compression/CompressionCodecAdaptive.cpp:55] Adding ALP here changes the codec set for every table that already has enable_adaptive_codec_selection = 1. The adaptive path constructs ALP directly through CompressionCodecFactory::get, so it bypasses the documented enable_alp_codec gate; and because the backward-compatibility matrix still uses 25.3 replicas for adaptive parts, a newly merged float part can become unreadable on an older replica. Keep ALP out of the adaptive pool until there is a stored opt-in / compatibility gate, or add that gate and extend the backward-compatibility coverage to float adaptive parts.
Tests
  • ⚠️ Add a focused compatibility test for a replicated Float32/Float64 table with enable_adaptive_codec_selection = 1, so the fix proves either that pre-ALP replicas still read the merged part or that ALP is not selected until an explicit opt-in enables it.
Final Verdict

Changes requested.

LLVM Coverage Report

Measured on commit 00a7c03.

Metric Baseline Current Δ
Lines 88.60% 88.60% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 80.90% 80.90% +0.00%

Changed lines: Changed C/C++ lines covered: 22/22 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-experimental Experimental Feature label Sep 1, 2026
@Algunenano Algunenano self-assigned this Sep 1, 2026
@rienath

rienath commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Thank you @Algunenano

{"T64", T64_TYPES},
/// Do not use AUTO as it picks STD or RD per block from a sample. With sampled adaptive compression, that is sample of a sample.
/// STD before RD because STD decompressed faster (we want it in case of tie).
{"ALP(STD)", ALP_TYPES},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ALP is still a gated beta codec: the docs say it requires enable_alp_codec = 1, and the existing stateless coverage checks that every entrypoint which can start writing ALP enforces that gate. Adding ALP(STD) / ALP(RD) here bypasses that contract, because buildCodecForType goes through CompressionCodecFactory::get directly instead of validateCodecAndGetPreprocessedAST, so enable_adaptive_codec_selection = 1 can now write ALP blocks even when enable_alp_codec = 0.

That also changes the upgrade behavior of existing tables. enable_adaptive_codec_selection already exists, and the backward-compatibility test for it still runs old replicas on 25.3; after this change, a new node can merge a float column into ALP and hand the part to a replica that predates ALP. Please keep ALP out of the adaptive pool unless there is a stored opt-in / compatibility gate for it, and add a float case to tests/integration/test_backward_compatibility/test_adaptive_codec.py when this path is made safe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is interesting, but enable_adaptive_codec_selection is experimental so we don't have to worry as bad about backward compatibility, specially while iterating like this

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 00a7c0339 with master 8627fa22f (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.

Compile time of recompiled translation units

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

Job report

@rienath
rienath added this pull request to the merge queue Sep 2, 2026
Merged via the queue into master with commit bb3c0a8 Sep 2, 2026
343 of 344 checks passed
@rienath
rienath deleted the adaptive-compression-alp branch September 2, 2026 13:50
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-experimental Experimental Feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants