Skip to content

Add a "private preview" feature tier between experimental and beta - #113581

Merged
nikitamikhaylov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/add-private-preview-feature-tier
Aug 16, 2026
Merged

nikitamikhaylov merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/add-private-preview-feature-tier

Conversation

@groeneai

@groeneai groeneai commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • New Feature

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

Added a new private preview feature tier between experimental and beta, so feature tiers are now ordered experimental < private preview < beta < production. The server setting allow_feature_tier gains a level: 0 allows all tiers, 1 excludes experimental, 2 additionally excludes private preview, and 3 allows production settings only. Configurations that previously pinned allow_feature_tier = 2 to allow production settings only must now use 3. Closes #113481.

Description

Adds a fourth maturity tier for features that are on a clear path to general availability but whose applicability is still limited and which are not recommended for production use. Requested in #113481; the numbering below was confirmed by the issue author.

allow_feature_tier becomes a four-level gate. Only 2 changes meaning: 0 still grants everything, and 1 still grants everything except experimental, because the tier it newly admits contains no setting (this change deliberately moves no existing setting into the new tier). 3 is new and carries today's 2 semantics. The single upgrade-visible change is that a server pinned at allow_feature_tier = 2 gains beta writability.

Flags::TIER was two bits with all four encodings taken, so it is widened to three (0x0c -> 0x1c). Every pre-existing encoding decodes identically under the wider mask, and the new tier is appended (= 16) rather than inserted, so no existing value of the user-visible system.settings.tier enum moves. The tier bits are never serialized: the only flags ever written to the wire are IMPORTANT and CUSTOM, so no wire format changes and no protocol-version guard is needed. BaseSettingsHelpers::getTier's range check is the tree's only relational comparison on the enum and is re-keyed to the new maximum; every other consumer tests one specific tier, and all of them gain an explicit branch so the tier is neither silently ungated nor silently unreported.

Documentation is the DECLARE doc string, which the nightly docs job regenerates; no .mdx is edited by hand. allow_feature_tier is a server setting, so SettingsChangesHistory.cpp (which tracks user-level Settings) does not apply.

Related, no overlap in behaviour: #113156 edits the same two functions in SettingsConstraints.cpp and MergeTreeSettings.cpp, but the two merge cleanly in either order and the merged sanityCheck carries both changes, so neither blocks the other.

Version info

  • Merged into: 26.8.1.1490 (included in 26.8 and later)

Feature tiers were PRODUCTION, OBSOLETE, EXPERIMENTAL and BETA. This adds a
fourth maturity tier for features on a clear path to general availability whose
applicability is still limited and which are not recommended for production
use, so the tiers are ordered

    experimental < private preview < beta < production

and extends allow_feature_tier accordingly. Requested in ClickHouse#113481; the
numbering below was confirmed by the issue author.

allow_feature_tier becomes a four-level gate: 0 allows every tier, 1 excludes
experimental, 2 additionally excludes private preview, and 3 allows production
settings only. Only 2 changes meaning. 0 still grants everything, and 1 still
grants everything except experimental, because the tier it newly admits
contains no setting: this change deliberately moves no existing setting into
the new tier, which is a product decision for the issue author. 3 is new and
carries today's 2 semantics. The single upgrade-visible change is that a
server pinned at allow_feature_tier = 2 gains beta writability; operators
wanting the old behaviour move to 3. The default stays 0, so no default moves.

Flags::TIER was exactly two bits with all four encodings taken, so it is
widened to three (0x0c -> 0x1c). Every pre-existing encoding decodes
identically under the wider mask, which stays disjoint from IMPORTANT, CUSTOM
and HOT_RELOAD. The new tier is appended (= 16) rather than inserted, so no
existing value of the user-visible system.settings.tier enum moves, and 16
fits int8_t as DataTypeEnum8 requires. BaseSettingsHelpers::getTier holds the
only relational comparison on the enum in the tree and is re-keyed to the new
maximum; without that, every private-preview setting would throw
INCORRECT_DATA at decode.

The tier bits are never serialized. Flags::TIER appears once in all of src/,
the only flags ever OR-ed into a serialized word are IMPORTANT and CUSTOM, and
writeChangedBinary writes an empty flags word, so no wire format changes and
no protocol-version guard is needed.

