Skip to content

Keeper: per-server coordination settings overrides - #122124

Closed
al13n321 wants to merge 1 commit into
masterfrom
keeper-lsmt-storage-on-nodes
Closed

al13n321 wants to merge 1 commit into
masterfrom
keeper-lsmt-storage-on-nodes

Conversation

@al13n321

@al13n321 al13n321 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Add the keeper_server.per_server_coordination_settings section, which contains <server-N> elements where N is a server id, with settings that override coordination_settings on the server with that id. This keeps the config identical on all servers while letting some settings differ, e.g. to migrate a cluster to use_lsmt_storage one server at a time:

<per_server_coordination_settings>
    <server-1>
        <use_lsmt_storage>true</use_lsmt_storage>
    </server-1>
</per_server_coordination_settings>

The id is part of the element name so that the config merger pairs the elements per server across config files, the same way disks in storage_configuration are merged. (Repeated same-named elements are paired positionally by the merger, so a layout with repeated <server> elements and an <id> child would merge two files each holding a <server> for a different server into one element, overwriting the id. A bare number is not a valid XML element name, hence the prefix.)

Overrides are applied wherever coordination settings are loaded from the config, including hot reload, so hot-reloadable settings can be overridden per server too. Setting names are validated for every server so a typo is reported everywhere; values are parsed only for this server. Element names that don't match server-N exactly and the same server-N listed twice in one file are rejected.

KeeperTCPHandler now takes the session timeout bounds from KeeperContext instead of reading coordination_settings from the config tree, so it sees the overrides; the config getter parameter of KeeperTCPHandlerFactory is no longer needed. The co-located ZooKeeper client (ZooKeeperArgs::initFromKeeperServerSection) also honours the per-server overrides for the settings it mirrors.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/122124]

@mintlify

mintlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Sep 25, 2026, 1:20 AM

@clickhouse-gh

clickhouse-gh Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7a7fb1a]

Summary: ❌

job_name test_name status info comment
Upgrade check (amd_release) FAIL
Cannot check whether the mutation submitted before the upgrade was finished (see mutation_across_upgrade_error.txt) FAIL cidb
Error message in clickhouse-server.log (see upgrade_error_messages.txt) FAIL cidb
Performance Comparison (arm_release, master_head, 6/6) FAIL Performance dashboard
and_compare_chain_derived #2 FAIL dashboard

AI Review

Summary

This PR adds keeper_server.per_server_coordination_settings so Keeper can keep one shared config while overriding selected coordination settings per server, and wires those overrides into startup, reload, docs, and integration coverage. The main server-side path looks coherent, but the colocated ZooKeeper client still reconstructs the per-server key from the raw server_id text, so it can derive a different effective config from the Keeper server itself.

PR Metadata
  • Changelog category should be Improvement, not Not for changelog, because this adds a new user-visible Keeper configuration surface.
  • A Changelog entry is therefore required. Suggested text: Added keeper_server.per_server_coordination_settings to override ClickHouse Keeper coordination settings per server while keeping a shared cluster configuration.
Findings

⚠️ Majors

  • [src/Common/ZooKeeper/ZooKeeperArgs.cpp:117] The colocated client rebuilds keeper_server.per_server_coordination_settings.server-<id> from the raw keeper_server.server_id string, while the server side canonicalizes server_id numerically. With <server_id>01</server_id> and a canonical <server-1> override, KeeperDispatcher applies the override but ZooKeeperArgs still looks under server-01, so the embedded client silently falls back to base coordination_settings. That breaks the PR's contract that the colocated client sees the same effective session_timeout_ms, operation_timeout_ms, max_request_size, and use_xid_64 as the server. Parse server_id numerically here and format it canonically, or reuse the same helper as the server-side loader.
Tests
  • ⚠️ The new integration test only exercises external clients and conf output; it never constructs zkutil::ZooKeeperArgs from keeper_server, so the colocated-client path described in the PR body still has no focused regression coverage. A small gtest_zookeeper_args case with <server_id>01</server_id> plus a canonical <server-1> override would close this gap.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: canonicalize server_id in ZooKeeperArgs::initFromKeeperServerSection the same way the server-side loader does, add focused regression coverage for that path, and fix the PR changelog metadata.

LLVM Coverage Report

Measured on commit 7a7fb1a.

Metric Baseline Current Δ
Lines 88.10% 88.20% +0.10%
Functions 91.70% 91.70% +0.00%
Branches 79.40% 79.50% +0.10%

Changed lines: Changed C/C++ lines covered: 99/117 (84.62%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the comp-keeper ClickHouse Keeper (Raft-based coordination layer; ZooKeeper replacement) and ZooKeeper client lib... label Sep 25, 2026
Add the `keeper_server.per_server_coordination_settings` section, which
contains `<server-N>` elements where `N` is a server id, with settings
that override `coordination_settings` on the server with that id. This
keeps the config identical on all servers while letting some settings
differ, e.g. to migrate a cluster to `use_lsmt_storage` one server at a
time:

    <per_server_coordination_settings>
        <server-1>
            <use_lsmt_storage>true</use_lsmt_storage>
        </server-1>
    </per_server_coordination_settings>

The id is part of the element name so that the config merger pairs the
elements per server across config files, the same way disks in
`storage_configuration` are merged. (Repeated same-named elements are
paired positionally by the merger, so a layout with repeated `<server>`
elements and an `<id>` child would merge two files each holding a
`<server>` for a different server into one element, overwriting the id.
A bare number is not a valid XML element name, hence the prefix.)

Overrides are applied wherever coordination settings are loaded from the
config, including hot reload, so hot-reloadable settings can be
overridden per server too. Setting names are validated for every server
so a typo is reported everywhere; values are parsed only for this
server. Element names that don't match `server-N` exactly and the same
`server-N` listed twice in one file are rejected.

`KeeperTCPHandler` now takes the session timeout bounds from
`KeeperContext` instead of reading `coordination_settings` from the
config tree, so it sees the overrides; the config getter parameter of
`KeeperTCPHandlerFactory` is no longer needed. The co-located ZooKeeper
client (`ZooKeeperArgs::initFromKeeperServerSection`) also honours the
per-server overrides for the settings it mirrors.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@al13n321
al13n321 force-pushed the keeper-lsmt-storage-on-nodes branch from 7a7fb1a to a41fd1d Compare September 25, 2026 00:54
@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Sep 25, 2026
/// `coordination_settings` (see `CoordinationSettings::loadFromConfig`).
std::string per_server_elem;
if (auto server_id_key = std::string{config_name} + ".server_id"; config.has(server_id_key))
per_server_elem = std::string{config_name} + ".per_server_coordination_settings.server-" + config.getString(server_id_key);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server side canonicalizes keeper_server.server_id through getInt, but the colocated client rebuilds the override key from the raw XML text here. With a config like <server_id>01</server_id> plus <per_server_coordination_settings><server-1>...</server-1></per_server_coordination_settings>, KeeperDispatcher applies the server-1 overrides while ZooKeeperArgs looks for server-01 and silently falls back to the base settings. That breaks the PR's contract that the embedded ZooKeeper client sees the same effective session_timeout_ms / operation_timeout_ms / max_request_size / use_xid_64 as the server. Please parse server_id numerically here and format it canonically (or share the same helper as CoordinationSettings::loadFromConfig), and add a regression test for a non-canonical server_id spelling.

@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 7a7fb1a75 with master 6b1c9a6c2 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

10 object files changed (+33.48 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Coordination/CoordinationSettings.cpp.o 232.69 KiB 272.31 KiB +39.62 KiB (+17.03%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

52 translation units recompiled, 326 s compile time in total, 52 of them have a recent master baseline.

Job report

@al13n321
al13n321 marked this pull request as ready for review September 25, 2026 21:18
@al13n321

Copy link
Copy Markdown
Contributor Author

(Not actually ready for review, I just want a CI build.)

@clickhouse-gh

clickhouse-gh Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

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

This PR changes how Keeper loads its coordination settings: it adds per-server overrides and makes the Keeper TCP handler read session timeouts from the loaded settings. It does not touch query execution, so no ClickBench or TPC-H query runs the changed code. Q16 (+14.9%) and Q18 (+16.1%) are downgraded to not sure. Q32 (+22.8%) stays suppressed because it falls within master's normal variance band. All three are high-cardinality GROUP BY queries whose CPU time rose together, and both ClickBench source runs shared a host, which points to host contention rather than the diff. None of these results needs action from the author.

clickbench

⚠️ 3 inconclusive

Flagged queries (3 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 16 not_sure 549 631 +14.9% <0.0001 aggregation: This PR only changes how Keeper loads its coordination settings, and this ClickBench GROUP BY never runs that code. The +14.9% delta cannot come from the diff, and this query's history is noisy.
⚠️ 18 not_sure 912 1059 +16.1% <0.0001 aggregation: This is a high-cardinality GROUP BY with no path into Keeper or its settings code, so the +16.1% cannot come from this diff. CPU rose along with wall time, which fits contention on the shared host.
⚠️ 32 not_sure 740 908 +22.8% <0.0001 aggregation: The +22.8% falls within master's current variance band. The query does not run any Keeper code, so there is no basis for contesting the suppression.

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

🟢 No significant changes

Debug info
  • StressHouse run: 05ad412e-1a6e-4d24-90e3-0cb61941793a
  • MIRAI run: 91e71693-00cf-4568-b64e-f6b03a149d31
  • PR check IDs:
    • clickbench_1876228_1790388194
    • clickbench_1876242_1790388194
    • clickbench_1876248_1790388195
    • tpch_adapted_1_official_1876258_1790388194
    • tpch_adapted_1_official_1876284_1790388195
    • tpch_adapted_1_official_1876298_1790388195

@al13n321
al13n321 marked this pull request as draft September 26, 2026 03:41
@al13n321

Copy link
Copy Markdown
Contributor Author

(The code is probably fine, but idk if this feature is needed.)

@al13n321 al13n321 closed this Oct 29, 2026

This branch was successfully deployed

1 active deployment
staging - docs — a41fd1d5 Deployed Sep 25, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-keeper ClickHouse Keeper (Raft-based coordination layer; ZooKeeper replacement) and ZooKeeper client lib... pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants