Zoltan Borok-Nagy has uploaded this change for review. ( 
https://gerrit.cloudera.org/25588


Change subject: PROTOTYPE IMPALA-15655: Co-locate CTE consumers with CTE 
producer instances
......................................................................

PROTOTYPE IMPALA-15655: Co-locate CTE consumers with CTE producer instances

With COMPUTE_PROCESSING_COST, a CTE producer fragment over a scan gets
at most ceil(effective_instance_count / num_hosts) instances per host,
so skewed scan ranges give it more or fewer instances than planned. The
consumer fragment spread its own effective_instance_count evenly over
the producer's hosts, capped by max_parallelism_per_node, instead of
following the producer. The scheduler links the i-th producer instance
on a host to the i-th consumer instance there, guarded only by DCHECKs.
A host with more producer than consumer instances made it read past
the per-host vector: the coordinator crashed in admission, or a
producer waited forever in LocalExchanger::Release() for a consumer
that did not exist. A producer host without any consumer instance got
an exchanger with no consumers, and its rows were lost. TPC-DS q18 hit
this at SF10000 with CTE_THRESHOLD=1.

A fragment with a CTE consumer now copies the instances of its CTE
producer input, whatever its effective_instance_count is. Unions
already ran at least as many instances per host as each input; only a
DCHECK there is relaxed. Linking a producer instance without a consumer
instance on its host is now an error, and so is a CTE producer instance
with a LocalMultiSink but no consumers, which would drop its rows.

Without COMPUTE_PROCESSING_COST, consumer fragments already copied
their producer, except when another input of the fragment had more
instances, or when tuple caching made the planner set an
effective_instance_count. These cases follow the producer now, too.
MAX_FS_WRITERS and the Kudu writer cap no longer limit a fragment with
a CTE consumer.

Testing:
- Added SchedulerTest.CteLinks* tests; 11 of the 12 fail DCHECKs
  without the fix.
- Ran all SchedulerTest and AdmissionControllerTest tests.
- Full TPC-DS SF10000, PLANNER=CALCITE, CTE_THRESHOLD=1,
  COMPUTE_PROCESSING_COST=true, 12 executors with 16 vCPUs and 3 with
  64 vCPUs, on top of other prototypes: the coordinator no longer
  crashes on q14_1, and in the checked profiles every CTE consumer
  received all rows of its producer.

Change-Id: I2a07367696c067a52d2cd2b89edcfca58e8f4c4a
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M be/src/exec/cte-consumer-node.cc
M be/src/exec/cte-producer-node.cc
M be/src/scheduling/scheduler-test-util.h
M be/src/scheduling/scheduler-test.cc
M be/src/scheduling/scheduler.cc
M be/src/scheduling/scheduler.h
6 files changed, 594 insertions(+), 41 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/88/25588/1
--
To view, visit https://gerrit.cloudera.org/25588
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a07367696c067a52d2cd2b89edcfca58e8f4c4a
Gerrit-Change-Number: 25588
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>

Reply via email to