8000 Select plain or swarm mode for cluster query by ianton-ru · Pull Request #2808 · Altinity/ClickHouse · GitHub
[go: up one dir, main page]

Skip to content

Select plain or swarm mode for cluster query - #2808

Draft
ianton-ru wants to merge 6 commits into
antalya-26.8from
feature/antalya-26.8/object-storage-cluster-local-read-probe
Draft

ianton-ru wants to merge 6 commits into
antalya-26.8from
feature/antalya-26.8/object-storage-cluster-local-read-probe

Conversation

@ianton-ru
Copy link
Copy Markdown

Changelog category (leave one):

  • Experimental Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Select plain or swarm mode for cluster query

Documentation entry for user-facing changes

We have a object_storage_cluster feature to make distributed query to table on object storage.
But small query can be executed faster locally, directly on initiator.

This feature allow to select local or distributed way based on expected query size.
It does not give 100% accuracy, it's a some kind of heuristic.

Distributed query is split on tasks for remote nodes.
Now we start to do in on early stage. If we get only few tasks, not greater than object_storage_cluster_local_read_max_tasks and spend not more than object_storage_cluster_local_read_probe_ms milliseconds, we execute query locally. In other case, execute on cluster.

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

ianton-ru and others added 6 commits November 5, 2026 15:51
…probe

Add `object_storage_cluster_local_read_max_files` and `object_storage_cluster_local_read_probe_ms`. When enabled, the initiator lists the object storage files for a `*Cluster` query for up to the time budget. If the listing finishes within the budget and yields at most the file limit, the query is read locally. Otherwise the query keeps the cluster path. The default of `0` keeps the existing behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
The `object_storage_cluster_local_read_max_files` probe listed files and then discarded them, so the local read or the cluster task distributor listed the same files again. Keep the probe iterator and the objects it already returned on the query info, and replay them in `ReadFromObjectStorageStep` and in `getTaskIteratorExtension`. Placeholder metadata from `skip_object_metadata` is dropped for local reads so they fetch the real size. Queries that read `_tags` still list again, because the probe does not request tags.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the local-or-cluster decision on `ObjectStorageClusterReadProbe` instead of a second flag on `SelectQueryInfo`. A finished listing is represented by a null iterator, so the separate exhausted flag is gone. `createObjectIteratorForRead` always sets `tasks_go_to_other_replicas` and emits profile events, so those parameters are removed.

Placeholder metadata from `skip_object_metadata` is no longer cleared for local reads, because the read already treats an unfetched object as an unknown size.

Co-authored-by: Cursor <cursoragent@cursor.com>
…e children

A `Merge` passes one `SelectQueryInfo` to every child, so a single probe slot let the first child's local-read decision apply to later children. The probe is now keyed by the cluster storage, and `05429_object_storage_cluster_local_read_merge` checks a small child read locally next to a large child that stays on the cluster.

Co-authored-by: Cursor <cursoragent@cursor.com>
The probe now counts the same tasks the cluster would run, so with `bucket` split granularity each bucket counts, not each file. The setting `object_storage_cluster_local_read_max_files` is renamed to `object_storage_cluster_local_read_max_tasks`.

Co-authored-by: Cursor <cursoragent@cursor.com>
…probe

The probe drops a finished iterator, so a local read lost the `_data_lake_snapshot_version` that the cluster read reports. The probe now stores the snapshot version before it releases the iterator, and the replay iterator returns it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ianton-ru
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
chatgpt-codex-connector Bot commented Nov 6, 2026 •
Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T15:14:23.887280Z 5021b15 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions
github-actions Bot commented Nov 6, 2026
Copy link
Copy Markdown

Workflow [PR], commit [5021b15]

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5021b15138

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +760 to +763
auto object = iterator->next(0);
if (!object)
{
probe->read_locally = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the probe deadline across iterator calls

When iterator->next(0) starts just before the deadline but a slow object-store listing or bucket split returns nullptr after it, this branch marks the probe local without checking elapsed time again. Consequently object_storage_cluster_local_read_probe_ms neither bounds planning latency nor preserves the documented rule that a listing finishing outside the budget stays distributed; use a deadline-aware/cancellable iterator operation and verify the deadline before accepting exhaustion as a local-read decision.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0