Skip to content

Speed up the slowest sequential tests in the fast test - #122921

Merged
Algunenano merged 6 commits into
ClickHouse:masterfrom
Algunenano:speed-up-slow-sequential-tests
Oct 2, 2026
Merged

Algunenano merged 6 commits into
ClickHouse:masterfrom
Algunenano:speed-up-slow-sequential-tests

Conversation

@Algunenano

@Algunenano Algunenano commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Related: #122913

These were the four slowest no-parallel tests in the fast test that don't use failpoints. no-parallel tests run one by one after the parallel ones, so together they took about 51s of wall time.

  • 03300_ai_functions (12s to 1s): the calls to localhost:1 fail at once but waited 1s of retry backoff each. Set ai_function_retry_initial_delay_ms = 0. It keeps no-parallel, since named collection names can't be made unique in a .sql test.
  • 04659_connection_pool_zero_wait_blocks (19s sequential to parallel): the remote connections use a user of their own, so concurrent runs get separate pools.
  • 04319_system_stop_all_background (11s to 8s) and 04105_system_pause_view (10s to 7s), both now parallel: the server-wide SYSTEM ... ALL BACKGROUND / SYSTEM PAUSE VIEWS statements skip views the caller can't control, so they run as a user granted only on the test database.

Changelog category (leave one):

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

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

Version info

  • Merged into: 26.10.1.1261-master (included in 26.10 and later)

Algunenano and others added 4 commits September 29, 2026 16:29
The calls to `localhost:1` fail at once, but each one waited `ai_function_retry_initial_delay_ms` (1s) before its retry. That was 10 of the test's 12 seconds, run sequentially in the fast test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… less

Give the remote connections a user of their own, so concurrent runs get separate pools and the test no longer needs `no-parallel`. Poll `text_log` for the pool wait instead of sleeping 2s, and lower the soft time limit from 5s to 2s. It took 19s in the sequential phase of the fast test; now about 11s in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `SYSTEM ... ALL BACKGROUND` wildcard skips tables the caller may not control, so running it as a user granted only on the test database keeps it off the views of concurrent tests, and `no-parallel` is no longer needed. Test 1 refreshes 2 rows instead of 5. It took 11s in the sequential phase of the fast test; now about 8s in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`SYSTEM PAUSE VIEWS` and `SYSTEM START VIEWS` skip views the caller may not control, so running them as a user granted only on the test database keeps them off the views of concurrent tests, and `no-parallel` is no longer needed. Test 1 refreshes 2 rows instead of 5. It took 10s in the sequential phase of the fast test; now about 7s in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Algunenano Algunenano added the 🚀 Fast CI 🥒 A fast database deserves a fast CI label Sep 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1f1d3a9]

Summary: ✅


AI Review

Summary

This PR parallelizes three formerly sequential fast-test cases and trims two retry / wait windows to cut wall time. The speedup itself looks reasonable, but the current patch still weakens the two pause does not cancel assertions and still does not pin the privilege-filter contracts that now justify removing no-parallel, so I cannot approve it as-is.

Findings

