Skip to content

Feature: dispatch T_CustomScanState in CBDB parallel walkers#1855

Open
roseduan wants to merge 1 commit into
apache:mainfrom
roseduan:feature/dispatch-customscanstate-parallel-walkers
Open

Feature: dispatch T_CustomScanState in CBDB parallel walkers#1855
roseduan wants to merge 1 commit into
apache:mainfrom
roseduan:feature/dispatch-customscanstate-parallel-walkers

Conversation

@roseduan

Copy link
Copy Markdown
Contributor

Three GP-side walkers used during parallel setup — EstimateGpParallelDSMEntrySize, InitializeGpParallelWorkers, InitializeGpParallelDSMEntry — cased on other scan/join states but skipped T_CustomScanState. A parallel_aware CustomScan therefore silently under-sized its DSM and failed to attach in workers, with no diagnostic.

Add T_CustomScanState arms that dispatch to
ExecCustomScan{Estimate,InitializeDSM,InitializeWorker}, gated on parallel_aware to match the other node types in these switches.

Also handle T_CustomScanState in planstate_walk_kids. Upstream planstate_tree_walker walks only css->custom_ps for a CustomScanState; the CBDB walker previously fell through to default (lefttree/righttree), skipping custom_ps children under stateful walkers (cdbexplain_*, getMotionState, ...). The new case walks custom_ps first, then lefttree/righttree if set, with an Assert that a CustomScanState never populates both — otherwise the child would be walked twice.

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


Three GP-side walkers used during parallel setup —
EstimateGpParallelDSMEntrySize, InitializeGpParallelWorkers,
InitializeGpParallelDSMEntry — cased on other scan/join states but
skipped T_CustomScanState.  A parallel_aware CustomScan therefore
silently under-sized its DSM and failed to attach in workers, with
no diagnostic.

Add T_CustomScanState arms that dispatch to
ExecCustomScan{Estimate,InitializeDSM,InitializeWorker}, gated on
parallel_aware to match the other node types in these switches.

Also handle T_CustomScanState in planstate_walk_kids. Upstream
planstate_tree_walker walks only css->custom_ps for a
CustomScanState; the CBDB walker previously fell through to
default (lefttree/righttree), skipping custom_ps children under
stateful walkers (cdbexplain_*, getMotionState, ...).  The new
case walks custom_ps first, then lefttree/righttree if set, with
an Assert that a CustomScanState never populates both — otherwise
the child would be walked twice.
ExecSortEstimate((SortState *) planstate, pctx);
break;
case T_CustomScanState:
if (planstate->plan->parallel_aware)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a customscan test case.

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.

3 participants