Repository navigation
Fix: max_execution_timeout_leaf with parallel replicas - #69540
Conversation
|
Dear @hanfei1991, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
@devcrafter, it needs to be properly merged with the master branch. |
|
Dear @alexey-milovidov, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units44 translation units recompiled, 455 s compile time in total, 44 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.08 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
|
🕵 Investigated the remaining The current net diff against |
|
🕵 Merged current The prior |
…n-timeout-leaf # Conflicts: # src/Interpreters/ClusterProxy/executeQuery.cpp
|
Dear @hanfei1991, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
🕵 Merged current The merge was a criss-cross one: Verification after the merge:
No code changes; awaiting a fresh CI run on the merged head. |
|
🕵 Merged current
State otherwise: AI review verdict ✅ Approve, zero unresolved threads, approved by @alexey-milovidov. The criss-cross merge situation persists (two merge bases), so the merge was again done by taking |
…af timeout test A review comment suspected that the analyzer/planner `SELECT` path (`ClusterProxy::executeQueryWithParallelReplicas` with a query tree, used for a non-replicated `MergeTree` with `parallel_replicas_for_non_replicated_merge_tree = 1`) re-serializes the top-level `SETTINGS` clause into the query text sent to the replicas, so that an outer `max_execution_time` would override the leaf value substituted into the shipped context. That does not happen: `buildQueryTreeForShard` calls `QueryNode::clearSettingsChanges` on the top-level query node before the shipped AST is built, exactly so the query settings are not sent in the query text (they travel with the context instead). Verified on a local three-replica cluster: the shipped text is `SELECT sum(...) FROM ... AS __table1` with no `SETTINGS` clause, and with `max_execution_time = 100, max_execution_time_leaf = 1` a remote replica throws `TIMEOUT_EXCEEDED` after ~1 s. Add the corresponding regression cases so the behaviour stays pinned. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🕵 Status update (2026-09-12):
Head is now |
Reproducer-- Server started with the stateless-test config (defines
-- test_cluster_one_shard_three_replicas_localhost); no Keeper needed.
CREATE TABLE t (key UInt64) ENGINE = MergeTree ORDER BY key SETTINGS index_granularity = 10;
INSERT INTO t SELECT number FROM numbers(1000);
SELECT sum(sleepEachRow(0.01)) FROM t
SETTINGS allow_experimental_parallel_reading_from_replicas = 2, max_parallel_replicas = 3,
cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost',
parallel_replicas_for_non_replicated_merge_tree = 1, automatic_parallel_replicas_mode = 0,
max_threads = 1, max_block_size = 1,
max_execution_time_leaf = 1;
-- 26.8.2.7 (and every release down to 25.8.33.6): returns 0 after ~10s
-- -> max_execution_time_leaf silently ignored.
-- master (26.9.1.1273, with #69540): Code: 159 TIMEOUT_EXCEEDED after ~1s, raised on a remote replica.
-- Control on the same build: replacing max_execution_time_leaf = 1 with
-- max_execution_time = 1 DOES abort at 1s, so the query really runs >1s.Results:
Backport the fix to CC component owner: @devcrafter @nickitat Analysis metadata
Introducing change: predates `v23.12.6.19` (oldest testable release)
|
max_execution_time_leafandtimeout_overflow_mode_leafsettings are now effective for queries with parallel replicas.Previously these settings were silently ignored for task-based parallel replicas when the local replica pipeline was used (the leaf timeout was substituted into
max_execution_timeonly for remote replicas, while the local replica shares the initiator'sQueryStatusand was therefore unbounded). This is fixed for bothSELECTandINSERT SELECT(withparallel_distributed_insert_select = 2) by skipping the local pipeline when the leaf timeout is set, so all leaf reading happens on remote replicas where the leaf timeout is honored.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
max_execution_time_leafandtimeout_overflow_mode_leafbeing ignored for queries executed with parallel replicas (includingINSERT SELECTwithparallel_distributed_insert_select = 2). The settings were silently not applied when the local replica pipeline was used; now they are honored.CI Settings (Only check the boxes if you know what you are doing):
Workflow [PR]
Sync PR [sync-upstream/pr/69540]
Version info
26.9.1.1233(included in26.9and later)