Every other consumer tests one specific tier with == or !=, so a new tier
would otherwise be silently ungated or silently unreported. All of them gain
an explicit branch: the query-settings gate, the MergeTree table-settings gate
and its five callers, both directions of the allow_feature_tier mapping (the
inverse feeds system.server_settings, which would misreport the level
otherwise), the user-visible Enum8 and the documentation generator. Sites
testing OBSOLETE are unchanged, since private preview is correctly treated
like any other live tier.

Documentation is the DECLARE doc string, which the nightly docs job
regenerates, so no .mdx is edited by hand. allow_feature_tier is a server
setting, so SettingsChangesHistory.cpp, which tracks user-level Settings, does
not apply.

Closes ClickHouse#113481
The three-bit `Flags::TIER` mask is the load-bearing part of adding a
fourth tier, and nothing in the suite could detect its reversion. With
the old two-bit mask, encoding 16 masks to 0 and reads as PRODUCTION, so
a private-preview setting would be silently writable at every
`allow_feature_tier` level while every test stayed green: the enum
reference is built from the enumerators and never calls `getTier`, the
per-tier counts are zero under either mask because no setting carries
the tier yet, the range check never fires, and the integration test
exercises only the pre-existing encodings.

`BaseSettingsHelpers::getTier` is a public static taking a raw `UInt64`,
so it can be tested directly. The new case asserts that all five
encodings round-trip, that the three reachable invalid encodings throw
`INCORRECT_DATA`, and that `IMPORTANT`, `CUSTOM` and `HOT_RELOAD` do not
disturb the tier read. Reverting the mask fails it at exactly the
private-preview assertion while the other four encodings still pass.

The per-tier rows added to `03257_setting_tiers` now assert
`count() == 0` instead of `count() >= 0`. The latter holds for any
count, so it could never fail; the former states the current fact that
no setting carries the tier and reddens when one joins it without the
reference being updated.

Also name the new tier in the `getTier` doc comment, the last place in
`src` and `programs` that still enumerated only three tiers.
@groeneai

groeneai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review

An independent cold review plus a separate adversarial pass were run against this diff before it
was opened. Verdicts below; nothing was overridden without evidence.

Both channels found no code defect. The independent pass reported zero findings after reading
every changed function, its callers, the tier representations, the sibling validation paths, the
documentation surfaces and the modified tests. The cold review reached the same conclusion by a
different route: it enumerated the invariant carriers from the tree first and then compared that
list against the plan, and the two agreed.

The carrier census is the part worth stating, because a missed carrier here fails in the
permissive direction. There is exactly one relational comparison on the tier enum in all of
src/, programs/ and utils/ (BaseSettingsHelpers::getTier), probed in both operand orders
and all spellings, and it is re-keyed to the new maximum. Every other consumer tests one specific
tier: three trios, at SettingsConstraints.cpp, MergeTreeSettings.cpp and
StorageSystemDocumentation.cpp, and each gained an explicit branch. The MergeTreeSettings
trio is written with the unqualified enum spelling, so a census keyed only on
SettingsTierType:: would have missed the MergeTree table-settings gate and left it ungated;
that is why both spellings were swept. All five sanityCheck call sites were updated, including
the two in programs/server/Server.cpp that a src/-scoped search does not reach, and the arity
change makes a missed site a compile error rather than a silent pass.

Two claims carry the change, and both were measured rather than argued:

❌ Nothing sets the bit the widened mask newly captures. A parser-based census of the flags
argument of every DECLARE macro in src/ (balanced-paren and raw-string aware) yields the
complete distinct set {0, EXPERIMENTAL, HOT_RELOAD, BETA, IMPORTANT, SettingsTierType::OBSOLETE};
the three apparent oddities are five-argument DECLAREs whose last argument is a default value,
not flags. 0x1c is bitwise-disjoint from IMPORTANT, CUSTOM and HOT_RELOAD, and no
hardcoded 0x0c / 0b1100 / & 12 mask survives anywhere in the tree.

❌ The tier bits never cross the wire. getTier has two production callers and both read
compile-time field_infos[index].flags; the only flags ever OR-ed into a serialized word are
IMPORTANT and CUSTOM (two sites, both in BaseSettings.h), writeChangedBinary writes an
empty word, and readers either ignore it or test only those two bits. So no wire format changes
and no protocol-version guard is owed.

⚠️ Two false statements in the PR's own prose were found and corrected before publishing.
The body claimed this PR and #113156 would need a trivial rebase whichever landed second; that is
wrong. git merge-tree reports no conflict, and because a bare success is indistinguishable from
a broken invocation, it was checked against a positive control: a synthetic commit editing the
exact line this PR edits does conflict on the same file. The merged result is also coherent
rather than merely conflict-free, with the merged sanityCheck carrying both changes and all its
call sites arity-correct. Separately, a count in the validation comment said "149 bare
EXPERIMENTAL against 5 qualified", where 149 is in fact the total including those 5; the true
split is 144 unqualified against 5 qualified. Both were rewritten. The underlying arguments are
unaffected, but a figure a reviewer can disprove by grepping discredits the ones next to it.

💡 Changelog category, offered as a maintainer's call. This is filed as New Feature. It does
carry one backward incompatibility: of the four allow_feature_tier values, exactly one changes
meaning, and both mappings were executed from source to establish that (0 and 1 are provably
unchanged, 3 is new, and only 2 widens from production-only to also allowing beta). New Feature follows the closest precedent, the founding PR of this mechanism, and the compat
consequence has its own sentence in the changelog entry rather than being buried. If you would
rather it appear under Backward Incompatible Change in the release notes, that is a one-word
retag and no objection from this side.

💡 One nit, not blocking. In the tier column comment the new PRIVATE PREVIEW bullet is
appended after EXPERIMENTAL, whereas that list runs in descending maturity, so it would read
better between BETA and EXPERIMENTAL. Prose only, nothing depends on it, and the sibling list
in Settings.cpp (which runs ascending) already orders the new tier correctly.

Session id: cron:clickhouse-review-slot-52:20260805-211700

@groeneai

