Skip to content

Conversation

@avamingli
Copy link
Contributor

Fix #1269

The issue occurs when ShareInputScan nodes are reused multiple times during explain with append info in deparse_context_for_plan_tree().

Address that by marking only the producer of ShareInputScan with the same share_id to prevent the crash.
This ensures proper handling of shared scan nodes during plan tree deparsing.

Authored-by: Zhang Mingli [email protected]

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


@avamingli avamingli force-pushed the fix_share_input_scan branch 2 times, most recently from 578fd99 to d806cce Compare August 13, 2025 15:10
@my-ship-it
Copy link
Contributor

LGTM

@avamingli avamingli force-pushed the fix_share_input_scan branch from d806cce to d73c119 Compare August 20, 2025 07:53
The issue occurs when ShareInputScan nodes are reused multiple times
during explain with append info in deparse_context_for_plan_tree().

Address that by marking only the producer of ShareInputScan with
the same share_id to prevent the crash.
This ensures proper handling of shared scan nodes during plan tree deparsing.

Authored-by: Zhang Mingli [email protected]
This adds the complex TPC-DS Query 04 as a test case to verify a bug
that caused crashes when gp_cte_sharing=on in the planner.

The issue was difficult to reproduce with simpler queries, requiring
the full complexity of TPC-DS Query 04 to properly manifest. The crash
occurred during planning when CTE sharing was enabled.

Adding this test will help prevent regression of this specific planner
issue. While not a minimal reproduction case, the full query is
necessary to reliably trigger the problematic behavior.

Authored-by: Zhang Mingli [email protected]
@avamingli avamingli force-pushed the fix_share_input_scan branch from d73c119 to c9f8188 Compare August 20, 2025 09:34
@avamingli avamingli merged commit 9c8351f into apache:main Aug 20, 2025
27 checks passed
@avamingli avamingli deleted the fix_share_input_scan branch August 20, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CTE query crashed when gp_cte_sharing is on

3 participants