mirror of https://github.com/citusdata/citus.git
Rename CoordinatorInsertSelect... to NonPushableInsertSelect
parent
cd25a27174
commit
d34c21890f
|
@ -49,7 +49,7 @@
|
||||||
/* functions for creating custom scan nodes */
|
/* functions for creating custom scan nodes */
|
||||||
static Node * AdaptiveExecutorCreateScan(CustomScan *scan);
|
static Node * AdaptiveExecutorCreateScan(CustomScan *scan);
|
||||||
static Node * TaskTrackerCreateScan(CustomScan *scan);
|
static Node * TaskTrackerCreateScan(CustomScan *scan);
|
||||||
static Node * CoordinatorInsertSelectCreateScan(CustomScan *scan);
|
static Node * NonPushableInsertSelectCreateScan(CustomScan *scan);
|
||||||
static Node * DelayedErrorCreateScan(CustomScan *scan);
|
static Node * DelayedErrorCreateScan(CustomScan *scan);
|
||||||
|
|
||||||
/* functions that are common to different scans */
|
/* functions that are common to different scans */
|
||||||
|
@ -77,9 +77,9 @@ CustomScanMethods TaskTrackerCustomScanMethods = {
|
||||||
TaskTrackerCreateScan
|
TaskTrackerCreateScan
|
||||||
};
|
};
|
||||||
|
|
||||||
CustomScanMethods CoordinatorInsertSelectCustomScanMethods = {
|
CustomScanMethods NonPushableInsertSelectCustomScanMethods = {
|
||||||
"Citus INSERT ... SELECT",
|
"Citus INSERT ... SELECT",
|
||||||
CoordinatorInsertSelectCreateScan
|
NonPushableInsertSelectCreateScan
|
||||||
};
|
};
|
||||||
|
|
||||||
CustomScanMethods DelayedErrorCustomScanMethods = {
|
CustomScanMethods DelayedErrorCustomScanMethods = {
|
||||||
|
@ -109,13 +109,13 @@ static CustomExecMethods TaskTrackerCustomExecMethods = {
|
||||||
.ExplainCustomScan = CitusExplainScan
|
.ExplainCustomScan = CitusExplainScan
|
||||||
};
|
};
|
||||||
|
|
||||||
static CustomExecMethods CoordinatorInsertSelectCustomExecMethods = {
|
static CustomExecMethods NonPushableInsertSelectCustomExecMethods = {
|
||||||
.CustomName = "CoordinatorInsertSelectScan",
|
.CustomName = "NonPushableInsertSelectScan",
|
||||||
.BeginCustomScan = CitusBeginScan,
|
.BeginCustomScan = CitusBeginScan,
|
||||||
.ExecCustomScan = CoordinatorInsertSelectExecScan,
|
.ExecCustomScan = NonPushableInsertSelectExecScan,
|
||||||
.EndCustomScan = CitusEndScan,
|
.EndCustomScan = CitusEndScan,
|
||||||
.ReScanCustomScan = CitusReScan,
|
.ReScanCustomScan = CitusReScan,
|
||||||
.ExplainCustomScan = CoordinatorInsertSelectExplainScan
|
.ExplainCustomScan = NonPushableInsertSelectExplainScan
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ IsCitusCustomState(PlanState *planState)
|
||||||
CustomScanState *css = castNode(CustomScanState, planState);
|
CustomScanState *css = castNode(CustomScanState, planState);
|
||||||
if (css->methods == &AdaptiveExecutorCustomExecMethods ||
|
if (css->methods == &AdaptiveExecutorCustomExecMethods ||
|
||||||
css->methods == &TaskTrackerCustomExecMethods ||
|
css->methods == &TaskTrackerCustomExecMethods ||
|
||||||
css->methods == &CoordinatorInsertSelectCustomExecMethods)
|
css->methods == &NonPushableInsertSelectCustomExecMethods)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ RegisterCitusCustomScanMethods(void)
|
||||||
{
|
{
|
||||||
RegisterCustomScanMethods(&AdaptiveExecutorCustomScanMethods);
|
RegisterCustomScanMethods(&AdaptiveExecutorCustomScanMethods);
|
||||||
RegisterCustomScanMethods(&TaskTrackerCustomScanMethods);
|
RegisterCustomScanMethods(&TaskTrackerCustomScanMethods);
|
||||||
RegisterCustomScanMethods(&CoordinatorInsertSelectCustomScanMethods);
|
RegisterCustomScanMethods(&NonPushableInsertSelectCustomScanMethods);
|
||||||
RegisterCustomScanMethods(&DelayedErrorCustomScanMethods);
|
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.
|
* INSERT..SELECT into a distributed table via the coordinator.
|
||||||
*/
|
*/
|
||||||
static Node *
|
static Node *
|
||||||
CoordinatorInsertSelectCreateScan(CustomScan *scan)
|
NonPushableInsertSelectCreateScan(CustomScan *scan)
|
||||||
{
|
{
|
||||||
CitusScanState *scanState = palloc0(sizeof(CitusScanState));
|
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->customScanState.ss.ps.type = T_CustomScanState;
|
||||||
scanState->distributedPlan = GetDistributedPlan(scan);
|
scanState->distributedPlan = GetDistributedPlan(scan);
|
||||||
|
|
||||||
scanState->customScanState.methods =
|
scanState->customScanState.methods =
|
||||||
&CoordinatorInsertSelectCustomExecMethods;
|
&NonPushableInsertSelectCustomExecMethods;
|
||||||
|
|
||||||
return (Node *) scanState;
|
return (Node *) scanState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ bool EnableRepartitionedInsertSelect = true;
|
||||||
static int insertSelectExecutorLevel = 0;
|
static int insertSelectExecutorLevel = 0;
|
||||||
|
|
||||||
|
|
||||||
static TupleTableSlot * CoordinatorInsertSelectExecScanInternal(CustomScanState *node);
|
static TupleTableSlot * NonPushableInsertSelectExecScanInternal(CustomScanState *node);
|
||||||
static Query * WrapSubquery(Query *subquery);
|
static Query * WrapSubquery(Query *subquery);
|
||||||
static List * TwoPhaseInsertSelectTaskList(Oid targetRelationId, Query *insertSelectQuery,
|
static List * TwoPhaseInsertSelectTaskList(Oid targetRelationId, Query *insertSelectQuery,
|
||||||
char *resultIdPrefix);
|
char *resultIdPrefix);
|
||||||
|
@ -85,19 +85,19 @@ static void RelableTargetEntryList(List *selectTargetList, List *insertTargetLis
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CoordinatorInsertSelectExecScan is a wrapper around
|
* NonPushableInsertSelectExecScan is a wrapper around
|
||||||
* CoordinatorInsertSelectExecScanInternal which also properly increments
|
* NonPushableInsertSelectExecScanInternal which also properly increments
|
||||||
* or decrements insertSelectExecutorLevel.
|
* or decrements insertSelectExecutorLevel.
|
||||||
*/
|
*/
|
||||||
TupleTableSlot *
|
TupleTableSlot *
|
||||||
CoordinatorInsertSelectExecScan(CustomScanState *node)
|
NonPushableInsertSelectExecScan(CustomScanState *node)
|
||||||
{
|
{
|
||||||
TupleTableSlot *result = NULL;
|
TupleTableSlot *result = NULL;
|
||||||
insertSelectExecutorLevel++;
|
insertSelectExecutorLevel++;
|
||||||
|
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
result = CoordinatorInsertSelectExecScanInternal(node);
|
result = NonPushableInsertSelectExecScanInternal(node);
|
||||||
}
|
}
|
||||||
PG_CATCH();
|
PG_CATCH();
|
||||||
{
|
{
|
||||||
|
@ -112,13 +112,12 @@ CoordinatorInsertSelectExecScan(CustomScanState *node)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CoordinatorInsertSelectExecScan executes an INSERT INTO distributed_table
|
* NonPushableInsertSelectExecScan executes an INSERT INTO distributed_table
|
||||||
* SELECT .. query by setting up a DestReceiver that copies tuples into the
|
* SELECT .. query either by routing via coordinator or by repartitioning
|
||||||
* distributed table and then executing the SELECT query using that DestReceiver
|
* task results and moving data directly between nodes.
|
||||||
* as the tuple destination.
|
|
||||||
*/
|
*/
|
||||||
static TupleTableSlot *
|
static TupleTableSlot *
|
||||||
CoordinatorInsertSelectExecScanInternal(CustomScanState *node)
|
NonPushableInsertSelectExecScanInternal(CustomScanState *node)
|
||||||
{
|
{
|
||||||
CitusScanState *scanState = (CitusScanState *) node;
|
CitusScanState *scanState = (CitusScanState *) node;
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ JobExecutorType(DistributedPlan *distributedPlan)
|
||||||
* the executor already knows how to handle adaptive
|
* the executor already knows how to handle adaptive
|
||||||
* executor when necessary.
|
* executor when necessary.
|
||||||
*/
|
*/
|
||||||
return MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT;
|
return MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert(distributedPlan->modLevel == ROW_MODIFY_READONLY);
|
Assert(distributedPlan->modLevel == ROW_MODIFY_READONLY);
|
||||||
|
|
|
@ -99,7 +99,7 @@ CitusExecutorName(MultiExecutorType executorType)
|
||||||
return "task-tracker";
|
return "task-tracker";
|
||||||
}
|
}
|
||||||
|
|
||||||
case MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT:
|
case MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT:
|
||||||
{
|
{
|
||||||
return "insert-select";
|
return "insert-select";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1295,9 +1295,9 @@ FinalizePlan(PlannedStmt *localPlan, DistributedPlan *distributedPlan)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT:
|
case MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT:
|
||||||
{
|
{
|
||||||
customScan->methods = &CoordinatorInsertSelectCustomScanMethods;
|
customScan->methods = &NonPushableInsertSelectCustomScanMethods;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
void
|
||||||
CoordinatorInsertSelectExplainScan(CustomScanState *node, List *ancestors,
|
NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors,
|
||||||
struct ExplainState *es)
|
struct ExplainState *es)
|
||||||
{
|
{
|
||||||
CitusScanState *scanState = (CitusScanState *) node;
|
CitusScanState *scanState = (CitusScanState *) node;
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct CitusScanState
|
||||||
/* custom scan methods for all executors */
|
/* custom scan methods for all executors */
|
||||||
extern CustomScanMethods AdaptiveExecutorCustomScanMethods;
|
extern CustomScanMethods AdaptiveExecutorCustomScanMethods;
|
||||||
extern CustomScanMethods TaskTrackerCustomScanMethods;
|
extern CustomScanMethods TaskTrackerCustomScanMethods;
|
||||||
extern CustomScanMethods CoordinatorInsertSelectCustomScanMethods;
|
extern CustomScanMethods NonPushableInsertSelectCustomScanMethods;
|
||||||
extern CustomScanMethods DelayedErrorCustomScanMethods;
|
extern CustomScanMethods DelayedErrorCustomScanMethods;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
extern bool EnableRepartitionedInsertSelect;
|
extern bool EnableRepartitionedInsertSelect;
|
||||||
|
|
||||||
extern TupleTableSlot * CoordinatorInsertSelectExecScan(CustomScanState *node);
|
extern TupleTableSlot * NonPushableInsertSelectExecScan(CustomScanState *node);
|
||||||
extern bool ExecutingInsertSelect(void);
|
extern bool ExecutingInsertSelect(void);
|
||||||
extern Query * BuildSelectForInsertSelect(Query *insertSelectQuery);
|
extern Query * BuildSelectForInsertSelect(Query *insertSelectQuery);
|
||||||
extern bool IsSupportedRedistributionTarget(Oid targetRelationId);
|
extern bool IsSupportedRedistributionTarget(Oid targetRelationId);
|
||||||
|
|
|
@ -29,7 +29,7 @@ extern bool InsertSelectIntoLocalTable(Query *query);
|
||||||
extern Query * ReorderInsertSelectTargetLists(Query *originalQuery,
|
extern Query * ReorderInsertSelectTargetLists(Query *originalQuery,
|
||||||
RangeTblEntry *insertRte,
|
RangeTblEntry *insertRte,
|
||||||
RangeTblEntry *subqueryRte);
|
RangeTblEntry *subqueryRte);
|
||||||
extern void CoordinatorInsertSelectExplainScan(CustomScanState *node, List *ancestors,
|
extern void NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors,
|
||||||
struct ExplainState *es);
|
struct ExplainState *es);
|
||||||
extern DistributedPlan * CreateInsertSelectPlan(uint64 planId, Query *originalQuery,
|
extern DistributedPlan * CreateInsertSelectPlan(uint64 planId, Query *originalQuery,
|
||||||
PlannerRestrictionContext *
|
PlannerRestrictionContext *
|
||||||
|
|
|
@ -88,7 +88,7 @@ typedef enum
|
||||||
MULTI_EXECUTOR_INVALID_FIRST = 0,
|
MULTI_EXECUTOR_INVALID_FIRST = 0,
|
||||||
MULTI_EXECUTOR_ADAPTIVE = 1,
|
MULTI_EXECUTOR_ADAPTIVE = 1,
|
||||||
MULTI_EXECUTOR_TASK_TRACKER = 2,
|
MULTI_EXECUTOR_TASK_TRACKER = 2,
|
||||||
MULTI_EXECUTOR_COORDINATOR_INSERT_SELECT = 3
|
MULTI_EXECUTOR_NON_PUSHABLE_INSERT_SELECT = 3
|
||||||
} MultiExecutorType;
|
} MultiExecutorType;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue