Skip to content

Report total rows to read for parallel replicas with local plan - #123928

Merged
alexey-milovidov merged 1 commit into
masterfrom
parallel-replicas-progress-total
Oct 5, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
parallel-replicas-progress-total

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix missing total rows in progress (and therefore a non-working progress bar) for queries with parallel replicas when parallel_replicas_local_plan is enabled (the default).

Details

With parallel_replicas_local_plan = 1 and the default coordination mode, progress packets never contained total_rows_to_read, and system.processes.total_rows_approx stayed 0. Reproduces at least since 25.8.

DefaultCoordinator reports the total rows only once, on the first initial announcement. With the local plan, that announcement comes from the initiator's own read while the pipeline is being built, before the remote sources set the progress callback on the coordinator, so the total was dropped.

The fix sets the total rows approximation on the initiator's local read in readFromPoolParallelReplicas, the same way readInOrder already does (only on the initiator with local plan, to avoid counting it once per replica).

Found on adsb.exposed, where the progress bar disappeared after enabling parallel replicas.

🤖 Generated with Claude Code


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

Version info

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

With `parallel_replicas_local_plan = 1` (the default) and the default
coordination mode, progress never contained `total_rows_to_read`, so
progress bars did not work for queries with parallel replicas.

`DefaultCoordinator` reports the total rows only once, on the first
initial announcement. With the local plan, the first announcement comes
from the initiator's own read while the pipeline is being built, before
the remote sources set the progress callback, so the total was dropped.

Set the total rows approximation on the initiator's local read, as it is
already done for reading in order.

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

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9da720c]

Summary: ✅


AI Review

Summary

The code change itself looks consistent with the existing readInOrder handling: it seeds total_rows_to_read on the initiator's local MergeTreeSource for the default parallel-replica path where the coordinator cannot emit that total. I am still requesting changes because the new regression test only inspects the final X-ClickHouse-Summary header, so it does not actually prove the promised live-progress behavior.

Tests
  • ⚠️ tests/queries/0_stateless/05325_parallel_replicas_progress_total_rows.sh:20 only checks X-ClickHouse-Summary, which is emitted after the query finishes. A regression that leaves live X-ClickHouse-Progress and system.processes.total_rows_approx at 0 until finalization would still pass. Please assert a live X-ClickHouse-Progress header or poll system.processes.total_rows_approx while the query is still running.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Strengthen the regression test so it observes live progress, not only the final summary.

LLVM Coverage Report

Measured on commit 9da720c.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 92.10% 92.20% +0.10%
Branches 79.70% 79.60% -0.10%

Changed lines: Changed C/C++ lines covered: 15/15 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 5, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). label Oct 5, 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.

Amazing, LGTM!

@alexey-milovidov alexey-milovidov self-assigned this Oct 5, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 5, 2026
Merged via the queue into master with commit 29e0e20 Oct 5, 2026
149 checks passed
@alexey-milovidov
alexey-milovidov deleted the parallel-replicas-progress-total branch October 5, 2026 18:57
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). pr-bugfix Pull request with bugfix, not backported by default 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