Skip to content

Make 05110 and 05112 independent of the shared S3 connection pool - #124776

Merged
CheSema merged 3 commits into
ClickHouse:masterfrom
groeneai:fix-05110-05112-s3-per-query-oracles
Nov 2, 2026
Merged

CheSema merged 3 commits into
ClickHouse:masterfrom
groeneai:fix-05110-05112-s3-per-query-oracles

Conversation

@groeneai

@groeneai groeneai commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

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

...

Description

05110_s3_connection_reuse_many_streams and 05112_s3_packed_part_connection_reuse fail on s3 storage lanes: 05110, master, 05112, master, 05112, PR.

Both assert DiskConnectionsReused >= 18. The connection pool is keyed on the endpoint, and every test S3 disk is localhost:11111, so the pool is shared with every concurrent test. In the failed 05110 run all 42 connections went back to the pool (DiskConnectionsPreserved 42, Reset 0), but neighbours took them: Created 26, Reused 16. The same counters also pass with each test's fix reverted, because the test's own INSERT leaves idle connections in the pool (05110: Created 0 / Reused 42; 05112: Reused 21).

Each test now checks what its own bug changes in this query:

  • 05112: DiskConnectionsReset <= 2. Without the view's right bound, every file read is open-ended and its connection is reset.
  • 05110 (now .sh): at least 20 Read S3 object ... Range: a-b lines at send_logs_level = 'test'. Without the right bound at the end of the object, the data file requests are sent without a range end and log nothing.

Validation on a debug build with a local MinIO: with the fix reverted (#118480, #118483), the new 05110 fails 10/10 back-to-back on a warm pool (0 ranged requests, connection counters identical to the fixed build) and the new 05112 fails 10/10 (Reset 21). On the fixed build both pass 50 sequential + 50 -j 16 runs and 30 runs under a 16-way S3 load (21 ranged requests, Reset 0 in every run).

Related: #118480
Related: #118483


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

Version info

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

groeneai and others added 2 commits October 8, 2026 21:58
Both tests asserted `DiskConnectionsReused >= 18` for one sequential read
of a 21-column Wide part. The connection pool is keyed on the endpoint and
every test S3 disk is `localhost:11111`, so the counter measured a pool
shared with every concurrent test: in the failed 05110 run all 42
connections were returned (Preserved 42, Reset 0), yet neighbours took
them and the query created 26 and reused 16. The same counters also pass
with each test's own fix reverted, because the test's INSERT leaves idle
connections in the pool (05110: Created 0 / Reused 42; 05112: Reused 21).

Assert each bug's own per-query effect instead:
- 05112: `DiskConnectionsReset <= 2`. Without the view's right bound every
  file read is open-ended, the response is never read to the end and the
  connection is reset instead of returned.
- 05110, now a `.sh` test: count the TEST-level `Read S3 object ... Range:
  a-b` lines of the SELECT. Without the right bound at the object end the
  data file requests have no range end and log no such line.

Negative controls on a debug build (local MinIO): with the gather fix
reverted the new 05110 fails 10/10 back-to-back on a warm pool (0 ranged
requests vs 21, connection counters identical to the fixed build); with
the view bound removed the new 05112 fails 10/10 (Reset 21 vs 0). The
fixed build passes both in 50 sequential, 50 `-j 16` and 30 runs under a
16-way S3 load.

CI failures:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=6101ac5e7d4976004fc00948f42677b22f3f40fc&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20parallel%2C%202%2F3%29
https://github.com/ClickHouse/ClickHouse/actions/runs/36682278835/job/109784920371
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123673&sha=b0678011a1bdfaf285150128113a0ffd0e8097b5&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20AsyncInsert%2C%20s3%20storage%2C%20parallel%29

Related: ClickHouse#118480, ClickHouse#118483

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check the client's status before counting the ranged requests, so a query that sends its reads and then throws no longer passes.

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 Oct 8, 2026
@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)
Finding Verdict
⚠️ 05110: the SELECT's exit status was discarded by the log-count pipeline, so a query that sent its ranged requests and then threw could still pass AGREE, fixed: the client status is checked and the exception is printed
💡 DiskConnectionsReset also counts a release refused by the group store limit (10000) or a peer-closed connection noted: not reached in tests/config; the <= 2 slack covers an isolated retry
💡 05110 keeps the SELECT's server log lines out of the test's stderr, so a server warning in that query no longer fails it as the .sql did noted: not what the test checks; same capture as the other --send_logs_level=test shell tests

