Skip to content

Remove recently added cancellation tests, they are flaky - #114061

Merged
PedroTadim merged 1 commit into
masterfrom
remove-cancelation-tests
Aug 10, 2026
Merged

PedroTadim merged 1 commit into
masterfrom
remove-cancelation-tests

Conversation

@PedroTadim

@PedroTadim PedroTadim commented Aug 9, 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):

Version info

  • Merged into: 26.8.1.1071 (included in 26.8 and later)

@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d5bc955]

Summary: ❌

job_name test_name status info comment
Stress test (arm_asan_ubsan) FAIL
Sanitizer (STID: 1740-3504) FAIL cidb IGNORED

AI Review

Summary

This PR removes seven recently added stateless regression suites that were the only focused coverage I could find for several cancellation contracts: in-function deadline handling in replace* / countSubstrings* / countMatches*, mid-block AsyncInsertFlush timeouts, cancellation during remote() connect retry, and QueryStatus binding/leakage for persisted expressions. I do not see deterministic replacement coverage elsewhere in the tree, so the change converts recent bug fixes into untested behavior rather than fixing the flakiness itself.

Missing context / blind spots
  • ⚠️ The PR body does not link a failing CI report or issue showing why each deleted suite is unsalvageable, so I could not validate whether these tests are inherently flaky or just need narrower fixtures.
Findings

⚠️ Majors

  • [tests/queries/0_stateless/04650_replace_cancellation.sh:12] Together with 04722_count_substrings_cancellation.sh and 04822_count_matches_cancellation.sh, this removes the only focused regression coverage that replaceRegexpAll / replaceRegexpOne / replaceAll, countSubstrings*, and countMatches* honor max_execution_time or KILL QUERY inside their own loops. Existing tests for these functions are result-only, so future late-cancellation regressions would stop being caught.
    Suggested fix: keep a reduced deterministic regression per function family, or replace these timing-heavy suites with a less timing-sensitive oracle.
  • [tests/queries/0_stateless/04652_async_insert_flush_cancellation_inside_block.sh:3] 04547_async_insert_flush_cancellation.sh only covers the failpoint + KILL QUERY path after the flush is already parked inside the executor. Removing this companion leaves no test that an AsyncInsertFlush honors max_execution_time while still parsing a single block.
    Suggested fix: keep this coverage or replace it with a deterministic in-block timeout test.
  • [tests/queries/0_stateless/04652_distributed_connect_retry_cancellation.sh:12] This is the only focused regression test for cancellation inside the remote() connect-retry loop and its terminal-failure path. Other distributed tests do not distinguish timeout/cancellation from exhausting retries and surfacing ALL_CONNECTION_TRIES_FAILED.
    Suggested fix: preserve a dedicated timeout / cancellation regression for the connect-retry loop, even if the fixture changes.
  • [tests/queries/0_stateless/04752_persisted_expression_cancellation.sh:12] This file is the only regression suite asserting that persisted expressions in table metadata (PARTITION BY, ORDER BY, skip indexes) resolve QueryStatus against the executing query rather than the DDL/global context, and that the captured state is released afterwards (QueryNonInternal leak check). Direct-call cancellation tests do not cover this metadata-carried path.
    Suggested fix: preserve at least one deterministic persisted-expression regression plus the leak assertion.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
  1. Keep or replace the unique regression coverage for the four cancellation contracts above.
  2. If any suite really must be removed immediately, link the failing CI evidence and add a deterministic follow-up test in the same PR or a clearly tracked follow-up.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 9, 2026
@PedroTadim
PedroTadim enabled auto-merge August 9, 2026 18:27
@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

I wrote these seven tests, and I agree with removing them.

Measured over the last 30 days, excluding flaky-check jobs, they produced 76 failures across 42 pull requests, 26 of them by other authors, plus 3 master runs. The two worst are 04648_geohashes_in_box_cancellation (29 failures, 24 pull requests) and 04650_replace_cancellation (17 failures, 10 pull requests).