groeneai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (a-i)
# Check Answer
a Deterministic repro? N/A: this is a new feature, there is no failure to reproduce. In its place: a deterministic acceptance oracle, every leg a concrete command on the shipping binary (Build ID 0da8f5714b1697d8). The tier enum reads Enum8('Production'=0,'Obsolete'=4,'Experimental'=8,'Beta'=12,'PrivatePreview'=16) in both system.settings and system.merge_tree_settings; no query throws INCORRECT_DATA; allow_feature_tier set to 0/1/2/3 reads back 0/1/2/3 through system.server_settings.
b Root cause explained? Structural, not a defect. Flags::TIER was exactly two bits with all four encodings taken, so a fifth tier requires widening it to three. Separately, every consumer of the enum tests one specific tier, so an added tier is otherwise silently ungated (the permissive direction) or silently unreported.
c Fix matches root cause? Yes. Widen the mask 0x0c -> 0x1c, re-key the single relational comparison in getTier to the new maximum, and add an explicit branch at each enumerated consumer. No defensive guard, no band-aid.
d Test intent preserved / new tests added? 03257_setting_tiers keeps its exhaustiveness claim true and gains one per-tier row per collection, asserting count() == 0, which states the documented current fact that no setting carries the tier yet and still reddens the day one joins it without the reference being updated. A new unit test, SettingsTier.GetTierDecodesEveryEncoding, pins the mask itself: all five encodings round-trip through BaseSettingsHelpers::getTier, the three reachable invalid encodings throw, and the tier read is undisturbed by IMPORTANT, CUSTOM and HOT_RELOAD. The integration test's general-settings arm grows from a three-step to a four-step 0 -> 1 -> 2 -> 3 walk, and every arm whose intent was "production only" moved to 3; all 16 replace_in_config calls on the allow_feature_tier config path were audited and 11 of them are 0<->1 transitions whose meaning is unchanged. No test weakened.
e Demonstrated in BOTH directions? Yes, two independent witnesses on a base binary proven pristine with positive and negative controls (PrivatePreview string count 0 vs 1; Experimental control 2 vs 2). 02117_show_create_table_system fails on base with exactly the enum-shape diff. test_allow_feature_tier_in_general_settings fails on base at the renumbering line: pristine master still rejects a BETA setting at allow_feature_tier = 2, post-fix it allows it. Note 03257 deliberately passes on base, because 'PrivatePreview' is an unknown enum name there, so its added rows are controls; what proves them live is a temporary flip of one setting per collection into the new tier, under which the old IN list reddens (0/0) and the new one is green (1/1). The flip was reverted; no setting changes tier here.
f Fix is general across CODE paths? The carrier census used both spellings, because the enum is unscoped and the bare form dominates (of 149 EXPERIMENTAL occurrences in src/ and programs/, 144 are unqualified against 5 written SettingsTierType::EXPERIMENTAL). The symmetric pair, the query-settings gate and the MergeTree table-settings gate, both gain the branch; fixing only the first would leave table settings ungated. The sanityCheck signature change is a compile error rather than a silent pass, and it caught two callers in programs/server/Server.cpp that a src/-scoped census misses, so five call sites were updated rather than three.
g Fix generalizes across INPUTS? The input is the allow_feature_tier value; all four in-range values round-trip exactly. Out of range behaviour is unchanged in kind: the setting is UInt32 with no validation, so any value at or above 3 now behaves as 3 exactly as any value at or above 2 behaved as 2 before. No validation was added, since that would be an unrequested behavioural change to an existing setting.
h Backward compatible? The default stays 0, so no default moves. The single upgrade-visible change is that a server pinned at allow_feature_tier = 2 gains beta writability; it is stated in the changelog entry, in the setting's own doc string and in the PR body. SettingsChangesHistory.cpp is the wrong vehicle and is untouched: allow_feature_tier is a server setting and ServerSettings.cpp contains no ChangesHistory references at all, against controls of 3 in Settings.cpp and 2 in MergeTreeSettings.cpp.
i Invariants and contracts preserved? The tier bits are never serialized: production code reads Flags::TIER in exactly one place, getTier itself, the only flags ever written to the wire are IMPORTANT and CUSTOM, and writeChangedBinary writes an empty flags word. So widening the mask changes no wire format and needs no protocol-version guard. Verified mechanically that all four pre-existing encodings decode identically under the wider mask, that the mask stays disjoint from IMPORTANT, CUSTOM and HOT_RELOAD, that the range check accepts exactly the five valid values and rejects 20, 24 and 28, and that 16 fits int8_t as DataTypeEnum8 requires. The new value is appended rather than inserted, so no existing user-visible system.settings.tier value moves.

Validation. Clean build with -Weverything -Werror. The five named stateless tests pass, and 50 randomized runs of the tier tests are 150/150. Both integration suites pass, 7 of 7. A 91-test regression slice covering every stateless test that reads system.settings, system.merge_tree_settings, system.server_settings or tier was run on both arms with an identical test list: no test fails on the fix that passes on base. Five mutation arms were run, one per fixed carrier, each a separate build with its own Build ID: reverting the mask makes a private-preview setting report Production; reverting the range check throws Code: 117 INCORRECT_DATA on every tier read; dropping the enum value makes the exhaustiveness assertion fail; and dropping only the getAllowTierSettings inverse branch makes system.server_settings misreport 0/1/2/3 as 0/1/1/2. The mask arm is now pinned by the new unit test, which fails on it at exactly the PRIVATE_PREVIEW round-trip assertion while the four other encodings pass on both arms, so the mutant is caught by that row specifically and not by a broken test.

Session id: cron:clickhouse-review-slot-52:20260805-211700

@groeneai

groeneai commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

cc @jkartseva @vitlibar, could you review this? It adds a fourth feature tier between experimental and beta, which required widening Flags::TIER from two bits to three since all four encodings were taken, and gives allow_feature_tier a fourth level so only the value 2 changes meaning.

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Aug 5, 2026
@nikitamikhaylov nikitamikhaylov self-assigned this Aug 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6bf3fd0]

Summary: ✅


AI Review

Summary

This PR adds a PRIVATE_PREVIEW settings tier, widens the tier-bit mask to carry it, extends allow_feature_tier to four effective levels, and updates the affected gating, reporting, and regression-test paths. I did not find an unresolved correctness, compatibility, or evidence gap in the current diff.

Final Verdict
  • Status: ✅ Approve

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.50% 86.50% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.70% 78.80% +0.10%

Changed lines: Changed C/C++ lines covered: 147/160 (91.88%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Aug 5, 2026
@groeneai

groeneai commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 6bf3fd0

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build (arm_release) / Post Hooks infra: build_profile_hook.py fails closed when the build-profile telemetry INSERT into the shared CI logs cluster is rejected (LogCluster query failed with code 500 / No connection to LogCluster). Not PR-caused and not gating: the Build (arm_release) check-run itself is green, only this CIDB row is red. #113409 (external, merged 2026-08-06T00:05:00Z) — arrives here with the next master merge, see below

This is the only failure on this head.

Fix-presence probe for the owner, by content rather than commit distance: this head's
ci/jobs/scripts/log_cluster.py is 11916 bytes with no data.seek(0) and one retries= site,
whereas current master is 12698 bytes with data.seek(0) and four of them (positive control
master, negative control the merge parent, both discriminating). So the merged fix is genuinely not
in this build. No re-run is needed to prove it works: master's own Build (arm_release) /
Post Hooks reds fell from 4 per hour at 01:00Z to 0 by 05:00Z today, and the next master merge
picks the fix up here.

Gates: (a) 175 check-runs, 0 queued/in_progress/pending/waiting; (b) Finish Workflow and
Config Workflow both success; (c) last completion 03:22:35Z, >20 min buffer; (d) the failure above
has an owner.

Session id: cron:our-pr-ci-monitor:20260806-050000

@clickhouse-gh

clickhouse-gh Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 35 queries analysed

This is a settings-tier plumbing change: it introduces a new PRIVATE_PREVIEW tier and wires it through access-control gating, sanityCheck signatures, and the system settings/merge_tree_settings enums. None of the changed code runs during query execution, so the flagged improvements on clickbench Q23 (×2.2 faster) and tpch Q7/Q8 (×8.1 and ×2.2 faster) cannot plausibly be caused by this PR — all three have been downgraded to not sure. The large, uniform deltas across unrelated benchmarks (with only 6 source runs and a very noisy Q23) point to measurement/baseline variance rather than a real code effect.

clickbench

⚠️ 1 inconclusive

Flagged queries (1 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 23 not_sure 167 76 ×2.2 faster <0.0001 This PR only adds a PRIVATE_PREVIEW settings tier and its access-control gating; it touches no query-execution path, so the ×2.2 faster reading on Q23 (noisy history, high source variance) is not a PR effect.

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 inconclusive

Flagged queries (2 of 22)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 7 not_sure 574 71 ×8.1 faster <0.0001 The diff is limited to settings-tier plumbing (new PRIVATE_PREVIEW tier, sanityCheck signatures, system-table enums); nothing in the join or scan path changed, so a ×8.1 faster Q7 cannot be attributed to this change.
⚠️ 8 not_sure 175 81 ×2.2 faster <0.0001 Same reasoning as Q7: this PR only reshapes the feature-tier gating and system settings metadata, so the ×2.2 faster Q8 delta is off-path and reads as run-to-run variance rather than a PR effect.

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
  • StressHouse run: d77fe493-d93b-4e31-a67b-4cffa15c5e73
  • MIRAI run: e450f5dd-0dea-4cb4-ace1-633e509a8e9c
  • PR check IDs:
    • clickbench_1230658_1786722711
    • clickbench_1230664_1786722711
    • clickbench_1230675_1786722711
    • tpch_adapted_1_official_1230687_1786722711
    • tpch_adapted_1_official_1230700_1786722712
    • tpch_adapted_1_official_1230729_1786722713

@nikitamikhaylov
nikitamikhaylov added this pull request to the merge queue Aug 16, 2026
Merged via the queue into ClickHouse:master with commit 4145325 Aug 16, 2026
180 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 16, 2026
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Aug 18, 2026
@groeneai groeneai added the groeneai-origin-request PR origin: a maintainer pinged or directed groeneai label Aug 19, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 28, 2026
@nikitamikhaylov nikitamikhaylov added v26.2-must-backport and removed v26.4-must-backport pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore labels Sep 2, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 13, 2026
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 groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-feature Pull request with new product feature pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a new "private preview" feature tier

5 participants