@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? The new assertions are red on demand: with #118480's fix reverted the new 05110 fails 10/10 back-to-back on one server (warm pool), with #118483's fix reverted the new 05112 fails 10/10. The old assertions pass on both reverted builds, even on a fresh server. The CI failure itself depends on concurrent load and did not reproduce locally; its mechanism is read from the failed job's query_log (Created 26, Reused 16, Preserved 42, Reset 0).
b Root cause explained? The pool is keyed on the endpoint and every test S3 disk is localhost:11111, so DiskConnectionsReused measures a pool shared with all concurrent tests: neighbours drain it (flaky), and the test's own INSERT fills it (passes without the fix).
c Fix matches root cause? Yes. The assertions now read what only this query produces: the Range header of its own requests (05110) and resets of its own connections (05112). No bound widened, no tag added, no data reduced.
d Test intent preserved / new tests added? Strengthened: each test now fails with its own fix reverted, which the previous version did not.
e Both directions demonstrated? Fixed build: 05110 21 ranged requests in 131/131 counted runs, 05112 Reset 0 in 131/131 runs (50 sequential, 50 -j 16, 30 under a 16-way S3 load). Reverted builds: 05110 0 ranged requests, 05112 Reset 21, 10/10 each.
f Fix is general across code paths? Test-only. Both tests with this connection-reuse floor are changed. 02789_reading_from_s3_with_connection_pool (DiskConnectionsPreserved > 0 with retries) is not affected.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only). Tags are unchanged; LOG_TEST has no build gate, and tests that grep TEST-level lines (04545, 05257) pass in release, binary and s3 storage lanes.
h Backward compatible? (maintainer-approved exception only) Yes, test-only.
i Invariants and contracts preserved? TEST-level lines go only to the client of the query that emitted them, and DiskConnectionsReset counts only this query's releases (the group store limit, 10000, that would also reset them is not reached in tests/config).

Session id: cron:clickhouse-impl-slot-4:20261008-212200

@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [91d8356]

Summary: ✅


AI Review

Summary

The PR replaces shared S3 connection-pool reuse assertions with checks of bounded requests in 05110 and connection resets in 05112. No actionable findings remain at commit 91d835619d38b9650ecfb4ca5a66ae3cce5fd267.

The previous inline finding was a false positive and has been resolved. A failed SELECT prints SELECT failed: to stdout, which fails comparison with the committed reference even when enough ranged requests were logged. A focused mock of the current shell fragment confirmed this with and without an exception banner. The PR also documents negative controls for both original S3 regressions and repeated successful runs under concurrent load.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 8, 2026
@groeneai
groeneai requested a review from CheSema October 8, 2026 23:39
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 9, 2026
@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 208cb98

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 05055_string_filters_move_to_prewhere flaky, not from this PR (which changes only 05110 and 05112): the last line expects the string-filter ProfileEvents 1 1 and reads 0 0. Under parallel replicas the scan can run on a replica, whose events land on a secondary system.query_log row instead of the initiator row the test reads. 148/148 reruns passed a fix task is created (investigating at full effort, fixing-PR link to follow here)
Stateless tests (arm_binary, ParallelReplicas, s3 storage, sequential) / 04201_max_bytes_ratio_before_external_join_distributed flaky, not from this PR: Code: 241 ... User memory limit exceeded ... maximum: 1.00 GiB in GraceHashJoin. In this lane the test's local join runs as a parallel-replicas query, and the replicas share the test user's 1 GiB cap. 1/30 reruns failed a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR praktika rollups of the two rows above (Failed: 2), no independent failure a fix task is created for each row above

All check runs completed. CH Inc sync passed.

Session id: cron:our-pr-ci-monitor:20261009-073003

@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for 04201_max_bytes_ratio_before_external_join_distributed (ParallelReplicas, sequential) created: #124909

@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for 05055_string_filters_move_to_prewhere from the ledger above: #124911.

@CheSema
CheSema added this pull request to the merge queue Nov 2, 2026
Merged via the queue into ClickHouse:master with commit 9e2445a Nov 2, 2026
179 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 Nov 2, 2026
@clickhouse-gh clickhouse-gh Bot added comp-object-storage Object storage connectivity (S3/GCS/Azure) including credentials, retries, multipart, etc. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
filimonov added a commit to Altinity/ClickHouse that referenced this pull request Nov 24, 2026
…cked archive member

`ReadBufferFromFileView` never told the buffer under it where a packed archive
member ends, so every member read on an object storage disk was an open-ended
`GET`: a merge of a 2,400-column table reset ~8,100 connections. The view now
passes its right bound down. `05112` asserts `DiskConnectionsReset <= 2`
instead of a reuse count of the shared S3 connection pool.

Upstream: ClickHouse#118483
(merge commit dc740cb)
Upstream: ClickHouse#124776
(merge commit 9e2445a), only its `05112`
part: `05110` tests ClickHouse#118480, which is not on this branch.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
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-object-storage Object storage connectivity (S3/GCS/Azure) including credentials, retries, multipart, etc. 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