You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by hu...@apache.org on 2026/03/30 09:18:53 UTC
(doris) branch fe_local_shuffle updated (14fd4d6217a -> 44e06f87090)
This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a change to branch fe_local_shuffle
in repository https://gitbox.apache.org/repos/asf/doris.git
discard 14fd4d6217a [fix](local shuffle) revert PASSTHROUGH insertion after serial Exchange
new 44e06f87090 [fix](local shuffle) fix downstream pipeline num_tasks in LOCAL_EXCHANGE_NODE handler
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (14fd4d6217a)
\
N -- N -- N refs/heads/fe_local_shuffle (44e06f87090)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
be/src/exec/pipeline/pipeline_fragment_context.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
(doris) 01/01: [fix](local shuffle) fix downstream pipeline num_tasks in LOCAL_EXCHANGE_NODE handler
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch fe_local_shuffle
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 44e06f87090c06bbc07a386e702017323512386a
Author: 924060929 <la...@selectdb.com>
AuthorDate: Mon Mar 30 12:52:09 2026 +0800
[fix](local shuffle) fix downstream pipeline num_tasks in LOCAL_EXCHANGE_NODE handler
In the FE-planned local exchange path, the LOCAL_EXCHANGE_NODE handler
creates a downstream pipeline (containing LocalExchangeSource) that
inherits num_tasks from its parent. When the parent pipeline was reduced
by a serial operator (e.g., UNPARTITIONED Exchange), the downstream
inherits num_tasks=1. But the deferred exchanger creates _num_instances
channels — only 1 source task initializes mem_counters[0], leaving the
rest as nullptr. The sink round-robins to all channels and crashes on
uninitialized mem_counters (SIGSEGV on Linux ASAN, deadlock on macOS).
Fix: Set downstream_num_tasks = _num_instances unconditionally, matching
BE-native _inherit_pipeline_properties which always sets
pipe_with_source.set_num_tasks(_num_instances).
Also revert the deriveAndEnforceChildLocalExchange PASSTHROUGH insertion
that was an incorrect attempt to fix this from the FE side.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
---
be/src/exec/pipeline/pipeline_fragment_context.cpp | 15 +++++++++-----
.../java/org/apache/doris/planner/PlanNode.java | 23 +---------------------
2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/be/src/exec/pipeline/pipeline_fragment_context.cpp b/be/src/exec/pipeline/pipeline_fragment_context.cpp
index 2c44a5637f6..9a4d14494ea 100644
--- a/be/src/exec/pipeline/pipeline_fragment_context.cpp
+++ b/be/src/exec/pipeline/pipeline_fragment_context.cpp
@@ -1802,11 +1802,16 @@ Status PipelineFragmentContext::_create_operator(ObjectPool* pool, const TPlanNo
}
case TPlanNodeType::LOCAL_EXCHANGE_NODE: {
op = std::make_shared<LocalExchangeSourceOperatorX>(pool, tnode, next_operator_id(), descs);
- // Save downstream pipeline's num_tasks before add_operator potentially reduces it
- // (is_serial_operator on the LocalExchangeSourceOperatorX would set num_tasks=1,
- // but the downstream pipeline needs _num_instances tasks — the serial semantics
- // should only apply to the upstream scan pipeline).
- auto downstream_num_tasks = cur_pipe->num_tasks();
+ // The downstream pipeline (containing LocalExchangeSource) must have
+ // _num_instances tasks — matching BE-native _inherit_pipeline_properties
+ // which sets pipe_with_source.set_num_tasks(_num_instances).
+ // Without this, when the parent pipeline was reduced by a serial operator
+ // (e.g., serial Exchange with use_serial_exchange=true, or UNPARTITIONED
+ // Exchange), the downstream inherits the reduced num_tasks via
+ // add_pipeline(parent). The deferred exchanger creates _num_instances
+ // channels but only fewer source tasks initialize mem_counters — the
+ // sink round-robins to all channels and crashes on uninitialized ones.
+ auto downstream_num_tasks = _num_instances;
RETURN_IF_ERROR(cur_pipe->add_operator(op, _parallel_instances));
// Restore downstream pipeline's num_tasks (mirroring _inherit_pipeline_properties:
// downstream keeps _num_instances, upstream gets the serial/reduced count)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
index be96e7b9e4d..e5114f9cbd0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java
@@ -1014,28 +1014,7 @@ public abstract class PlanNode extends TreeNode<PlanNode> {
? false
: hasSerialAncestorInPipeline || isSerialOperator();
translatorContext.setHasSerialAncestorInPipeline(child, childHasSerialAncestorInPipeline);
- Pair<PlanNode, LocalExchangeType> result =
- child.enforceAndDeriveLocalExchange(translatorContext, this, requireChild);
-
- // If the returned node is a serial EXCHANGE operator, insert a
- // PASSTHROUGH local exchange to create a pipeline boundary. This
- // mirrors BE's _add_local_exchange which inserts an exchange after
- // serial operators, ensuring downstream pipelines have _num_instances
- // tasks for shared state injection and proper mem_counters
- // initialization. Without this, the serial Exchange reduces the
- // pipeline's num_tasks to 1, causing SIGSEGV (null mem_counters) or
- // "must set shared state" errors.
- //
- // Only apply when fragment uses serial source (pooling scan mode).
- // Without useSerialSource(), non-pooling fragments may get unnecessary
- // PASSTHROUGH exchanges that change pipeline structure and cause deadlocks.
- if (result.first instanceof ExchangeNode
- && result.first.isSerialOperator()
- && fragment.useSerialSource(translatorContext.getConnectContext())) {
- return Pair.of(
- new LocalExchangeNode(translatorContext.nextPlanNodeId(), result.first,
- LocalExchangeType.PASSTHROUGH, null),
- result.second);
+ return child.enforceAndDeriveLocalExchange(translatorContext, this, requireChild);
}
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org