Skip to content

Stabilize Keeper reconfig test retries - #105828

Merged
antonio2368 merged 1 commit into
masterfrom
syncing-changes-from-private
May 26, 2026
Merged

antonio2368 merged 1 commit into
masterfrom
syncing-changes-from-private

Conversation

@antonio2368

@antonio2368 antonio2368 commented May 26, 2026 •

Copy link
Copy Markdown
Member

Syncs the non-private Keeper test stabilization from https://github.com/ClickHouse/clickhouse-private/pull/54962 for #101757.

This makes test_keeper_reconfig_replace_leader_in_one_command robust under repeated runs by resetting Keeper state, closing stale ZooKeeper connections, and confirming idempotent retried create operations after NodeExistsError.

No matching open issue was found for test_keeper_reconfig_replace_leader_in_one_command.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Not required.

Documentation entry:

  • Documentation is not required because this only changes an integration test.

Version info

  • Merged into: 26.6.1.162

Sync the non-private stabilization from ClickHouse/clickhouse-private#54962 for `test_keeper_reconfig_replace_leader_in_one_command`.

Reset the `Keeper` state before each repeated run, close stale ZooKeeper connections, and treat retried `create` as success only when the existing znode contains the expected data.

Refs: ClickHouse/clickhouse-private#54962

Refs: #101757
@clickhouse-gh

clickhouse-gh Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [76027d0]

Summary: ✅


AI Review

Summary

This PR hardens test_keeper_reconfig_replace_leader_in_one_command by resetting Keeper state between runs, keeping nodes stay_alive for controlled restart, and handling retried create calls that can legitimately surface NodeExistsError after connection loss. After reviewing the full diff, current code, prior discussion, and CI report, I found no unresolved correctness, safety, or reliability regressions in the changes.

Final Verdict

Status: ✅ Approve

@SmitaRKulkarni SmitaRKulkarni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@groeneai

Copy link
Copy Markdown
Collaborator

Approach matches the investigation in the closed #105707. CIDB confirms 12 of 13 recent failures in the past 14 days land on this exact line test.py:131 (zk4.create(f"/test_four_{100 + i}", b"somedata")), all with the same kazoo NodeExistsError traceback through KazooClientWithImplicitRetries.create. The targeted create_or_confirm here resolves that race.

The value-equality check (assert zk.get(path)[0] == data) on NodeExistsError correctly handles the lost-response retry case: the server committed the create, the response was dropped during a ConnectionLoss, kazoo retries and observes the now-existing node with the same value. Genuine collisions (different value) still surface as an assertion failure.

reset_keepers() + stay_alive=True on node1/2/3 is a useful improvement on top of #105707: with the coordination state wipe between runs, the test is now safe under --count N repeated runs. Targeting only the second zk4.create loop (and not the first zk1.create loop) is correct, since the race only manifests after the leader change.

LGTM.

@antonio2368
antonio2368 enabled auto-merge May 26, 2026 14:52
@clickhouse-gh

clickhouse-gh Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.10% -0.10%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.60% +0.00%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 425 line(s), 61 function(s) across 108 file(s) · Details

Top files
  • src/Storages/MergeTree/MergeTreeData.cpp: 75 line(s), 2 function(s)
  • src/Common/QueryFuzzer.cpp: 50 line(s)
  • src/AggregateFunctions/AggregateFunctionIntervalLengthSum.cpp: 21 line(s), 40 function(s)
  • src/Storages/StorageReplicatedMergeTree.cpp: 11 line(s)
  • src/Dictionaries/RegExpTreeDictionary.h: 9 line(s), 7 function(s)

Full report

@antonio2368
antonio2368 added this pull request to the merge queue May 26, 2026
Merged via the queue into master with commit a88db8e May 26, 2026
327 of 328 checks passed
@antonio2368
antonio2368 deleted the syncing-changes-from-private branch May 26, 2026 16:28
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 26, 2026
@groeneai

groeneai commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

@antonio2368 could you apply the v26.5-must-backport label to this PR? It is missing from 26.5 and the flake it fixed is still firing there.

The NodeExistsError at test.py:131 in test_keeper_reconfig_replace_leader_in_one_command is now confined to 26.5. Over the last 120 days, on pull_request_number = 0, 26.5 has 11 FAIL against 696 OK while master, 26.7, 26.6, 26.4, 26.3 and 25.8 each have 0 FAIL. All 11 of the 26.5 rows carry NodeExistsError and all 11 carry test.py:131, the unguarded zk4.create(f"/test_four_{100 + i}", b"somedata"). Latest hit 2026-08-04 23:44:26, so about 1.6 percent of 26.5 runs.

Five more of the same signature landed on robot backport PRs targeting 26.5 (the backport/26.5 branches for 106802, 108477, 110233, 111039 and 111806), so it also taxes unrelated 26.5 backports.

This PR is the fix and it works. Counting FAIL rows for this test on master lineage since this merged at 2026-05-26 16:28:17, there are 8, and none of them is this signature: they are at test.py:171, :130 and :39. The last NodeExistsError anywhere on master lineage is 2026-05-26 15:47:06, 41 minutes before the merge, against 87801 OK runs of this test on master lineage in the same window. 26.5 lacks the change: git merge-base --is-ancestor a88db8eda388684e2ca670c12ee05f89046a3133 26.5 is false, and create_or_confirm occurs 0 times in the 26.5 copy of the test versus 2 times on master, 26.7 and 26.6.

v26.5-must-backport rather than pr-must-backport: the version label expands to the named release plus every newer active branch, so it targets 26.7, 26.6 and 26.5, and the first two already contain the merge commit, which leaves 26.5 as the only real target. The general label would also target 26.3 and 25.8, where this signature has never fired (0 FAIL against 987 and 423 OK) and where 25.8 does not run the db disk flavor that produced 10 of the 11 hits.

The cherry-pick is clean, so the robot should not need anyone to resolve anything: git merge-tree --write-tree --merge-base=a88db8eda388684e2ca670c12ee05f89046a3133^1 26.5 a88db8eda388684e2ca670c12ee05f89046a3133 succeeds and the resulting tree differs from the current 26.5 head in that one test file only, +60/-10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants