Skip to content

Make the delegated url('s3://...') parallel-replicas regression use a replicated destination - #121369

Merged
alexey-milovidov merged 5 commits into
masterfrom
followup-120488-url-s3-parallel-replicas-replicated-dst
Oct 3, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
followup-120488-url-s3-parallel-replicas-replicated-dst

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Related: #120488

Follow-up to #120488, addressing the one review thread that was still open when it merged.

test_url_s3_scheme_with_parallel_replicas created the destination of its INSERT ... SELECT as a plain MergeTree. InterpreterInsertQuery::distributedWriteIntoReplicatedMergeTreeOrDataLakeFromClusterStorage returns early unless the destination is a MergeTree/data lake that supports replication, so the parallel_distributed_insert_select = 2 half of that test never got as far as examining the source storage — it only exercised the local fallback, and would have passed unchanged before the fix.

This creates the destination as a ReplicatedMergeTree (and gives the test instance a ZooKeeper) so the distributed path is really entered. It then declines the query for the intended reason: TableFunctionURL::executeImpl runs the delegate with parallel_replicas_for_cluster_engines turned off, so the delegated url('s3://...') resolves to a plain StorageObjectStorage rather than to an IStorageCluster. That is exactly the property under test — and if the delegate ever fans out again, the forwarded query names urlCluster('s3://...'), every replica reads the whole file, and the row-count assertion now catches it.

A row count alone cannot tell "declined because of the source" from "declined earlier for another reason", so the test also runs the same INSERT from s3('s3://...') as a positive control: with the identical destination and settings, system.query_log must show it forwarded as s3Cluster (once: the three replicas of the test cluster are the same host, and Cluster::getClusterWithReplicasAsShards skips duplicate hosts), reading the file once, while the url('s3://...') INSERT must show no forwarded queries at all.

No production code changes; the distributed forwarding itself stays covered by the stateless test 05218_insert_select_auto_cluster_function_parallel_replicas, which already uses a ReplicatedMergeTree destination.

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

...

🤖 Generated with Claude Code


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

Version info

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

… a replicated destination

Follow-up to #120488.

`test_url_s3_scheme_with_parallel_replicas` created its `INSERT ... SELECT`
destination as a plain `MergeTree`.
`InterpreterInsertQuery::distributedWriteIntoReplicatedMergeTreeOrDataLakeFromClusterStorage`
returns early unless the destination supports replication, so the
`parallel_distributed_insert_select = 2` half of the test never got as far as
looking at the source storage: it only exercised the local fallback and would
have passed just the same before the fix.

Create the destination as a `ReplicatedMergeTree` (and give the instance a
ZooKeeper) so the distributed path is entered for real. It then declines the
query solely because `TableFunctionURL::executeImpl` runs the delegate with
`parallel_replicas_for_cluster_engines` turned off and the delegated
`url('s3://...')` therefore resolves to a plain storage rather than to an
`IStorageCluster` - which is the property under test. Should the delegate ever
fan out again, the forwarded query would name `urlCluster('s3://...')` and every
replica would read the whole file, and the row count now catches that.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b371ee5]

Summary: ✅


AI Review

Summary

This PR strengthens test_url_s3_scheme_with_parallel_replicas so the INSERT ... SELECT case actually exercises the replicated-destination distributed path, then distinguishes the delegated url('s3://...') path from the direct s3('s3://...') control with system.query_log assertions. I reviewed the current diff, the prior inline thread and reply, and the relevant unchanged code in InterpreterInsertQuery, IStorageCluster, and TableFunctionURL; I do not see a remaining contract violation or a new correctness gap in the test.

Final Verdict
  • Status: ✅ Approve

alexey-milovidov and others added 3 commits September 26, 2026 22:56
…st_url_s3_scheme_with_parallel_replicas`

The row count alone could not tell "declined because the delegated `url` is not an
`IStorageCluster`" from "declined earlier for another reason". Run the same `INSERT` from
`s3('s3://...')` as a positive control: with the identical `ReplicatedMergeTree` destination and
settings, `system.query_log` must show it forwarded to all 3 replicas as `s3Cluster`, reading the
file once. The `url('s3://...')` `INSERT` must show no forwarded queries at all. The two queries
differ only in the source, so the `url` one reached the source check and was declined there.

#121369 (comment)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…3_scheme_with_parallel_replicas`

All three replicas of the `parallel_replicas` cluster are the same `node:9000`, and
`Cluster::getClusterWithReplicasAsShards` skips duplicate hosts, so the cluster storage
sees a single shard and the forwarded `INSERT` runs exactly once, not three times.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121369&sha=0b89a0fe9d69c32592c01b7b02f08c9cf4fae58c&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%205%2F6%29
#121369

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Oct 3, 2026

@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.

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 3, 2026
Merged via the queue into master with commit c7059a1 Oct 3, 2026
161 checks passed
@alexey-milovidov
alexey-milovidov deleted the followup-120488-url-s3-parallel-replicas-replicated-dst branch October 3, 2026 21:43
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 3, 2026
@clickhouse-gh clickhouse-gh Bot added comp-table-functions Table functions for temporary read/write to external systems (FROM ... tableFunction()). 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

comp-table-functions Table functions for temporary read/write to external systems (FROM ... tableFunction()). 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.

2 participants