One correction to what I argued on #113943. I attributed the 04752_persisted_expression_cancellation failures to a test-oracle bug (grep -o -m1 is line-limited rather than match-limited, so a doubled token on one line emits a third output line) rather than to flakiness. That bug is real, but it was not the whole story: 04752 failed again on 2026-08-08 with arrayfold_orderby: OVERSHOT 4258ms past a 1000ms limit on a non-sanitizer build whose bound is 4000 ms, which is a latency flake and not the oracle. Your premise holds.

The AI review here asks you to keep replacement coverage. I am not asking for that. If you want a guard for any of these contracts later, tell me the shape you would accept and I will write it then.

@groeneai groeneai mentioned this pull request Aug 9, 2026
1 task done
@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing d5bc95515 with master 9b6a2d734 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of c6e7a37d7; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 690.65 MiB 687.63 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 3 s compile time in total, 6 of them have a recent master baseline.

Job report

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 9, 2026
`countSubstringsCaseInsensitiveUTF8` ignored `max_execution_time` and `KILL QUERY` for the
duration of one substring search: a one-second deadline was observed after 13.4 s, and
`KILL QUERY SYNC` blocked 53 s on a 400 MB value. The checkpoint added in ClickHouse#113369 is charged
between searches, and `vectorConstant` searches a whole block in one call, so many ordinary
rows in which the needle does not occur reproduce it as readily as one large value.

Nothing under `src/Common` checked cancellation, and one searcher is slow enough to matter: on
that shape the case-sensitive scan takes 0.19 s and the ASCII case-insensitive one 0.77 s,
while `UTF8CaseInsensitiveStringSearcher` takes 13.6 s, folding a code point at a time through
`Poco::Unicode::toLower`.

The scanning loops now take an optional charger callback, modelled on the one `encodeBase58`
already takes, and `CountSubstringsImpl` binds one to the `CancellationBudget` it builds per
call. Three properties are load-bearing: comparison work is charged rather than distance
covered, since a candidate can walk the whole needle before failing; the accumulator lives in
the caller, because `vectorVector` builds a searcher per row; and both build paths carry it,
since `Volnitsky.h` gates `use_fallback_searcher` on `__AVX2__`. A caller passing no charger
gets its own instantiation of the loop and pays nothing. Realigning after a skipped window is
itself a loop over a continuation run that can span the haystack, so it is bounded per
iteration; stopping mid-run is safe because a continuation byte begins no match.

No returned value changes: the range passed to `search` is untouched, so no chunk edge exists.

The test asserts results rather than latency. Charging runs on the matching path, so it can
drop, duplicate or misplace an occurrence, and that is observable without a clock: all three
functions over both dispatch branches, start positions, empty haystack and needle, folding
between code points whose lowercase differs in byte length, and five cases in which a run of
continuation bytes long enough to skip a whole window is followed by a match that must still
be found. Each of those five is paired with the case-sensitive count as an oracle that does
not go through this searcher, and advancing one byte past the realignment changes all five and
none of the others.

An earlier revision bounded elapsed time instead. It failed 22 CI runs out of 22: on the
thread sanitizer the machine is about ten times slower, three arms overran, and the control
meant to finish well under a one-second deadline took 12027 ms, leaking its TIMEOUT_EXCEEDED
into the server log. No bound survives the build matrix, since one high enough for the
sanitizer sits above the unfixed side on release. ClickHouse#114061 removes seven earlier tests of that
shape for the same reason. Cancellation promptness is therefore left unpinned.

`position*` and `multiSearch*` share the defect and each needs its own call site.
`compareTrivialUTF8` folds a whole needle with no checkpoint, so a needle differing only at its
last code point still overruns by a bounded 0.85-1.02 s; that fix belongs inside that function,
shared with `startsWith`/`endsWith` and `VolnitskyBase::compare`.

Related: ClickHouse#112203
Related: ClickHouse#113369
@PedroTadim
PedroTadim added this pull request to the merge queue Aug 10, 2026
Merged via the queue into master with commit 5e52a0f Aug 10, 2026
179 of 181 checks passed
@PedroTadim
PedroTadim deleted the remove-cancelation-tests branch August 10, 2026 08:04
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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