⚠️ Majors

  • [tests/queries/0_stateless/04105_system_pause_view.sh:44] [dismissed by author -- https://github.com/Speed up the slowest sequential tests in the fast test #122921#discussion_r4136317358] After shrinking the refresh from five 1-second rows to two, this arm still waits only for status = 'Running' before issuing SYSTEM PAUSE VIEW. The helper comment at tests/queries/0_stateless/04105_system_pause_view.sh:25 already explains that Running flips before execution reads any rows, so a slow runner can complete the two-row refresh before the pause arrives and the arm still passes. That means the test no longer proves the contract it claims to cover: that PAUSE leaves an in-flight refresh alone. Suggested fix: keep a longer refresh window or wait for read_rows > 0 before pausing.
  • [tests/queries/0_stateless/04319_system_stop_all_background.sh:41] [dismissed by author -- https://github.com/Speed up the slowest sequential tests in the fast test #122921#discussion_r4142431027] This file makes the same reduction from five rows to two while still synchronizing Test 1 on status = 'Running' only. The shortened window is now small enough that SYSTEM PAUSE p can land after the refresh has already completed, so the arm can pass even if PAUSE would interrupt an actually in-flight refresh. Suggested fix: mirror the stronger wait_running_with_progress synchronization used later in the file or keep the longer fixture.
  • [tests/queries/0_stateless/04105_system_pause_view.sh:161] [dismissed by author -- https://github.com/Speed up the slowest sequential tests in the fast test #122921#discussion_r4136317350] Removing no-parallel here depends on wildcard SYSTEM PAUSE VIEWS / SYSTEM START VIEWS skipping objects outside the caller's grant set, but the file still never asserts that wildcard privilege filter. The only access-control coverage below is for a named view, so a regression in the wildcard fan-out can reintroduce cross-test interference while every local assertion still passes. Suggested fix: add a partial-grant arm that authorizes one view, withholds another, and checks that wildcard pause/start touches only the authorized one.
  • [tests/queries/0_stateless/04319_system_stop_all_background.sh:213] [dismissed by author -- https://github.com/Speed up the slowest sequential tests in the fast test #122921#discussion_r4142431036] Parallel safety in this file now also depends on SYSTEM REFRESH ALL BACKGROUND / SYSTEM CANCEL ALL BACKGROUND being privilege-filtered when run as $db_user, but Test 10 still covers only SYSTEM STOP ALL BACKGROUND. REFRESH and CANCEL use different accessibility helpers from STOP, so a regression there can again let this file affect other tests while the current assertions stay green. Suggested fix: extend the partial-privilege arm to cover at least one of the REFRESH ALL BACKGROUND or CANCEL ALL BACKGROUND paths.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Strengthen the two pause allows current refresh to complete arms so they synchronize on actual progress instead of status = 'Running' after the fixture was shortened.
    • Add partial-privilege coverage for the wildcard commands that now justify removing no-parallel, especially SYSTEM PAUSE/START VIEWS and at least one of SYSTEM REFRESH/CANCEL ALL BACKGROUND.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 29, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 29, 2026
Polling `text_log` was too slow in sanitizer builds with s3 storage: `SYSTEM FLUSH LOGS` took up to 27s, so the holder or the waiter ran out of time before the wait was observed. Keep only the test's own user, which is what lets it run in parallel.

ClickHouse/clickhouse-private#78269

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Algunenano
Algunenano added this pull request to the merge queue Oct 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@Algunenano
Algunenano added this pull request to the merge queue Oct 1, 2026
@Algunenano
Algunenano removed this pull request from the merge queue due to a manual request Oct 1, 2026
@Algunenano

Copy link
Copy Markdown
Member Author

It seems 04659_connection_pool_zero_wait_blocks failed in the MQ. I'll review what happened

The waiter was started once the holder showed up in `system.processes`, which is before the holder
gets its connection, so under load the waiter could take the connection first and never wait. Wait
for the holder's remote query instead.

Copies running together have their `max_execution_time` cancellations applied one query at a time,
each taking up to a second, so the soft limit arm could run past its 12 second bound. Raise the bound
to 40 seconds and the holder's hold to 50.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=gh-readonly-queue/master/pr-122921-dbd6bae5d41d3720fcc4af628e121f089ec097e3&sha=4f4841817f1b9886894ba3c50349a5c83c3a6922&name_0=MergeQueueCI&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
PR: ClickHouse#122921

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Algunenano
Algunenano added this pull request to the merge queue Oct 2, 2026
Merged via the queue into ClickHouse:master with commit b92e740 Oct 2, 2026
149 checks passed
@Algunenano
Algunenano deleted the speed-up-slow-sequential-tests branch October 2, 2026 06:36
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-testing Test content only (no production code). 🚀 Fast CI 🥒 A fast database deserves a fast CI 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.

2 participants