forked from greenplum-db/gpdb-archive
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrong allocation of writer slice in case of modifying shared CTE (#…
…660) Initially, when the CTE was first encountered, the create_ctescan_plan() function constructed a subplan, and its slice was assigned the GANGTYPE_PRIMARY_WRITER gang type. However, for subsequent occurrences of the CTE, the subplan construction was bypassed. If these occurrences were located in different slices and the CTE involved DML, their slices would sometimes be assigned the GANGTYPE_PRIMARY_WRITER gang type. This lead to issues when the ShareInputScans were assigned producer and consumer roles by the apply_shareinput_dag_to_tree(), which uses a specific tree traversal order, and in some cases, there was a scenario when the consumer was assigned to a GANGTYPE_PRIMARY_WRITER slice, while the producer was placed in a GANGTYPE_PRIMARY_READER slice, resulting in an execution error when the reader gang attempted to execute a ModifyTable node. To resolve this issue, the patch introduces a check for the gang type of root->curSlice when creating the shared plan for the first time. If the gang type has changed compared to its previous value during planning, the ShareInputScan is marked as a writer slice maker by setting the rootSliceIsWriter flag to true. This state is also applied to all subsequent occurrences of the CTE. After assigning consumer and producer roles to each ShareInputScan, the correct gang type is set for the producer (GANGTYPE_PRIMARY_WRITER) and for the consumers (GANGTYPE_PRIMARY_READER, if the consumer is in a different slice from the producer) within the shareinput_mutator_xslice_2() function. This ensures that the gang type is correctly assigned, preventing the execution error encountered in the original scenario. Co-authored-by: Alexander Kondakov <a.kondakov@arenadata.io>
- Loading branch information
1 parent
0f4ebf6
commit 908a851
Showing
11 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters