From d34c21890fe86776d9b79bd2ce6ca789306823f7 Mon Sep 17 00:00:00 2001 From: Hadi Moshayedi Date: Wed, 24 Jun 2020 23:50:21 -0700 Subject: [PATCH] Rename CoordinatorInsertSelect... to NonPushableInsertSelect --- .../distributed/executor/citus_custom_scan.c | 26 +++++++++---------- .../executor/insert_select_executor.c | 19 +++++++------- .../executor/multi_server_executor.c | 2 +- .../distributed/executor/query_stats.c | 2 +- .../distributed/planner/distributed_planner.c | 4 +-- .../distributed/planner/multi_explain.c | 7 ++--- src/include/distributed/citus_custom_scan.h | 2 +- .../distributed/insert_select_executor.h | 2 +- .../distributed/insert_select_planner.h | 2 +- .../distributed/multi_server_executor.h | 2 +- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/backend/distributed/executor/citus_custom_scan.c b/src/backend/distributed/executor/citus_custom_scan.c index 537f1a6bd..81d6cef87 100644 --- a/src/backend/distributed/executor/citus_custom_scan.c +++ b/src/backend/distributed/executor/citus_custom_scan.c @@ -49,7 +49,7 @@ /* functions for creating custom scan nodes */ static Node * AdaptiveExecutorCreateScan(CustomScan *scan); static Node * TaskTrackerCreateScan(CustomScan *scan); -static Node * CoordinatorInsertSelectCreateScan(CustomScan *scan); +static Node * NonPushableInsertSelectCreateScan(CustomScan *scan); static Node * DelayedErrorCreateScan(CustomScan *scan); /* functions that are common to different scans */ @@ -77,9 +77,9 @@ CustomScanMethods TaskTrackerCustomScanMethods = { TaskTrackerCreateScan }; -CustomScanMethods CoordinatorInsertSelectCustomScanMethods = { +CustomScanMethods NonPushableInsertSelectCustomScanMethods = { "Citus INSERT ... SELECT", - CoordinatorInsertSelectCreateScan + NonPushableInsertSelectCreateScan }; CustomScanMethods DelayedErrorCustomScanMethods = { @@ -109,13 +109,13 @@ static CustomExecMethods TaskTrackerCustomExecMethods = { .ExplainCustomScan = CitusExplainScan }; -static CustomExecMethods CoordinatorInsertSelectCustomExecMethods = { - .CustomName = "CoordinatorInsertSelectScan", +static CustomExecMethods NonPushableInsertSelectCustomExecMethods = { + .CustomName = "NonPushableInsertSelectScan", .BeginCustomScan = CitusBeginScan, - .ExecCustomScan = CoordinatorInsertSelectExecScan, + .ExecCustomScan = NonPushableInsertSelectExecScan, .EndCustomScan = CitusEndScan, .ReScanCustomScan = CitusReScan, - .ExplainCustomScan = CoordinatorInsertSelectExplainScan + .ExplainCustomScan = NonPushableInsertSelectExplainScan }; @@ -133,7 +133,7 @@ IsCitusCustomState(PlanState *planState) CustomScanState *css = castNode(CustomScanState, planState); if (css->methods == &AdaptiveExecutorCustomExecMethods || css->methods == &TaskTrackerCustomExecMethods || - css->methods == &CoordinatorInsertSelectCustomExecMethods) + css->methods == &NonPushableInsertSelectCustomExecMethods) { return true; } @@ -150,7 +150,7 @@ RegisterCitusCustomScanMethods(void) { RegisterCustomScanMethods(&AdaptiveExecutorCustomScanMethods); RegisterCustomScanMethods(&TaskTrackerCustomScanMethods); - RegisterCustomScanMethods(&CoordinatorInsertSelectCustomScanMethods); + RegisterCustomScanMethods(&NonPushableInsertSelectCustomScanMethods); RegisterCustomScanMethods(&DelayedErrorCustomScanMethods); } @@ -598,20 +598,20 @@ TaskTrackerCreateScan(CustomScan *scan) /* - * CoordinatorInsertSelectCrateScan creates the scan state for executing + * NonPushableInsertSelectCrateScan creates the scan state for executing * INSERT..SELECT into a distributed table via the coordinator. */ static Node * -CoordinatorInsertSelectCreateScan(CustomScan *scan) +NonPushableInsertSelectCreateScan(CustomScan *scan) { CitusScanState *scanState = palloc0(sizeof(CitusScanState)); - scanState->executorType = MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT; + scanState->executorType = MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT; scanState->customScanState.ss.ps.type = T_CustomScanState; scanState->distributedPlan = GetDistributedPlan(scan); scanState->customScanState.methods = - &CoordinatorInsertSelectCustomExecMethods; + &NonPushableInsertSelectCustomExecMethods; return (Node *) scanState; } diff --git a/src/backend/distributed/executor/insert_select_executor.c b/src/backend/distributed/executor/insert_select_executor.c index 276d98c92..e0e0d1d19 100644 --- a/src/backend/distributed/executor/insert_select_executor.c +++ b/src/backend/distributed/executor/insert_select_executor.c @@ -57,7 +57,7 @@ bool EnableRepartitionedInsertSelect = true; static int insertSelectExecutorLevel = 0; -static TupleTableSlot * CoordinatorInsertSelectExecScanInternal(CustomScanState *node); +static TupleTableSlot * NonPushableInsertSelectExecScanInternal(CustomScanState *node); static Query * WrapSubquery(Query *subquery); static List * TwoPhaseInsertSelectTaskList(Oid targetRelationId, Query *insertSelectQuery, char *resultIdPrefix); @@ -85,19 +85,19 @@ static void RelableTargetEntryList(List *selectTargetList, List *insertTargetLis /* - * CoordinatorInsertSelectExecScan is a wrapper around - * CoordinatorInsertSelectExecScanInternal which also properly increments + * NonPushableInsertSelectExecScan is a wrapper around + * NonPushableInsertSelectExecScanInternal which also properly increments * or decrements insertSelectExecutorLevel. */ TupleTableSlot * -CoordinatorInsertSelectExecScan(CustomScanState *node) +NonPushableInsertSelectExecScan(CustomScanState *node) { TupleTableSlot *result = NULL; insertSelectExecutorLevel++; PG_TRY(); { - result = CoordinatorInsertSelectExecScanInternal(node); + result = NonPushableInsertSelectExecScanInternal(node); } PG_CATCH(); { @@ -112,13 +112,12 @@ CoordinatorInsertSelectExecScan(CustomScanState *node) /* - * CoordinatorInsertSelectExecScan executes an INSERT INTO distributed_table - * SELECT .. query by setting up a DestReceiver that copies tuples into the - * distributed table and then executing the SELECT query using that DestReceiver - * as the tuple destination. + * NonPushableInsertSelectExecScan executes an INSERT INTO distributed_table + * SELECT .. query either by routing via coordinator or by repartitioning + * task results and moving data directly between nodes. */ static TupleTableSlot * -CoordinatorInsertSelectExecScanInternal(CustomScanState *node) +NonPushableInsertSelectExecScanInternal(CustomScanState *node) { CitusScanState *scanState = (CitusScanState *) node; diff --git a/src/backend/distributed/executor/multi_server_executor.c b/src/backend/distributed/executor/multi_server_executor.c index d7b003677..fec24d191 100644 --- a/src/backend/distributed/executor/multi_server_executor.c +++ b/src/backend/distributed/executor/multi_server_executor.c @@ -88,7 +88,7 @@ JobExecutorType(DistributedPlan *distributedPlan) * the executor already knows how to handle adaptive * executor when necessary. */ - return MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT; + return MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT; } Assert(distributedPlan->modLevel == ROW_MODIFY_READONLY); diff --git a/src/backend/distributed/executor/query_stats.c b/src/backend/distributed/executor/query_stats.c index 7f9493c72..04e6002c2 100644 --- a/src/backend/distributed/executor/query_stats.c +++ b/src/backend/distributed/executor/query_stats.c @@ -99,7 +99,7 @@ CitusExecutorName(MultiExecutorType executorType) return "task-tracker"; } - case MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT: + case MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT: { return "insert-select"; } diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index 072624025..25a4b95f4 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -1295,9 +1295,9 @@ FinalizePlan(PlannedStmt *localPlan, DistributedPlan *distributedPlan) break; } - case MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT: + case MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT: { - customScan->methods = &CoordinatorInsertSelectCustomScanMethods; + customScan->methods = &NonPushableInsertSelectCustomScanMethods; break; } diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index cf4f089f9..9b20f154f 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -198,12 +198,13 @@ CitusExplainScan(CustomScanState *node, List *ancestors, struct ExplainState *es /* - * CoordinatorInsertSelectExplainScan is a custom scan explain callback function + * NonPushableInsertSelectExplainScan is a custom scan explain callback function * which is used to print explain information of a Citus plan for an INSERT INTO - * distributed_table SELECT ... query that is evaluated on the coordinator. + * distributed_table SELECT ... query that is evaluated on the coordinator or + * uses repartitioning. */ void -CoordinatorInsertSelectExplainScan(CustomScanState *node, List *ancestors, +NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors, struct ExplainState *es) { CitusScanState *scanState = (CitusScanState *) node; diff --git a/src/include/distributed/citus_custom_scan.h b/src/include/distributed/citus_custom_scan.h index 497e5db7d..dcddb27a3 100644 --- a/src/include/distributed/citus_custom_scan.h +++ b/src/include/distributed/citus_custom_scan.h @@ -32,7 +32,7 @@ typedef struct CitusScanState /* custom scan methods for all executors */ extern CustomScanMethods AdaptiveExecutorCustomScanMethods; extern CustomScanMethods TaskTrackerCustomScanMethods; -extern CustomScanMethods CoordinatorInsertSelectCustomScanMethods; +extern CustomScanMethods NonPushableInsertSelectCustomScanMethods; extern CustomScanMethods DelayedErrorCustomScanMethods; diff --git a/src/include/distributed/insert_select_executor.h b/src/include/distributed/insert_select_executor.h index e94c7fe9c..b8151712d 100644 --- a/src/include/distributed/insert_select_executor.h +++ b/src/include/distributed/insert_select_executor.h @@ -18,7 +18,7 @@ extern bool EnableRepartitionedInsertSelect; -extern TupleTableSlot * CoordinatorInsertSelectExecScan(CustomScanState *node); +extern TupleTableSlot * NonPushableInsertSelectExecScan(CustomScanState *node); extern bool ExecutingInsertSelect(void); extern Query * BuildSelectForInsertSelect(Query *insertSelectQuery); extern bool IsSupportedRedistributionTarget(Oid targetRelationId); diff --git a/src/include/distributed/insert_select_planner.h b/src/include/distributed/insert_select_planner.h index 80a61b9aa..bdbcbd16b 100644 --- a/src/include/distributed/insert_select_planner.h +++ b/src/include/distributed/insert_select_planner.h @@ -29,7 +29,7 @@ extern bool InsertSelectIntoLocalTable(Query *query); extern Query * ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte, RangeTblEntry *subqueryRte); -extern void CoordinatorInsertSelectExplainScan(CustomScanState *node, List *ancestors, +extern void NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors, struct ExplainState *es); extern DistributedPlan * CreateInsertSelectPlan(uint64 planId, Query *originalQuery, PlannerRestrictionContext * diff --git a/src/include/distributed/multi_server_executor.h b/src/include/distributed/multi_server_executor.h index d49f09d0c..077adb4d3 100644 --- a/src/include/distributed/multi_server_executor.h +++ b/src/include/distributed/multi_server_executor.h @@ -88,7 +88,7 @@ typedef enum MULTI_EXECUTOR_INVALID_FIRST = 0, MULTI_EXECUTOR_ADAPTIVE = 1, MULTI_EXECUTOR_TASK_TRACKER = 2, - MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT = 3 + MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT = 3 } MultiExecutorType;