mirror of https://github.com/citusdata/citus.git
add zero shard query
parent
983163761f
commit
1c1803dd3b
|
@ -127,6 +127,12 @@ RouterExecutablePlan(MultiPlan *multiPlan, MultiExecutorType executorType)
|
|||
List *workerDependentTaskList = NIL;
|
||||
bool masterQueryHasAggregates = false;
|
||||
|
||||
/* TODO: this is a hacky solution to allow 0 shard INSERT ... SELECT */
|
||||
if (masterQuery == NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* router executor cannot execute queries that hit zero shards */
|
||||
if (taskCount == 0)
|
||||
{
|
||||
|
|
|
@ -261,9 +261,6 @@ CreateMultiTaskRouterPlan(Query *originalQuery, Query *query,
|
|||
++taskIdIndex;
|
||||
}
|
||||
|
||||
/* there should be a least a single task */
|
||||
Assert(sqlTaskList != NIL);
|
||||
|
||||
/* Create the worker job */
|
||||
workerJob = CitusMakeNode(Job);
|
||||
workerJob->taskList = sqlTaskList;
|
||||
|
@ -360,7 +357,7 @@ CreateMultipleTaskRouterModifyTask(Query *originalQuery, Query *query,
|
|||
}
|
||||
|
||||
/* Ensure that we have INSERTed table's placement exists on the same worker */
|
||||
insertShardPlacementList = ShardPlacementList(shardId);
|
||||
insertShardPlacementList = FinalizedShardPlacementList(shardId);
|
||||
intersectedPlacementList = IntersectPlacementList(insertShardPlacementList,
|
||||
selectPlacementList);
|
||||
|
||||
|
|
|
@ -223,6 +223,54 @@ DEBUG: Plan is router executable
|
|||
DEBUG: CommitTransactionCommand
|
||||
DEBUG: CommitTransaction
|
||||
DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
|
||||
-- a zero shard select
|
||||
INSERT INTO raw_events_second (value_2, value_1, value_3, value_4, user_id, time)
|
||||
SELECT
|
||||
value_2, value_1, value_3, value_4, user_id, time
|
||||
FROM
|
||||
raw_events_first
|
||||
WHERE
|
||||
false;
|
||||
DEBUG: StartTransactionCommand
|
||||
DEBUG: StartTransaction
|
||||
DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: ProcessQuery
|
||||
DEBUG: Plan is router executable
|
||||
DEBUG: CommitTransactionCommand
|
||||
DEBUG: CommitTransaction
|
||||
DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
|
||||
-- another zero shard select
|
||||
INSERT INTO raw_events_second (value_2, value_1, value_3, value_4, user_id, time)
|
||||
SELECT
|
||||
value_2, value_1, value_3, value_4, user_id, time
|
||||
FROM
|
||||
raw_events_first
|
||||
WHERE
|
||||
0 != 0;
|
||||
DEBUG: StartTransactionCommand
|
||||
DEBUG: StartTransaction
|
||||
DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: skipping the task
|
||||
DETAIL: Insert query hits 2 placements, Select query hits 1 placements and only 1 of those placements match.
|
||||
DEBUG: ProcessQuery
|
||||
DEBUG: Plan is router executable
|
||||
DEBUG: CommitTransactionCommand
|
||||
DEBUG: CommitTransaction
|
||||
DEBUG: name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
|
||||
-- add one more row
|
||||
SET client_min_messages TO INFO;
|
||||
DEBUG: StartTransactionCommand
|
||||
|
|
|
@ -82,6 +82,24 @@ FROM
|
|||
WHERE
|
||||
user_id = 8;
|
||||
|
||||
-- a zero shard select
|
||||
INSERT INTO raw_events_second (value_2, value_1, value_3, value_4, user_id, time)
|
||||
SELECT
|
||||
value_2, value_1, value_3, value_4, user_id, time
|
||||
FROM
|
||||
raw_events_first
|
||||
WHERE
|
||||
false;
|
||||
|
||||
|
||||
-- another zero shard select
|
||||
INSERT INTO raw_events_second (value_2, value_1, value_3, value_4, user_id, time)
|
||||
SELECT
|
||||
value_2, value_1, value_3, value_4, user_id, time
|
||||
FROM
|
||||
raw_events_first
|
||||
WHERE
|
||||
0 != 0;
|
||||
|
||||
-- add one more row
|
||||
SET client_min_messages TO INFO;
|
||||
|
|
Loading…
Reference in New Issue