Repository navigation
Harden 01396_inactive_replica_cleanup_nodes_zookeeper to surface poll errors - #108213
alexey-milovidov merged 3 commits into
Conversation
…rrors Follow-up to ClickHouse#107062, which made the cleanup-wait loop require numChildren to be a non-empty integer before comparing (a transient empty read had let [[ "" -lt N ]] break the loop early). That stabilized the test but still discarded the underlying read error via 2>/dev/null. The numChildren poll is served by StorageSystemZooKeeper: tryGetChildren on the table root, tryGet on each child for its stat, then the name='log' predicate. The only errorless zero-row paths are root-ZNONODE or /log-ZNONODE, but both are permanent structural ReplicatedMergeTree nodes for the whole test (DROP only at the end). So a successful query always returns exactly one numeric row, and an empty count is a suppressed transient error (a Keeper/client hiccup under the heavy single-row INSERT load), not an empty result. Capture the poll's stderr per iteration and, if the loop never converges, print the last error and last count to stderr so the real failure is diagnosable. clickhouse-test fails a .sh test on any non-empty stderr, so a healthy run stays byte-identical and silent; only a genuinely stuck wait now fails with the underlying error exposed instead of a silent wrong count. The temp file uses CLICKHOUSE_TEST_UNIQUE_NAME so the test stays parallel-safe. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-3:20260622-185100 |
|
Workflow [PR], commit [f2965f0] Summary: ✅ AI ReviewSummaryThis PR hardens Final Verdict✅ No new findings in the current revision. |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 478 line(s), 36 function(s) across 148 file(s) · Details Top files
|
The hardening added in this PR printed the wait diagnostic whenever the 120-iteration poll loop hit its deadline. clickhouse-test fails a .sh test on any stderr output, so that moved the pass condition from the assertion to the loop's timing: a slow-but-correct run whose assertion still returns 1 was failed because the message had already been printed. Gate the diagnostic on the assertion result instead. The loop stays a wait; the assertion stays the check. A transient poll error that recovers, or a cleanup that only converges after the deadline, no longer fails the test, while a genuinely untrimmed log or a persistent read error still surfaces the last count and the last poll error. The assertion result is captured to drive that decision, so it is echoed from the variable. It is empty only when the assertion query itself failed, in which case nothing is echoed, keeping stdout byte-identical to a direct run in every scenario. Co-Authored-By: Claude Fable 5 <[email protected]>
CI finish ledger - f2965f0CI fully finished on this head (no check queued or in progress, the praktika aggregator Session id: cron:our-pr-ci-monitor:20260729-093000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Follow-up to #107062 (which stabilized the flaky
01396_inactive_replica_cleanup_nodes_zookeeper), per the two-step plan on that PR: step 1 merged the stabilization, this PR hardens the test.#107062 made the cleanup-wait loop require
numChildrento be a non-empty integer before comparing, because a transient empty read had let[[ "" -lt N ]]break the loop early. That fixed the flake but still discarded the underlying read error via2>/dev/null.Why the read can be empty (the question raised on #107062):
StorageSystemZooKeeperserves the poll viatryGetChildrenon the table root,tryGetper child for its stat, then thename = 'log'predicate. Its only errorless zero-row paths are root-ZNONODEor/log-ZNONODE, and both are permanent ReplicatedMergeTree nodes for the whole test lifetime. A successful query therefore always returns one numeric row, so an empty count is a suppressed transient error (a Keeper/client hiccup under the heavy single-row INSERT load), not an empty result.This captures the poll's stderr per iteration and reports the last count and last error only when the final assertion also fails.
clickhouse-testfails a.shtest on any non-empty stderr, so the diagnostic has to be gated on the assertion rather than on the loop's deadline: the loop is a wait, the assertion is the check. A run whose cleanup converges only after the deadline, or whose last poll errored but recovered, still passes; a genuinely untrimmed log or a persistent read error now fails with the underlying error exposed instead of a silent wrong count.The assertion result is captured to drive that decision and echoed from the variable, guarded so nothing is printed if that query itself failed. A stubbed-client A/B over the real script shows stdout byte-identical to a direct run in all five scenarios. The temp file is keyed on
CLICKHOUSE_TEST_UNIQUE_NAMEand removed on every path, so the test stays parallel-safe.