Skip to content

SYSTEM SYNC MERGES: report TIMEOUT_EXCEEDED when CancellationChecker stops it - #127759

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-sync-merges-timeout-code
Oct 26, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-sync-merges-timeout-code

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

CancellationChecker measures max_execution_time from the registration of the query in the process list. That is earlier than the start of the polling loop in InterpreterSystemQuery::syncMerges. When the checker fires first, the loop saw only isQueryCanceled and threw QUERY_WAS_CANCELLED, even though the cancel reason is the timeout. The loop now calls QueryStatus::throwIfKilled, which throws TIMEOUT_EXCEEDED for a timeout cancellation.

This race made 05317_sync_merges_waits_for_commit fail in every flaky check of #71028. The test expects TIMEOUT_EXCEEDED from SYSTEM SYNC MERGES before COMMIT. In the server log, CancellationChecker: Cancelling the task because of the timeout is followed by Code: 394 ... QUERY_WAS_CANCELLED: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=8756552a877bdecfeaed1cce864ace0a31b8288a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code


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

Version info

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

…cker` stops it

`CancellationChecker` measures `max_execution_time` from the registration of the query
in the process list, which is earlier than the `start` of the polling loop in
`InterpreterSystemQuery::syncMerges`. When the checker fires first, the loop saw only
`isQueryCanceled` and threw `QUERY_WAS_CANCELLED`, although the cancel reason is the
timeout. Check `QueryStatus::throwIfKilled` instead, which throws `TIMEOUT_EXCEEDED`
for a timeout cancellation.

This made `05317_sync_merges_waits_for_commit` fail in the flaky check of #71028:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=8756552a877bdecfeaed1cce864ace0a31b8288a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7015b3a]

Summary: ✅


AI Review

Summary

SYSTEM SYNC MERGES now uses QueryStatus::throwIfKilled to preserve TIMEOUT_EXCEEDED when CancellationChecker cancels the query, while retaining explicit cancellation errors. No actionable findings. The existing 05317_sync_merges_waits_for_commit regression test fails in the reported pre-fix run and passes in the patched debug CI job.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. labels Oct 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit 7015b3ae2e1dae0422f1d5fe4a0f84743fbf959f was not compared: the CI logs cluster did not answer (exception 241, code 500: { "meta": [ { "name": "file", "type": "LowCardinality(String)" …).

See the job log for details.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks trivial.

@alexey-milovidov alexey-milovidov self-assigned this Oct 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 26, 2026
Merged via the queue into master with commit a250260 Oct 26, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-sync-merges-timeout-code branch October 26, 2026 22:11
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. pr-not-for-changelog This PR should not be mentioned in the changelog 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