Skip to content

More settings and disruptions to randomize in stress tests - #116783

Merged
PedroTadim merged 12 commits into
masterfrom
more-stress-stress
Sep 10, 2026
Merged

PedroTadim merged 12 commits into
masterfrom
more-stress-stress

Conversation

@PedroTadim

@PedroTadim PedroTadim commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

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):

Broaden stress-test coverage by randomizing more session settings per query
and letting the random disruptor pause and resume more background subsystems.


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

Version info

  • Merged into: 26.9.1.1137 (included in 26.9 and later)

@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a29c2df]

Summary: ✅


AI Review

Summary

This PR broadens the stress worker by randomizing more session settings and by letting the disruptor stop and restart more background subsystems. Several of those new worker-wide knobs still invalidate existing test contracts instead of adding orthogonal coverage, so I do not think the generic stress worker is safe to merge in its current form.

Findings

❌ Blockers

  • [ci/jobs/scripts/stress/stress.py:485-488] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3944926834] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3879763820] Worker-wide cast_keep_nullable=1 and aggregate_functions_null_for_empty=1 rewrite baseline SQL semantics that existing stateless tests still rely on. tests/queries/0_stateless/04212_cast_datetime_keep_timezone.sql:33 expects CAST(Nullable(DateTime), 'DateTime') to stay non-nullable, and tests/queries/0_stateless/02016_agg_empty_result_bug_28880.sql:7 expects sum(dummy) over an empty input to compare equal to 0; both assertions fail before the test-specific SET statements can restore the default. Suggested fix: keep these settings out of the generic worker, or add a dedicated opt-out surface for tests that depend on the default CAST / empty-aggregate behavior.
  • [ci/jobs/scripts/stress/stress.py:509-511] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3904158519] serialize_query_plan=1 is still rejected for custom-key parallel replicas in src/Interpreters/ClusterProxy/executeQuery.cpp:1311-1313. Tests such as tests/queries/0_stateless/02898_parallel_replicas_custom_key_final.sql:8-18 and tests/queries/0_stateless/02918_parallel_replicas_custom_key_unavailable_replica.sql:14-31 enable custom-key replicas without forcing serialize_query_plan=0, so this branch turns them into deterministic NOT_IMPLEMENTED failures instead of extra stress signal. Suggested fix: keep serialized plans off in the generic parallel-replicas worker, or scope this branch to a worker that excludes custom-key tests.
  • [ci/jobs/scripts/stress/stress.py:544-545] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3913087429] apply_mutations_on_fly=1 changes the entry contract for transactions: src/Interpreters/executeQuery.cpp:3098-3105 rejects any query inside a transaction when that setting is enabled. As a result, tests/queries/0_stateless/02345_implicit_transaction.sql:23-36 and tests/queries/0_stateless/04057_transaction_version_metadata_lifecycle.sql:24-32 stop exercising transactional behavior and fail immediately at the front door. Suggested fix: keep this setting out of the generic worker, or run it only in a worker that excludes transaction coverage.
  • [ci/jobs/scripts/stress/stress.py:559-572] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3879763824] The rare alter_update_mode='lightweight_force' branch is not just a different execution path: src/Interpreters/InterpreterAlterQuery.cpp:301-330 throws before the storage mutation path whenever supportsLightweightUpdate() is false. tests/queries/0_stateless/02577_keepermap_delete_update.sql:30-38 currently exercises KeeperMap::mutate, but under this worker-wide mode it fails with SUPPORT_IS_DISABLED before the engine code runs. Suggested fix: randomize only the non-throwing lightweight mode here, or isolate lightweight_force to a worker that runs only lightweight-update-capable tables.
  • [ci/jobs/scripts/stress/stress.py:463-471] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3956363902] create_replicated_merge_tree_fault_injection_probability=0.1 injects a plain Keeper exception into ordinary CREATE TABLE ... ReplicatedMergeTree with no harness retry layer. tests/queries/0_stateless/04337_quorum_insert_honors_time_limit.sql:29-32 creates four replicated tables before it reaches the quorum assertion, so the generic worker now fails setup for reasons unrelated to the test roughly 10% of the time per CREATE. Suggested fix: keep this fault injector out of the shared worker, or move it to a worker that retries CREATE / runs only tests prepared for injected create failures.
  • [ci/jobs/scripts/stress/stress.py:547-549] query_metric_log_interval=100 changes a default that tests/queries/0_stateless/03203_system_query_metric_log.sh still uses as part of the assertion. Its first query at line 13 intentionally leaves the interval at the default, and check_log 1000 at lines 83-85 validates the 1000 ms case; the worker-wide override makes that query emit roughly 10x more system.query_metric_log rows than the test allows. Suggested fix: keep this setting out of the generic worker, or add an opt-out surface for tests that assert the default query-metric cadence.
  • [ci/jobs/scripts/stress/stress.py:91-94] [dismissed by author -- https://github.com/More settings and disruptions to randomize in stress tests #116783#discussion_r3956363891] The new unscoped SYSTEM START FETCHES / START DISTRIBUTED SENDS / START REPLICATED SENDS / START REPLICATION QUEUES can silently undo a test's own table-scoped stop mid-test. tests/queries/0_stateless/04337_quorum_insert_honors_time_limit.sql:34-41, tests/queries/0_stateless/01099_parallel_distributed_insert_select.sql:69-78, and tests/queries/0_stateless/04838_truncate_does_not_block_ddl.sh:11-18 all rely on the stopped subsystem staying stopped until the assertion runs. Suggested fix: keep these pairs out of the generic disruptor, or only enable them in a worker that excludes tests managing the same subsystem themselves.
Final Verdict

Changes requested. The generic stress worker still mixes in several settings and disruptor actions that invalidate existing coverage or cause deterministic front-door failures, so the PR does not yet meet the promised “broader stress coverage” contract.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 27, 2026
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
alexey-milovidov pushed a commit to amosbird/ClickHouse that referenced this pull request Sep 2, 2026
…ranularity for non-adaptive parts

A non-adaptive data part stores no per-mark row counts on disk: its mark
file holds only the two offsets per mark, so the rows per granule have to
be reconstructed when the part is loaded, and they are reconstructed from
the READING table's `index_granularity`.

`MergeTreeData::canReplacePartition` is the only compatibility gate on the
partition-manipulation path, and it compared mark adaptivity only. With
both tables non-adaptive (`index_granularity_bytes = 0`) neither adaptivity
branch fires, so a part written at `index_granularity = N` was admitted
into a table declared with `index_granularity = M != N`.
`MergeTreeDataPartWide::loadIndexGranularityImpl` then paired the source's
mark offsets with the destination's rows per mark, mapping every mark to
the wrong row range.

Observable consequences, both measured on 8627fa2:

- Release build: the part attaches and the table disagrees with itself.
  For 18 rows moved from `index_granularity = 8` into
  `index_granularity = 4`, `SELECT count() FROM t WHERE <primary key
  condition>` returned 10; in the other direction (4 into 8) it returned
  24, while `SELECT count() FROM t` returned the correct 18.
- Debug and sanitizer builds: the consistency check in
  `IMergeTreeDataPart::loadRowsCount` throws `LOGICAL_ERROR`, which those
  builds turn into a server abort.

The new condition is placed outside the `enable_mixed_granularity_parts`
block on purpose: a destination that accepts mixed granularity still
reinterprets a non-adaptive part, because `changeGranularityIfRequired`
clears `mark_type.adaptive` and `index_granularity_bytes` from the
filesystem but leaves `fixed_index_granularity` at the destination's
value. That case was measured to abort on master too, and it is the only
arm of the new test that distinguishes this placement from putting the
check inside the block.

Comparing against the source part's own `fixed_index_granularity` is
sound because `index_granularity` is read-only after table creation
(`MergeTreeSettings::isReadonlySetting`, enforced as `READONLY_SETTING`
in `MergeTreeData::checkAlterIsPossible`), so for any part the source
table wrote itself the setting is the value the part was written with.

`MergeTreeDataPartCompact` needs no equivalent guard: a Compact part is
always adaptive and its marks record per-granule row counts, so nothing is
reconstructed. Verified that a non-adaptive table cannot write a Compact
part even with `min_bytes_for_wide_part` and `min_rows_for_wide_part` set
to 1e9.

The condition only ever adds rejections, so it cannot make a previously
rejected operation succeed. Previously accepted DDL now errors with
`BAD_ARGUMENTS`; the accepted cases produced a part whose marks map to the
wrong rows unless the partition fitted in a single granule.

The new test arms live in the existing
`04150_move_partition_inconsistent_granularity`, which carries
`no-shared-merge-tree`: in Cloud `ReplicatedMergeTree` is substituted by
`SharedMergeTree`, whose partition-move path does not call
`canReplacePartition`. Dropping that tag is what got ClickHouse#103881 reverted.

The arms cover both directions of the mismatch and all of
`REPLACE`/`MOVE`/`ATTACH PARTITION FROM`, so a one-sided comparison does
not satisfy them. `r_src_nonadaptive` pins `index_granularity = 8192`,
its default, because `clickhouse-test` otherwise injects a random value
as the CREATE TABLE default and a draw equal to the destination's 4096
would remove that arm's expected rejection.

One arm asserts an acceptance instead: an adaptive source part at a
different `index_granularity` is still admitted, because its marks carry
per-granule row counts and the destination's setting never enters their
interpretation. It pins the scope of the new condition, so dropping the
`!adaptive` conjunct would be caught by the test rather than silently
rejecting a valid transfer. That arm pins its source part to the `Wide`
format, which is the format whose granularity load path holds the defect,
and without which restating the conjunct as a `Wide` part-type test would
also pass.

Reported and root-caused by Pedro Ferreira.

Found by the server-side AST fuzzer under Stress test (arm_debug) on
ClickHouse#116783 :
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116783&sha=dd8310bb0d928a3aa50822f052cc835cf86efac0&name_0=PR&name_1=Stress%20test%20%28arm_debug%29

Closes ClickHouse#117524
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
@PedroTadim PedroTadim changed the title More settings to randomize in stress tests More settings and disruptions to randomize in stress tests Sep 8, 2026

if random.random() < 0.2:
# Collect per-query metrics every 100ms instead of the default 1000ms.
client_options.append("query_metric_log_interval=100")

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.

query_metric_log_interval=100 changes a default that existing stateless tests still rely on. tests/queries/0_stateless/03203_system_query_metric_log.sh:13-17 intentionally leaves the first sleep(2.5) query at the default interval, then validates it as the 1000-ms case in check_log 1000 at lines 83-85. With this worker-wide client option that query now emits roughly 10x more system.query_metric_log rows than the test's upper bound allows, and clickhouse-test has no feature-tag override for query_metric_log_interval analogous to no-async-insert / no-parallel-replicas.

Can we keep this setting out of the generic stress worker, or add a dedicated opt-out surface for tests that assert the default metric-log cadence?

@clickhouse-gh

clickhouse-gh Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

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

no significant changes detected. K_source=6 K_base=30 flagged=0/65

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 7e8b224f-d7e0-4ce4-919c-40a6c53e3f5e
  • MIRAI run: af3cfbae-7ae7-4294-9e26-bbbefa5c5fa0
  • PR check IDs:
    • clickbench_57730_1788892410
    • clickbench_57736_1788892410
    • clickbench_57742_1788892410
    • tpch_adapted_1_official_57753_1788892410
    • tpch_adapted_1_official_57787_1788892410
    • tpch_adapted_1_official_57801_1788892410

@zlareb1 zlareb1 self-assigned this Sep 9, 2026

@rahulmalik87 rahulmalik87 left a comment

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.

LGTM

Comment thread ci/jobs/scripts/stress/stress.py Resolved
Comment thread ci/jobs/scripts/stress/stress.py Resolved
# coordination step can draw a fault, exercising the retry and dedup logic.
# users.d/insert_keeper_retries.xml already sets 0.01 server-wide, so only a higher
# value adds anything here; it also raises insert_keeper_max_retries to 100.
client_options.append("insert_keeper_fault_injection_probability=0.05")

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.

maybe increased to 0.1?

Comment thread ci/jobs/scripts/stress/stress.py Outdated
# znodes. This one throws instead of retrying, and a CREATE is far rarer than an INSERT
# commit, so it gets a higher probability than the two above but stays low.
client_options.append(
"create_replicated_merge_tree_fault_injection_probability=0.01"

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.

probability too low. is it failing?

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.

we can tune later :-)

@qoega
qoega added this pull request to the merge queue Sep 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 9, 2026
@PedroTadim
PedroTadim added this pull request to the merge queue Sep 10, 2026
Merged via the queue into master with commit ec039ba Sep 10, 2026
174 checks passed
@PedroTadim
PedroTadim deleted the more-stress-stress branch September 10, 2026 14:19
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 10, 2026
pull Bot pushed a commit to Dream-hu/ClickHouse that referenced this pull request Sep 11, 2026
… load

Upgrade check (amd_release) runs on every pull request and began losing its
server on roughly one run in five on 2026-09-11: 24 of 126 shas that day
carried 'Got read request from replica 0 for unknown stream ...'
(ParallelReplicasReadingCoordinator.cpp:1316), against 0 of 3457 shas over the
preceding twelve days. The abort kills the server, so the job reports
"Server died" and loses every remaining assertion in it.

The cause is a harness change, not an engine change. ClickHouse#116783 added a nested
serialize_query_plan=1 draw inside the stress option generator's
parallel-replicas arm without the 'not upgrade_check' guard its sibling arms
carry. The upgrade check's only test load runs against the previous release
server, resolved at run time (currently v26.8.2.7), and that shipped binary
aborts on the serialized-plan parallel-replicas path. Because the defect is in
a released binary, no change to master can clear it from this job, which is
what makes the red permanent rather than a bug report.

The same option on a current build is not implicated: over 09-04 to 09-11
Stress test (*), which gets the identical arm at the identical probability
against the PR's own build, produced 0 to 1 affected shas per day out of 259
to 483, and the signature has no true-master occurrences in 30 days. So the
guard is added rather than the arm removed: classic parallel-replicas coverage
in the upgrade check is preserved, and serialize_query_plan coverage continues
in every Stress test flavour, where a failure names a fixable defect.

This matches the convention used seven times in the same function, including
the enable_cascades_optimizer arm ClickHouse#116783 itself added for the same reason.

Verified by executing get_options 4000 times per condition: under
upgrade_check, serialize_query_plan goes from 388 to 0, while
enable_parallel_replicas stays at 820, confirming the guard did not land on
the outer draw, and the upgrade_check=False counts are unchanged.

Related: ClickHouse#118093
Related: ClickHouse#119372
Related: ClickHouse#110518

Co-Authored-By: Claude Opus 5 <[email protected]>
protomn pushed a commit to protomn/ClickHouse that referenced this pull request Sep 13, 2026
…ade load

Since ClickHouse#116783 the stress randomization enables `cast_keep_nullable = 1` in a third
of the runs, and, unlike its sibling arms, without the `not upgrade_check` guard.
The upgrade check runs that load against the previous release's server (26.8.2.7),
which predates ClickHouse#119385: it matches the sorting key `CAST(json.b, 'String')` to the
same expression in `ORDER BY` by name and arity only, although under
`cast_keep_nullable = 1` the query types it `Nullable(String)` while the key is
`String`. Read-in-order with `read_in_order_use_virtual_row = 1` then aborts the
shipped 26.8 server in `setVirtualRow` with `Logical error: Virtual row has
different type` while running `03277_json_subcolumns_in_primary_key`, so
`Upgrade check (amd_release)` went red on dozens of unrelated pull requests
(57 on 2026-09-11, 23 on 2026-09-12, 7 on 2026-09-13). A master fix cannot clear it,
because the exception is raised by the old binary. Guard the arm like the sibling
`serialize_query_plan` arm (5620afa).

CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99495&sha=c84da07b7cc18cc399ef06b7fc656f99a72b713a&name_0=PR&name_1=Upgrade%20check%20(amd_release)
PR: ClickHouse#99495

Co-Authored-By: Claude Fable 5.1 <[email protected]>
antonkovalenko pushed a commit that referenced this pull request Sep 13, 2026
…ade load

Since #116783 the stress randomization enables `cast_keep_nullable = 1` in a third
of the runs, and, unlike its sibling arms, without the `not upgrade_check` guard.
The upgrade check runs that load against the previous release's server (26.8.2.7),
which predates #119385: it matches the sorting key `CAST(json.b, 'String')` to the
same expression in `ORDER BY` by name and arity only, although under
`cast_keep_nullable = 1` the query types it `Nullable(String)` while the key is
`String`. Read-in-order with `read_in_order_use_virtual_row = 1` then aborts the
shipped 26.8 server in `setVirtualRow` with `Logical error: Virtual row has
different type` while running `03277_json_subcolumns_in_primary_key`, so
`Upgrade check (amd_release)` went red on dozens of unrelated pull requests
(57 on 2026-09-11, 23 on 2026-09-12, 7 on 2026-09-13). A master fix cannot clear it,
because the exception is raised by the old binary. Guard the arm like the sibling
`serialize_query_plan` arm (5620afa).

CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=99495&sha=c84da07b7cc18cc399ef06b7fc656f99a72b713a&name_0=PR&name_1=Upgrade%20check%20(amd_release)
PR: #99495

Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 6b1566c)
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Oct 10, 2026
…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]>
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.

5 participants