Repository navigation
Introduce Settings Compatibility Blocker - #114190
Conversation
|
Workflow [PR], commit [6f117d2] Summary: ✅
AI ReviewSummaryThis PR adds per-change PR Metadata
Suggested replacement:
A Missing context / blind spots
Findings❌ Blockers
Final VerdictChanges requested. The per-entry LLVM Coverage ReportMeasured on commit 6f117d2.
Changed lines: Changed C/C++ lines covered: 60/62 (96.77%) · Uncovered code |
|
|
||
| ClickHouseVersion version(compatibility_value); | ||
| const auto & settings_changes_history = getSettingsChangesHistory(); | ||
| UnorderedSetWithMemoryTracking<std::string_view> blocked_settings; |
There was a problem hiding this comment.
Maybe worth to put a comment why we need set
There was a problem hiding this comment.
Not sure if it is needed in the code; the logic is simple: iteration goes back through versions across all settings, not within a single one.
| /// In case the alias is being used (e.g. use enable_analyzer) we must change the original setting | ||
| auto final_name = MergeTreeSettingsTraits::resolveName(change.name); | ||
|
|
||
| if (change.compatibility_mode == SettingsChangesHistory::SettingChange::CompatibilityMode::StartUsingNew) |
There was a problem hiding this comment.
applyCompatibilitySetting only helps if the MergeTreeSettings cache is rebuilt, but Context keeps merge_tree_settings / replicated_merge_tree_settings in ContextSharedPart and Context::setSettingWithLock never invalidates those caches when compatibility changes. A concrete repro already exists in the current tree: first query system.merge_tree_settings to warm the cache, then run SELECT value FROM system.merge_tree_settings WHERE name = 'compute_exact_num_defaults_for_sparse_columns' SETTINGS compatibility = '26.7'. StorageSystemMergeTreeSettings::fillData still reads the cached object, so the second query keeps returning 1 instead of the expected compatibility value 0. This new blocker has the same issue, so session/query-level rollout control is bypassable after the first MergeTree settings access. Please key these caches by the effective compatibility value, or invalidate them whenever compatibility / the active profile changes.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes6 object files changed (+37.87 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units11 translation units recompiled, 43 s compile time in total, 11 of them have a recent master baseline. |
That's not specific enough, kindly add more details, an example etc., thanks. |
There was a problem hiding this comment.
@Michicosun I see that you extended the changelog message by one sentence (thanks). Sorry for asking again, but it's still not clear what this PR is doing. The enum values in the code have no comments and the extra system table field lacks documentation in https://clickhouse.com/docs/reference/system-tables/settings_changes.
- How is the compatibility blocker supposed to be used?
- In which situations should it be used?
- Should we document or mention in the docs of "compatibility blocked" settings (e.g.
shared_merge_tree_merge_coordinator_distribution_algorithm) that the compatibility setting has no effect for them?
|
The problems mentioned in #114190 (review) are still there. |
| changes Array(Tuple(\n name String,\n previous_value String,\n new_value String,\n reason String)) The list of changes in settings which changed the behaviour of ClickHouse. | ||
| Session 22.5 [('memory_overcommit_ratio_denominator','0','1073741824','Enable memory overcommit feature by default'),('memory_overcommit_ratio_denominator_for_user','0','1073741824','Enable memory overcommit feature by default')] | ||
| changes Array(Tuple(\n name String,\n previous_value String,\n new_value String,\n reason String,\n compatibility_mode String)) The list of changes in settings which changed the behaviour of ClickHouse. | ||
| Session 22.5 [('memory_overcommit_ratio_denominator','0','1073741824','Enable memory overcommit feature by default','RollbackToOld'),('memory_overcommit_ratio_denominator_for_user','0','1073741824','Enable memory overcommit feature by default','RollbackToOld')] |
There was a problem hiding this comment.
This is the only coverage added for the new CompatibilityMode::StartUsingNew path, but it never exercises that path: the sample row here is a Session history entry that still stays RollbackToOld. We still have no focused regression proving that SETTINGS compatibility = '26.7' leaves shared_merge_tree_merge_coordinator_distribution_algorithm at sainte_lague, or that the warm-cache system.merge_tree_settings path keeps honoring that behavior after the first MergeTree settings access. Please add a stateless test for the blocked MergeTree setting itself.
Preserve `StartUsingNew` in the resolved compatibility history and reconcile settings history entries. #114190 (review)
| std::make_shared<DataTypeString>(), | ||
| std::make_shared<DataTypeString>()}, | ||
| Names{"name", "previous_value", "new_value", "reason"})), "The list of changes in settings which changed the behaviour of ClickHouse."}, | ||
| Names{"name", "previous_value", "new_value", "reason", "compatibility_mode"})), "Setting changes. `compatibility_mode`: `RollbackToOld` permits rollback to `previous_value`; `StartUsingNew` blocks rollback of this and earlier changes to the same setting."}, |
There was a problem hiding this comment.
The source-level docs are updated here, but the checked-in English page still has a hand-written example in docs/reference/system-tables/settings_changes.mdx that shows the old four-element tuples (and even the old type values). Because that example sits outside the autogenerated block, merging this still leaves the public docs page contradicting the new compatibility_mode field. Please refresh or remove that manual output snippet as part of this change.
|
Dear @azat, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Rename the modes to `Apply` and `Ignore`, update descriptions and reference output, and remove the scheduling example. #114190 (comment) #114190 (comment)
SET x = DEFAULT restored the compiled default of x and ignored an active
compatibility setting, so the session reported the current version's default
while compatibility still claimed the old era - a state no new session with
the same compatibility could reach. That contradicts the documented contract
of compatibility ("only settings that have not been modified are affected"),
since after a reset the setting is by definition not modified.
SET x = DEFAULT is not a SettingChange: the parser puts the bare name into
ASTSetQuery::default_settings, and the reset reaches
BaseSettings::resetToDefault, which is not virtual. The whole chain therefore
bypasses SettingsImpl::set, the only compatibility-aware mutator and the sole
override of the single virtual in BaseSettings, so the derivation never re-runs.
SettingsImpl::resetToDefaultRespectingCompatibility resets and then calls the
existing applyCompatibilitySetting. Reading compatibility after the reset is
what makes SET compatibility = DEFAULT revert every setting it derived, with
no special case, because the value read is then the empty default. Calling the
existing walk rather than duplicating it filtered to one name keeps the reset
path from diverging from the fresh-session path, which matters because ClickHouse#114190
is editing that walk.
Only the four surfaces that implement SET <name> = DEFAULT are repointed;
every internal caller that wants the declared default keeps the raw reset.
Settings::setDefaultValue itself is deliberately not repointed: Connection.cpp
resets a setting purely to mark it unchanged so it is not resent and asserts
exactly that on the next line, and re-deriving assigns a value and so sets
changed, which was measured to fire that assert on an ordinary query whenever
the user profile activates compatibility. AsynchronousInsertQueue resets
async_insert to let the remote part decide, and async_insert has a live history
row, so re-deriving would take that decision away under compatibility <= 26.1.
MySQLHandler rewrites = DEFAULT to SQL text and re-enters the first surface, so
it is fixed with no edit.
SettingsConstraints::checkResetToDefault had to move with it. It was
centralized in ClickHouse#115334 on the premise that the defaults do not depend on the
session, which this change makes false: with a profile that both pins and
constrains a setting, the pin keeps it changed, compatibility leaves it alone,
and a reset would install the era value the constraint forbids. Measured on a
build carrying the reset change without this half, such a reset was accepted
silently and landed below the profile's declared minimum. The check now
replays the statement on a throwaway copy of the context the resets will
mutate and validates the values it lands on; enforcement stays on the checking
context, matching the ordinary-change check one line earlier, and the whole
statement is still left without effect on a violation.
Behaviour changes: a reset under an active compatibility now yields the era
value; SET compatibility = DEFAULT now reverts what it derived; and a reset
can now be rejected by a settings constraint where it previously succeeded.
Not addressed, pre-existing and wider: applyCompatibilitySetting writes through
BaseSettings::set, so SET compatibility = '<version>' installs era values for
every unchanged setting with no constraint check at all.
Closes: ClickHouse#116883
…compatibility The four settings added by the 24.10 BACKUP ON CLUSTER coordination rewrite (backup_restore_failure_after_host_disconnected_for_seconds, backup_restore_keeper_max_retries_while_initializing, backup_restore_keeper_max_retries_while_handling_error, backup_restore_finish_timeout_after_error_sec) carry "New setting" history records with a previous value of 0, so compatibility <= 24.10 sets them to 0. In the current code 0 means no Keeper retries while initializing or handling an error, no lost-host detection and an untimed wait after an error. A host that fails its first Keeper step and then fails to write its error never reports anything, so the initiator's waitOtherHostsFinish(throw_if_error = false) in BackupStarter::onException waits forever: KILL QUERY does not stop it and shutdown_wait_backups_and_restores blocks server shutdown. No release behaved like this: 24.9 retried those steps with backup_restore_keeper_max_retries (20) and did not wait for other hosts after an error. Stress tests hit it through compatibility randomization plus backup Keeper fault injection (ClickHouse#116783). Add a 26.10 CompatibilitySetting::Ignore record (ClickHouse#114190) to each of the four settings, so any compatibility value keeps their defaults. The 24.10/24.11 records are unchanged, backup_restore_keeper_max_retries still rolls back to 24.9's 20, and an explicit SET still wins. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Normally, the
compatibilitysetting reverts to the default value from the settings changes history back to its previous value. This patch adds a per-changecompatibility_modefield to the history: entries marked StartUsingNew are excluded from this rollback, so the new default takes effect as soon as the server runs the version that introduced it, even if compatibility points to an older version.Workflow [PR]
Sync PR [sync-upstream/pr/114190]
Version info
26.9.1.1497(included in26.9and later)