Skip to content

Bound 03247 by time and check the CREATE OR REPLACE errors of 03237, 03238, 03247, 03248 - #122662

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:fix-03247-bound-create-or-replace-loop
Oct 4, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
groeneai:fix-03247-bound-create-or-replace-loop

Conversation

@groeneai

@groeneai groeneai commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #73364
Related: #118490

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

Test-only change, no changelog entry required.

Description

03247_create-same-table-concurrently-with-atomic-engine has never passed in Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted): all 8 runs from 2026-09-07 to 2026-09-28 (two code-disjoint PRs) fail Test runs too long (> 180s) at 260-384 s. Every other lane finishes it in under 38 s. The check is required, so this reds every PR whose targeted selection includes the test.

Failing jobs:
https://github.com/ClickHouse/ClickHouse/actions/runs/36387258399/job/108826166989
https://github.com/ClickHouse/ClickHouse/actions/runs/36001665068/job/107660637803

The test runs 20 threads x 20 CREATE OR REPLACE TABLE of one table, serialized on the table name. With database_disk on the plain_rewritable S3 disk of that lane, every metadata commit holds a disk-wide lock across its S3 requests, and each statement holds the database mutex across twelve such commits. Under the targeted check's DDL load a statement costs 0.6-1 s (measured in the failing job's logs).

Each thread now stops after 60 s, as in 03238; elsewhere all 400 statements run. I also dropped > /dev/null from the CREATE OR REPLACE loops of this test and of 03237, 03238, 03248: since aae87258996be, b17a0bc24fd63 and e834d425cd366 moved them to curl, a failing statement (exception text in the HTTP 500 body) could not fail them, e.g. the TABLE_ALREADY_EXISTS collision of #73364. The Replicated ones pass distributed_ddl_output_mode=none (no status row on success); the select loop of 03238 now matches 03237.

Validation on a MinIO database disk at 20 ms RTT: old 419 s and 419 s FAIL (> 180s), new 78 s and 76 s OK. 50/50 randomized runs of each test pass, no statement failing. With a constant temporary-table suffix the new 03247 fails with TABLE_ALREADY_EXISTS while the old one passes with 270 of 400 statements failing; a failing statement injected into the siblings likewise fails the new tests only.

