Skip to content

Run the kill and timeout inserts of test_inserts_with_keeper_retries synchronously - #123076

Merged
antonio2368 merged 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-keeper-retries-test-sync-inserts
Oct 5, 2026
Merged

antonio2368 merged 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-keeper-retries-test-sync-inserts

Conversation

@groeneai

@groeneai groeneai commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #111663

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

Not required: CI-only change.

Description

test_inserts_with_keeper_retries/test.py::test_ambiguous_zk_commit_kill_preserves_data failed on master in Integration tests (arm_binary, distributed plan, 3/4) (report): test.py:324 assert '0\n' == '10\n'.

Since #111663, a single-block INSERT ... SELECT goes through the async insert queue by default. The client query then only waits, while the sink and its Keeper retry loop run in the flush under another query id, so KILL QUERY and max_execution_time stop only the wait. The kill test's count() races the flush's next retry (the part landed 70 ms after the read) and never reaches the ambiguous-commit preserve path of #111196. Likewise, the timeout test's TIMEOUT_EXCEEDED and the < 10 s bound of test_query_timeout_with_zk_down are met by the wait while the flush keeps retrying.

I pin async_insert=0 on these three inserts, as #111663 did in test_jbod_balancer, test_azure_403_handling and test_rename_column. Each test also checks in system.query_log that its insert skipped the queue (ProfileEvents['AsyncInsertQuery'] is 0), so a later routing change fails it instead of hollowing it out again. The module's other inserts, the deduplication re-inserts included, keep the default route: their client waits for the flush, and deduplication does not depend on the route.

Validation on a master debug build:

  • With the kill test's retry backoff stretched to 2 s, it fails 5/5 at test.py:324 on master and passes 5/5 with the pin.
  • Without the pin, that check fails in all three tests.
  • Local mutations: rolling the part back instead of preserving it fails the fixed kill and timeout tests but not the unfixed kill test; dropping the query status from commitPart's retries fails the fixed zk_down test but not the unfixed one.
  • Stable: 50/50 (ambiguous-commit pair), 10/10 (zk_down), the whole module, the pair on ASan.

Preserve-on-timeout inside an async flush is no longer exercised; it runs the same code as the synchronous sink.

🤖 Generated with Claude Code


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

Version info

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

groeneai and others added 3 commits September 30, 2026 11:39
…hronously

Since ClickHouse#111663 a single-block INSERT ... SELECT into MergeTree takes the
async insert queue by default. The client query then only waits for the
flush, while the sink and its Keeper retry loop run in the flush under
another query id, so KILL QUERY and max_execution_time stop only the wait.

test_ambiguous_zk_commit_kill_preserves_data failed on master
(Integration tests (arm_binary, distributed plan, 3/4)) because its
count() raced the flush's next retry: the part landed 70 ms after the
read. The kill test also no longer reached the ambiguous-commit preserve
path of ClickHouse#111196, the timeout test's TIMEOUT_EXCEEDED came from the wait,
and the < 10 s bound of test_query_timeout_with_zk_down was met by the
wait while the flush kept retrying.

Pin async_insert=0 on these three inserts and on the two deduplication
re-inserts, which model a client retrying the same statement, as ClickHouse#111663
did for test_jbod_balancer, test_azure_403_handling and
test_rename_column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…etries ran synchronously

The pinned async_insert=0 forces the synchronous route only while the
table-level async_insert MergeTree setting is off, and the tests'
assertions also pass on the async insert queue route. Assert from
system.query_log that each of the three inserts did not push to the
queue (ProfileEvents['AsyncInsertQuery'] = 0), and that the zk_down
insert ends with TIMEOUT_EXCEEDED, so a routing change fails the tests
instead of silently hollowing them out again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… on the default route

Insert deduplication uses the same hash on the synchronous and the
async insert queue route, so the async_insert=0 pins on the two
re-inserts changed nothing the tests check. Drop them: the re-inserts
take the default route of a plain retry and are still deduplicated
against the part the killed or timed-out insert preserved.

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 30, 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; 3 rounds with 1, 1 and 0 findings) plus my own cold review (3 nits).

# Sev Finding Verdict Evidence / action
1 ⚠️ The tests pass on both routes, so a routing change could hollow them out again unnoticed (async_insert=0 does not override a table-level async_insert) AGREE, fixed @ ce336e0 Each of the three tests checks ProfileEvents['AsyncInsertQuery'] = 0 in system.query_log; zk_down also requires TIMEOUT_EXCEEDED; without the pin the check fails in all three
2 ⚠️ The async_insert=0 pins on the two deduplication re-inserts are unobservable: deduplication does not depend on the route AGREE, fixed @ f39e8fa Pins dropped; the re-inserts keep the default route and are still deduplicated (with deduplication disabled they fail with 20 rows)
3 💡 Title overclaimed "the Keeper retry inserts" AGREE, fixed in the PR text Title names the kill and timeout inserts
4 💡 Body did not say why the other inserts keep the default route AGREE, fixed in the PR text One sentence
5 💡 Description over the length budget AGREE, fixed in the PR text Condensed

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

Session id: cron:clickhouse-review-slot-11:20260930-133200

@clickhouse-gh

clickhouse-gh Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f39e8fa]

Summary: ✅


AI Review

Summary

This PR pins the three INSERT ... SELECT cases in test_inserts_with_keeper_retries to the synchronous path and adds system.query_log checks so the timeout and KILL QUERY tests fail if they silently start using the async insert queue again. I did not find a remaining correctness or coverage gap in the touched cases: the new ProfileEvents['AsyncInsertQuery'] = 0 witness matches the server-side async-insert accounting, and the other inserts left on the default route still test behavior that does not depend on synchronous execution.

Final Verdict

✅ No findings.

@antonio2368
antonio2368 added this pull request to the merge queue Oct 5, 2026
Merged via the queue into ClickHouse:master with commit c7a8030 Oct 5, 2026
149 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
@clickhouse-gh clickhouse-gh Bot added comp-replication ReplicatedMergeTree* + replication log/state transitions, eventual consistency mechanics. 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-replication ReplicatedMergeTree* + replication log/state transitions, eventual consistency mechanics. 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.

3 participants