Repository navigation
Add a setting to enable each experimental codec individually - #113824
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [8838704] Summary: ✅
AI ReviewSummaryThis PR replaces the blanket Findings
💡 Nits
Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 140/146 (95.89%) · Uncovered code |
| bool skip_checks = LoadingStrictnessLevel::SECONDARY_CREATE <= mode; | ||
| bool sanity_check_compression_codecs = !skip_checks && !context_->getSettingsRef()[Setting::allow_suspicious_codecs]; | ||
| bool allow_experimental_codecs = skip_checks || context_->getSettingsRef()[Setting::allow_experimental_codecs]; | ||
| CodecValidationSettings codec_validation_settings = skip_checks ? CodecValidationSettings::trusted() : CodecValidationSettings(context_->getSettingsRef()); |
There was a problem hiding this comment.
LoadingStrictnessLevel::ATTACH is still treated as trusted here, so a full-definition ATTACH TABLE ... (x Float64 CODEC(ALP)) ENGINE = ... skips the new per-codec gate entirely. That contradicts the CREATE-like handling you already added for codec-valued MergeTree settings in registerStorageMergeTree.cpp: a user who never enabled enable_alp_codec / enable_zxc_codec can still opt into an experimental column codec just by using full-definition ATTACH.
Please distinguish "loading previously validated metadata" (FORCE_ATTACH / FORCE_RESTORE, plus short ATTACH) from fresh user input. Full-definition ATTACH needs the same CodecValidationSettings(context_->getSettingsRef()) path as CREATE, with a focused regression test for ATTACH TABLE ... CODEC(...) without the dedicated setting.
There was a problem hiding this comment.
It's same in master, I'd rather not change the semantics in this PR
| | `0x9f` | `ZXC` | | ||
|
|
||
| `0x9d` (`SZ3`) is an **experimental**, error-bounded *lossy* codec for `Float32`, `Float64`, and `Array` of those types. A table can be created with `CODEC(SZ3)` only when `allow_experimental_codecs` is set, but the method byte is always accepted on decompression so that previously written data stays readable. `0x9f` (`ZXC`) is an **experimental** asymmetric LZ codec: slow to compress, but very fast to decompress at a ratio between `LZ4` and `ZSTD`. A table can be created with `CODEC(ZXC)` only when `allow_experimental_codecs` is set, but the method byte is always accepted on decompression so that previously written data stays readable. The bytes `0x99` (`DeflateQpl`) and `0x9b` (`ZSTD_QPL`) were assigned to codecs that have since been removed; they are reserved and not reused. | ||
| `0x9c` (`ALP`) is an **experimental** lossless codec for `Float32` and `Float64` (adaptive lossless floating-point compression). A table can be created with `CODEC(ALP)` only when the `enable_alp_codec` setting is set, but the method byte is always accepted on decompression so that previously written data stays readable. `0x9d` (`SZ3`) is an **experimental**, error-bounded *lossy* codec for `Float32`, `Float64`, and `Array` of those types. A table can be created with `CODEC(SZ3)` only when the `enable_sz3_codec` setting is set, but the method byte is always accepted on decompression so that previously written data stays readable. `0x9f` (`ZXC`) is an **experimental** asymmetric LZ codec: slow to compress, but very fast to decompress at a ratio between `LZ4` and `ZSTD`. A table can be created with `CODEC(ZXC)` only when the `enable_zxc_codec` setting is set, but the method byte is always accepted on decompression so that previously written data stays readable. The bytes `0x99` (`DeflateQpl`) and `0x9b` (`ZSTD_QPL`) were assigned to codecs that have since been removed; they are reserved and not reused. |
There was a problem hiding this comment.
src/Compression/CompressionFactoryAdditions.cpp still accepts the umbrella opt-in here: it throws only when both the dedicated enable_*_codec setting and allow_experimental_codecs are false. As written, this spec/doc text turns a valid configuration (SET allow_experimental_codecs = 1) into "unsupported" behavior on paper.
Please phrase this as the dedicated setting being an additional per-codec opt-in, not the exclusive way to enable the codec, and mirror that wording in the matching codec docs/examples.
There was a problem hiding this comment.
True, the umbrella still works here. It's kept only as a transitional opt-in and will be made obsolete in a follow-up PR, so the spec and docs advertise only the per-codec settings
Ergus
left a comment
There was a problem hiding this comment.
Overall it is fine But I will request the first two changes to approve it.
- Consult
allow_experimental_codecsbefore the missing-setting LOGICAL_ERROR - The system.codecs/system.settings invariant test so the string convention can't silently rot
| if (settings && result_codec->isExperimental()) | ||
| { | ||
| const String enable_setting_name = fmt::format("enable_{}_codec", Poco::toLower(codec_family_name)); | ||
| Field enable_setting_value; |
There was a problem hiding this comment.
I think this check order is not correct, if Setting::allow_experimental_codecs is not enabled then we shouldn't check dedicated settings.
The Setting::allow_experimental_codecs must be checked as an umbrella condition in the outer if.
There was a problem hiding this comment.
You're right that the two checks interact. The gate is deliberately an OR. A dedicated setting alone must be enough, since the point of this PR is enabling one experimental codec without opting into all of them
There was a problem hiding this comment.
allow_experimental_codecs = 1 cannot rescue an experimental codec that has no enable_* setting; it hits LOGICAL_ERROR first.
There was a problem hiding this comment.
Correct, experimental codec without enable_*_codec setting would be a developer bug. It can't reach users, the test you proposed here guards against it
| codec_family_name, | ||
| enable_setting_name); | ||
| if (!enable_setting_value.safeGet<bool>() && !(*settings)[Setting::allow_experimental_codecs]) | ||
| throw Exception( |
There was a problem hiding this comment.
The new error message omits the umbrella condition, and dropped the production warning. IMO the "is experimental and not meant to be used in production" is important information.
There was a problem hiding this comment.
I had dropped the warning deliberately since it's true of any experimental setting, but now I think about it, I agree with you. Here it's worth spelling out as the cost of an error is high.
Leaving the umbrella out of the message is intentional as we want to point to narrowest possible setting rather than enabling all experimental codecs.
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 units104 translation units recompiled, 718 s compile time in total, 104 of them have a recent master baseline. |
|
📊 Cloud Performance Report 🟢 AI verdict: This PR adds per-codec enable__codec settings and refactors codec-validation plumbing (CREATE/ALTER/TTL and network-compression negotiation); it does not touch the SELECT execution path that these ClickBench and TPC-H queries exercise. All flagged queries improved and none regressed, which — together with the differing run counts between the two builds and co-located benchmark instances — points to baseline/environment differences rather than a real change. Seven ClickBench queries were downgraded to not-sure on that basis. Four large deltas (ClickBench Q23 ×2.3 faster and Q31 -26.2%, TPC-H Q7 ×8.4 faster and Q8 ×2.1 faster) remain locked in for being large and consistent, but given what the diff actually changes they should be verified against the baseline environment before being treated as PR wins. clickbench🟢 2 improved · Flagged queries (9 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 2 improved Flagged queries (2 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
| if (settings && result_codec->isExperimental()) | ||
| { | ||
| const String enable_setting_name = fmt::format("enable_{}_codec", Poco::toLower(codec_family_name)); | ||
| Field enable_setting_value; |
There was a problem hiding this comment.
allow_experimental_codecs = 1 cannot rescue an experimental codec that has no enable_* setting; it hits LOGICAL_ERROR first.
Each experimental compression codec (
ALP,SZ3,ZXC,Quantized) is now enabled by its ownenable_<codec>_codecsetting instead of the all-or-nothingallow_experimental_codecs, so opting in to one experimental codec no longer opts in to all of them. The umbrella setting still works.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add settings
enable_alp_codec,enable_sz3_codec,enable_zxc_codec, andenable_quantized_codecto enable each experimental compression codec individually.Workflow [PR]
Sync PR [sync-upstream/pr/113824]
Version info
26.8.1.1769(included in26.8and later)