Nine of the twelve commits are no-op createDirectories; not changed here (plain_rewritable locking is being reworked in #118490).


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

Version info

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

…k its errors

03247 runs 20 threads x 20 `CREATE OR REPLACE TABLE` of the same table
over HTTP. The statements are serialized on the table name. With the
database metadata on the plain_rewritable remote disk of the `db disk`
lanes, every metadata commit on that disk takes one disk-wide lock and
holds it across its S3 requests, and each statement holds the database
mutex across twelve such commits. Under the DDL load of the targeted
check each statement then costs 0.6-1 s, so the 400 statements take
260-384 s, over the 180 s limit, in every run of `Stateless tests
(amd_asan_ubsan, db disk, distributed plan, targeted)`, while every other
lane finishes in under 38 s.

Stop each thread after 60 s, as 03238 does. In the other lanes all 400
statements still run.

Also stop discarding the output of the statements. Since aae8725
moved them from clickhouse-client to curl, `> /dev/null` swallowed the
exception text of a failing statement (curl without `--fail` returns it
in the body of the HTTP 500), so the test could no longer catch the
`TABLE_ALREADY_EXISTS` collision of the temporary table names it was
written for (ClickHouse#73364). A successful DDL over HTTP prints nothing.

Failing jobs:
https://github.com/ClickHouse/ClickHouse/actions/runs/36387258399/job/108826166989
https://github.com/ClickHouse/ClickHouse/actions/runs/36001665068/job/107660637803

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus a cold review by a separate reviewer session (1 finding).

# Sev Finding Verdict Evidence / action
1 💡 The description did not say that 03237 lost the same error check in aae87258996be (its create loop) AGREE, fixed in the description One clause added; 03237 itself is unchanged

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20260928-104100

@clickhouse-gh

clickhouse-gh Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7fc460a]

Summary: ✅


AI Review

Summary

This PR bounds 03247 so the db disk targeted lane stops timing out, and restores failure visibility in the CREATE OR REPLACE loops of 03237, 03238, 03247, and 03248. The replicated-output blind spot from the earlier review is fixed, but the new wall-clock cap in 03247 weakens that test's stress coverage on slow environments because it no longer enforces any minimum number of completed operations.

Findings

⚠️ Majors

  • tests/queries/0_stateless/03247_create-same-table-concurrently-with-atomic-engine.sh:11 The new TIMEOUT cap turns 03247 from a fixed 400-operation stress test into a pure wall-clock loop with no floor on completed CREATE OR REPLACE calls. On the slow db disk lane that motivated the change, a future slowdown can now make the test pass after only a small fraction of the original attempts, silently removing most of the concurrency pressure that was supposed to catch TABLE_ALREADY_EXISTS regressions. Keep the 60s cap, but count completed iterations and fail if they drop below a floor.
Final Verdict

Status: ⚠️ Request changes

Minimum required action:

  • Keep the new timeout bound for 03247, but add a minimum completed-iteration assertion so the test cannot silently degrade into a near-no-op on slow lanes.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 28, 2026
@groeneai
groeneai requested a review from tuanpach September 28, 2026 11:17
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 28, 2026
Since aae8725 moved the create loop of 03237 from clickhouse-client
to curl, `> /dev/null` swallowed the exception text of a failing
`CREATE OR REPLACE VIEW` (curl without `--fail` returns it in the body of
the HTTP 500), the same way it did in 03247. A successful DDL over HTTP
prints nothing.

With a syntax error injected into the statement the test now fails with
`having exception in stdout`, while the old one passes. 50 randomized
runs pass on local disks and 50 on an S3 database disk, with all 10050
statements of each set succeeding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Bound the concurrent CREATE OR REPLACE loop of test 03247 by time and check its errors Bound 03247 by time and check the CREATE OR REPLACE errors of 03237 and 03247 Sep 28, 2026
groeneai and others added 2 commits September 28, 2026 17:19
… and 03248

b17a0bc (03238) and e834d42 (03248) moved these `Replicated`
database tests from clickhouse-client to curl and kept `> /dev/null`.
With clickhouse-client that only dropped the DDL status row, because
the exception went to stderr. With curl the exception text is in the
body of the HTTP 500, so a failing statement could no longer fail
either test, the same way 03237 and 03247 went blind.

The `CREATE OR REPLACE` statements now pass
`distributed_ddl_output_mode=none`, so a successful one prints no status
row and a failing one prints its exception. The select loop of 03238
runs `FORMAT NULL` and drops only `UNKNOWN_TABLE` and
`TABLE_UUID_MISMATCH`, as the select loop of 03237 does; they are the
codes of the 12 CI failures of that loop in 2025, while its check was
still live.

With a failing statement injected into a loop, both tests now fail with
`having exception in stdout`, while the old ones pass. 50 randomized
runs of each test pass on a debug and on an ASan build, with every
statement succeeding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Bound 03247 by time and check the CREATE OR REPLACE errors of 03237 and 03247 Bound 03247 by time and check the CREATE OR REPLACE errors of 03237, 03238, 03247, 03248 Sep 28, 2026
$CLICKHOUSE_CLIENT --query "CREATE DATABASE IF NOT EXISTS ${CLICKHOUSE_DATABASE}_db ENGINE=Atomic"

# The statements are serialized on the table name and can take a second each with the database metadata on a remote disk.
export TIMEOUT=60

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.

This fixes the timeout, but it also turns 03247 from a fixed 400-operation stress test into a pure wall-clock loop with no lower bound on work done. On the slow db disk lane that motivated this patch, a future slowdown can now make the test pass after only a small fraction of the original CREATE OR REPLACE attempts, which silently removes most of the concurrency pressure that was catching TABLE_ALREADY_EXISTS regressions. Other time-bounded stateless stress tests usually keep a minimum-iterations assertion for exactly this reason (for example 01171_mv_select_insert_isolation_long.sh).

Could we keep the 60s cap but count completed iterations and fail if they drop below a floor?

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.

@groeneai can check this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I checked it, and a floor would not add coverage here:

  • The $SECONDS check runs after each request, so each of the 20 threads sends at least one CREATE OR REPLACE, and they all start together. The minimum is 20 concurrent statements.
  • That minimum still catches the bug this test was added for. With a constant random_suffix in doCreateOrReplaceTable and TIMEOUT=0 (exactly one statement per thread), the test failed 20 of 20 runs with TABLE_ALREADY_EXISTS, with 12 to 19 of the 20 statements failing in each run. The unmodified build passed 20 of 20.
  • On the slowest lane, Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted), the bound stops each run after 246 to 307 of the 400 statements (67 to 69 s).

A floor above 20 would only fail when the statements get slower, which is the timing failure this PR removes. If you still want one, I'll add it.

@tuanpach tuanpach self-assigned this Sep 29, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 4, 2026
Merged via the queue into ClickHouse:master with commit aed8dba Oct 4, 2026
149 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 4, 2026
@clickhouse-gh clickhouse-gh Bot added comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding 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