Repository navigation
Conversation
Don't wan't to do it now, otherwise PR is backwards incompatible
|
Workflow [PR], commit [b0961ba] Summary: ✅
AI ReviewSummaryThis PR moves codec maturity to the tier of the dedicated Findings
💡 Nits
Tests
Final VerdictChanges requested. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 106/113 (93.81%) · Uncovered code |
| /// profile, which is where such a config default can be legitimately allowed). `FORCE_RESTORE` is | ||
| /// documented to skip all sanity checks and is left alone. | ||
| if (args.mode != LoadingStrictnessLevel::FORCE_RESTORE && !local_settings[Setting::allow_experimental_codecs]) | ||
| if (args.mode != LoadingStrictnessLevel::FORCE_RESTORE) |
There was a problem hiding this comment.
validateCodecString still accepts float-only codecs in these no-column-type MergeTree settings. With enable_alp_codec = 1, default_compression_codec = 'ALP' passes here because the null-type guard only rejects lossy codecs; CompressionCodecALP is built with its fallback float_width = 8 and then reused as the table's implicit CODEC(Default) for every column. A non-float stream (for example a String column, or marks_compression_codec) will later hit Cannot compress with ALP codec, data size ... is not aligned to 8 at write time.
These settings need to reject codecs that only make sense for floating-point column payloads when column_type == nullptr, not just lossy codecs. A focused stateless test around default_compression_codec = 'ALP' on a non-float table would catch this.
There was a problem hiding this comment.
True, but this is a pre-existing gap, not introduced here. @groeneai please open an issue with a repro. Be laconic
There was a problem hiding this comment.
Filed: #116374
Two corrections to the finding above, from running it on 26.7:
- Not ALP-specific and needs no flag.
FPCis non-experimental and hits the same gap:default_compression_codec = 'FPC'on aStringcolumn is accepted atCREATEand fails atINSERTwithCode: 36 ... not applicable for String, whileCODEC(FPC)on the column is rejected atCREATE. The missing guard is thecolumn_type &&term atCompressionFactoryAdditions.cpp:291, not the lossy-only null-type check. marks_compression_codec = 'ALP'andprimary_key_compression_codec = 'ALP'on aStringtable both insert fine, so theString-column claim for those two does not hold.primary_key_compression_codec = 'ALP'does fail, but only with aStringsort key, and withCode: 270 ... not aligned to 8.
| codec_family_name, | ||
| enable_setting_name); | ||
| const CodecEntry & entry = getEntry(codec_family_name); | ||
| if (const std::optional<SettingsTierType> tier = getGateTier(entry)) |
There was a problem hiding this comment.
This centralizes the dedicated gate, but only for callers that go through validateCodec*. We still have string-based codec entry points that call CompressionCodecFactory::get(...) directly, notably temporary_files_codec (src/Interpreters/TemporaryDataOnDisk.cpp) and the server <compression> selector (src/Storages/CompressionCodecSelector.h). After this PR, temporary_files_codec = 'ALP' or <method>ALP</method> still bypasses enable_alp_codec, so the new “tier is defined by the dedicated gate setting” rule is not actually global. For ALP it is worse than a pure gating leak, because those paths compress arbitrary spill/native bytes and can throw on buffers that are not 8-byte aligned.
If the gate is supposed to be the source of truth, every string-based codec entry point needs to validate through this path (or explicitly reject gated codecs) before constructing the codec.
There was a problem hiding this comment.
After this PR,
temporary_files_codec = 'ALP'or<method>ALP</method>still bypassesenable_alp_codec
Correct. This PR is not a bug-fix to pre-existing problem
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units1270 translation units recompiled, 8508 s compile time in total, 1270 of them have a recent master baseline. |
Algunenano
left a comment
There was a problem hiding this comment.
I think that, since we are always using the family name in the setting, we can avoid changing the registration API and not pass the setting name; we can simply generate it and check that it exists
| { | ||
| const String expected_gate_name = fmt::format("enable_{}_codec", Poco::toLower(family_name)); | ||
|
|
||
| if (gate_setting_name != expected_gate_name) |
There was a problem hiding this comment.
Why do we pass it during registration instead of generating it ourselves automatically?
There was a problem hiding this comment.
Thanks for suggesting, really nice idea. Implemented
There was a problem hiding this comment.
Implemented is not quite true in the current code. getGateTier now does Settings::tryGetTierOfBuiltin(gate_setting_name) and simply returns nullopt when the builtin is missing (src/Compression/CompressionFactory.cpp:156-159), so a newly added codec without enable_<family>_codec is silently treated as ungated / Production instead of failing fast. The validation path in src/Compression/CompressionFactoryAdditions.cpp:199-204 then skips the check entirely.
The previous version threw a LOGICAL_ERROR for that case, so this refactor dropped the invariant that every gated codec must have a real builtin switch.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
| for (const auto & [name, entry] : family_name_with_codec) | ||
| if (!entry.gate_setting_name.empty()) | ||
| result.push_back(entry.gate_setting_name); | ||
| for (const auto & family : family_name_with_codec) |
There was a problem hiding this comment.
I don't like what AI is doing to our code :_(
There was a problem hiding this comment.
Is it the definition in if statement that upsets you? I quite like it and used it before "the awakening." Can remove if you prefer
There was a problem hiding this comment.
It's using for-if without brackets. It keeps doing it everywhere (also if-for) and so on. I consider anything that isn't a single statement should be inside brackets, and if is a multiple line statement
There was a problem hiding this comment.
Got it. I personally find it readable and more code fits into one screen. But I like a happy reviewer more: a5bb927
Valid minor improvement, but let's keep diff of this PR small
| { | ||
| const String expected_gate_name = fmt::format("enable_{}_codec", Poco::toLower(family_name)); | ||
|
|
||
| if (gate_setting_name != expected_gate_name) |
There was a problem hiding this comment.
Thanks for suggesting, really nice idea. Implemented
| for (const auto & [name, entry] : family_name_with_codec) | ||
| if (!entry.gate_setting_name.empty()) | ||
| result.push_back(entry.gate_setting_name); | ||
| for (const auto & family : family_name_with_codec) |
There was a problem hiding this comment.
Is it the definition in if statement that upsets you? I quite like it and used it before "the awakening." Can remove if you prefer
| @@ -8753,16 +8753,16 @@ Allows creation of tables with the `UNIQUE KEY` clause on MergeTree-family engin | |||
| If it is set to true, allow to specify any experimental compression codec. | |||
| )", EXPERIMENTAL) \ | |||
| DECLARE(Bool, enable_alp_codec, false, R"( | |||
There was a problem hiding this comment.
Promoting enable_alp_codec to BETA here leaves the history source stale: src/Core/SettingsChangesHistory.cpp:69 still says this setting enables the experimental ALP codec. system.settings_changes, system.documentation, and the generated enable_alp_codec page all read from that file, so users will keep seeing "experimental" after this change unless the history entry is updated in the same PR.
There was a problem hiding this comment.
It's ok, we do not rename the history source after promotion
Reconciled the PR with master's reworked codec gating (#116337): `ICompressionCodec::isExperimental` is gone - a codec family is now gated by the tier of its `enable_<family>_codec` setting. `PCO` keeps its `EXPERIMENTAL` tier, its `isExperimental` override is dropped, and the branch's `experimentalCodecEnableSettingName` / `isExperimentalCodecEnabled` / `areExperimentalCodecsEnabled` helpers are re-expressed on top of master's `getGateSettingName` / `getGateTier` as `isCodecFamilyGated` / `isCodecStringGated` / `areCodecGatesSatisfied`. `system.codecs` gained a `tier` column, so `01222_system_codecs` is updated.
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]>
With this PR, the maturity of a gated compression codec is defined by the declared tier of its
enable_<codec>_codecsetting. Promoting a codec becomes one word tier change.system.codecsgains atiercolumn. The codec to setting link is now declared at registration and validated at server startup.On top of this mechanism,
ALPis promoted to beta.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Compression codecs are now gated by dedicated settings whose declared tier defines the codec maturity. The
ALPcodec is promoted to beta (enable_alp_codecsetting).Workflow [PR]
Sync PR [sync-upstream/pr/116337]
Version info
26.9.1.255(included in26.9and later)