Skip to content

More random disruptions in the stress test - #129515

Merged
PedroTadim merged 2 commits into
masterfrom
stress-more-disruptions
Nov 10, 2026
Merged

PedroTadim merged 2 commits into
masterfrom
stress-more-disruptions

Conversation

@PedroTadim

@PedroTadim PedroTadim commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

The random disruptor of the stress test only killed queries, clients and mutations and paused a few background operations. This adds disruptions that change what running queries depend on while they run:

  • Drop a random cache (SYSTEM DROP ... CACHE, 20 caches: marks, uncompressed, primary index, page, query, query condition, filesystem, text index and others).
  • Run a random server-wide statement: RECONNECT ZOOKEEPER, RESTART REPLICAS, FLUSH ASYNC INSERT QUEUE, UNLOAD DICTIONARIES, RELOAD FUNCTIONS, RELOAD USERS, JEMALLOC PURGE and REFRESH ALL BACKGROUND.
  • SYSTEM UNLOAD PRIMARY KEY of a random MergeTree table, SYSTEM RELOAD DICTIONARY of a random dictionary, and SYSTEM REFRESH VIEW or SYSTEM CANCEL VIEW of a random refreshable materialized view.
  • SYSTEM RESTART REPLICA of a random replicated table.
  • New stop/start pairs: CLEANUP, PULLING REPLICATION LOG, and LISTEN for the protocols other than TCP and HTTP, which clickhouse-test and the hung check use. prepare_for_hung_check starts all of them again.

A failing disruption is logged instead of ending the disruptor thread. The databases in KEEP_DATABASES are never touched.

Every statement was run against a local server (all of them also exist in 26.3), and the loop ran under a small load; it was not run in CI yet.

Changelog category (leave one):

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

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.1890-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3ddd251]

Summary: ✅


AI Review

Summary

Adds cache drops, dictionary/view operations, replica restarts, additional background pauses, and fault injection to the stress workload. Request changes: failed replica recovery can still silently remove tables from the workload. Reviewed commit 3ddd25195476a6a488180f5a13327f3c86287ed4; the checkout has the same tree.

Missing context / blind spots
  • ⚠️ Current-head stress execution could not be verified: the CI helper returned workflow-level data with zero stress cases, and the direct amd_debug stress report was unavailable. A completed stress report for the reviewed SHA would close this gap, alongside the focused recovery check above.
Findings

⚠️ Majors

  • Replica recovery must restore the target or fail the harness. ci/jobs/scripts/stress/stress.py:488 [dismissed by author -- https://github.com/More random disruptions in the stress test #129515#discussion_r4515535616]. The recovery loop attempts ATTACH TABLE once and discards failure. A restart cancelled after detachTable can leave the original storage in use; the recovery statement then waits in InterpreterCreateQuery before attaching and can itself time out or be cancelled. Transient allocation/thread failures can also prevent attachment. Nothing retains the unresolved target or fails the job, and subsequent selection from system.replicas cannot rediscover a detached table. Consequently, a temporary disruption can suppress successful workload execution for the remainder of the run while the stress job passes. The author's silent resolution does not address failed recovery attempts. Retain and verify pending restores with a bounded deadline and fail the harness on unresolved targets, or remove replica-restart disruptions until recovery is reliable.
Tests
  • ⚠️ Provide a focused failed-restart check where the table is detached and the first recovery attempt fails before attachment. Cover both restart branches and establish that the table becomes usable again or the harness reports failure. Source tracing establishes the unchecked failure path; it was not reproduced against a live server during this review.
Final Verdict

⚠️ Request changes. Make failed replica recovery observable and bounded, and demonstrate that a failed recovery attempt cannot silently remove workload tables. This repeats an existing concern in the summary only; no duplicate inline comment was posted.

Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 5, 2026
Comment thread ci/jobs/scripts/stress/stress.py Resolved
@rahulmalik87

Copy link
Copy Markdown
Contributor

@PedroTadim when a new branch turns out to be too noisy or hides a real failure behind constant Keeper session loss, the only remedy today is to disable the entire disruptor or edit the script. A --disruptions=kill_query,drop_cache,... option, or at least a module-level tuple that the job can override through an environment variable, would let someone bisect which disruption caused a flaky report without a code change. The help text of --no-random-disruptor also still says "query/client/mutation kills, merge pauses" and should list the new categories.

@PedroTadim

Copy link
Copy Markdown
Member Author

🕵️ @rahulmalik87 Every action the disruptor takes is already logged, with a timestamp, in the stress job's log: Killing random query: <id>, SYSTEM STOP MERGES, resuming in 4.2s, SYSTEM DROP MARK CACHE, SYSTEM RESTART REPLICA db.t, and so on, plus Random disruption <name> failed: ... when one throws. The statements also land in query_log, since they run through clickhouse client. So a flaky report can be matched against the disruptions that ran just before it without changing any code, and --no-random-disruptor still turns the whole thing off. A per-disruption filter would be a separate change. The help text now lists the new categories (201d78a).

@PedroTadim

Copy link
Copy Markdown
Member Author

The CI failure is unrelated and already fixed. One more merge with master

Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Extend the stress test's random disruptor beyond killing queries, clients and
mutations and pausing background operations: drop a random cache, run a one-shot
server statement (`RECONNECT ZOOKEEPER`, `RESTART REPLICAS`, `UNLOAD DICTIONARIES`,
`RELOAD FUNCTIONS`/`RELOAD USERS`, `FLUSH ASYNC INSERT QUEUE`, `JEMALLOC PURGE`,
`REFRESH ALL BACKGROUND`), reload a random dictionary, refresh or cancel a random
refreshable view, and restart a random replica - re-attaching any table a failed
`SYSTEM RESTART REPLICA` leaves detached (and leaving it to `prepare_for_hung_check`
once shutting down).

In `stress_runner.sh`, randomly inject `S3Queue` Keeper faults (via the default
profile, which the global context reads at startup) and `ReplicatedMergeTree`
part-commit Keeper faults, writing the randomized config files with
`echo ... | sudo tee` so the redirect runs as root.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@PedroTadim
PedroTadim force-pushed the stress-more-disruptions branch from 3a5a13d to 36eedac Compare November 10, 2026 13:11
@PedroTadim

Copy link
Copy Markdown
Member Author

One more CI run, then merging into master

@PedroTadim
PedroTadim enabled auto-merge November 10, 2026 16:25
@PedroTadim
PedroTadim added this pull request to the merge queue Nov 10, 2026
Merged via the queue into master with commit 7565855 Nov 10, 2026
188 checks passed
@PedroTadim
PedroTadim deleted the stress-more-disruptions branch November 10, 2026 19:14
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 10, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 15, 2026
The random disruptor's `SYSTEM RESTART REPLICA <table>` and `SYSTEM RESTART
REPLICAS` can fail in `doRestartReplica` after the table is detached, for
example with `UNKNOWN_AGGREGATE_FUNCTION` when re-creating a table whose
columns need a setting the disruptor's client does not enable, or with
`TIMEOUT_EXCEEDED` in `waitDetachedTableNotInUse`. That throw is outside the
`try` that adjusts the `DatabaseReplicated` metadata digest, so the digest
stays stale and the next digest check fails with `Digest does not match`.
`RESTART REPLICAS` runs the same `doRestartReplica` for every table.

The other disruptions added in ClickHouse#129515 stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
m7kss1 pushed a commit to m7kss1/ClickHouse that referenced this pull request Nov 22, 2026
…e its definition

`doRestartReplica` detached the table, waited for it to become unused, and only then
ran `getColumnsDescription` / `getConstraintsDescription`. The latter evaluates a
constraint's scalar subquery, so a constraint reading a missing table (or one being
restarted at the same time, `TABLE_IS_BEING_RESTARTED`) threw before the `try` block
that retries re-creation and adjusts the `DatabaseReplicated` digest. The table then
disappeared from the database until server restart.

Analyze the stored definition before the table is shut down, outside the exclusive
lock (the subquery may need to lock a table that is being restarted); the table's DDL
guard, held for the whole restart, keeps the definition from changing until the
detach. Move `waitDetachedTableNotInUse` into the `try` block so a kill during the
wait also goes through the digest adjustment.

Related: ClickHouse#129515

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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.

3 participants