…gsImpl::sanityCheck
The allow_experimental_codecs gate for the codec-valued MergeTree settings
(marks_compression_codec, primary_key_compression_codec, default_compression_codec)
was enforced in registerStorageMergeTree.cpp on CREATE. Move that CREATE-time
enforcement into MergeTreeSettingsImpl::sanityCheck, next to the existing lossy-codec
validation of the same three settings, which is the centralized place for MergeTree
settings sanity checks.
sanityCheck is invoked on CREATE only, so the metadata-load paths that do not run it
(SECONDARY_CREATE, short/full ATTACH, and values inherited from the current <merge_tree>
config defaults) keep a minimal counterpart in registerStorageMergeTree. That counterpart
now sits after the extended/deprecated syntax branches so both syntaxes are covered
uniformly (previously it lived in the extended-definition branch only). The initiator-side
ALTER MODIFY/RESET SETTING gate in checkAlterIsPossible is unchanged.
As a result, a deprecated-syntax MergeTree(date, key, granularity) table that inherits an
experimental codec from a <merge_tree> config default is now gated on both CREATE and load,
closing a corner of the config-default bypass that was previously open only for that syntax.
The session-level allow_experimental_codecs cannot be read from the storage's (global)
context inside sanityCheck, so it is threaded explicitly from local_settings through the
StorageMergeTree, StorageReplicatedMergeTree and MergeTreeData constructors. The
ALTER-apply path (changeSettings, which also runs on replicas), the projections path
(codec settings are not allowed there) and the server-startup config-default validation
pass it as satisfied.
Related: ClickHouse#111007
Co-Authored-By: Claude Fable 5 <[email protected]>
Related: #111007
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Follow-up to #111007 (@rschu1ze asked to move the check into
MergeTreeSettingsImpl::sanityCheck).The
allow_experimental_codecsgate for the codec-valued MergeTree settings (marks_compression_codec,primary_key_compression_codec,default_compression_codec) was enforced on CREATE inregisterStorageMergeTree.cpp. This moves that CREATE-time enforcement intoMergeTreeSettingsImpl::sanityCheck, right next to the existing lossy-codec validation of the same three settings.sanityCheckruns on CREATE only, so the metadata-load paths that do not call it (short/fullATTACH,SECONDARY_CREATE, values inherited from the current<merge_tree>config defaults) keep a minimal counterpart inregisterStorageMergeTree. The initiator-sideALTER MODIFY/RESET SETTINGgate incheckAlterIsPossibleis unchanged.The session-level
allow_experimental_codecsis not readable from the storage's global context insidesanityCheck, so it is threaded fromlocal_settingsthrough the storage constructors. The ALTER-apply path (changeSettings, also runs on replicas), the projections path (codec settings are not allowed there) and the server-startup config-default validation pass it as satisfied.One intentional minor tightening: the old check lived only in the extended-definition branch, so a deprecated-syntax
MergeTree(date, key, granularity)CREATE could still inherit an experimental codec from a<merge_tree>config default without the setting. SincesanityCheckruns for every CREATE, that corner of the config-default bypass is now closed too. It only makes an experimental codec correctly require its flag, so no valid workflow breaks.Existing tests
04616_experimental_codec_in_merge_tree_settings,04617_experimental_codec_attach_full_definitionandtest_experimental_codec_config_defaultcover CREATE, ALTER MODIFY/RESET, full/short ATTACH, the config-default-on-load gate, the stored-codec exemption and restart; the integration test gains a deprecated-syntax CREATE case.