mirror of https://github.com/citusdata/citus.git
Merge pull request #2598 from citusdata/fix_router_errors
Queries with only intermediate results do not rely on task assignment policypull/2590/head
commit
501eaebe77
|
@ -1630,10 +1630,15 @@ RouterJob(Query *originalQuery, PlannerRestrictionContext *plannerRestrictionCon
|
||||||
* Queries to reference tables, or distributed tables with multiple replica's have
|
* Queries to reference tables, or distributed tables with multiple replica's have
|
||||||
* their task placements reordered according to the configured
|
* their task placements reordered according to the configured
|
||||||
* task_assignment_policy. This is only applicable to select queries as the modify
|
* task_assignment_policy. This is only applicable to select queries as the modify
|
||||||
* queries will be reordered to _always_ use the first-replica policy during
|
* queries will _always_ be executed on all placements.
|
||||||
* execution.
|
*
|
||||||
|
* We also ignore queries that are targeting only intermediate results (e.g., no
|
||||||
|
* valid anchorShardId).
|
||||||
*/
|
*/
|
||||||
ReorderTaskPlacementsByTaskAssignmentPolicy(job, TaskAssignmentPolicy);
|
if (shardId != INVALID_SHARD_ID)
|
||||||
|
{
|
||||||
|
ReorderTaskPlacementsByTaskAssignmentPolicy(job, TaskAssignmentPolicy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (isMultiShardModifyQuery)
|
else if (isMultiShardModifyQuery)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,3 +212,25 @@ DEBUG: Plan is router executable
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
-- we should be able to use round-robin with router queries that
|
||||||
|
-- only contains intermediate results
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE task_assignment_test_table_2 (test_id integer);
|
||||||
|
SELECT create_distributed_table('task_assignment_test_table_2', 'test_id');
|
||||||
|
create_distributed_table
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
WITH q1 AS (SELECT * FROM task_assignment_test_table_2) SELECT * FROM q1;
|
||||||
|
test_id
|
||||||
|
---------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
SET LOCAL citus.task_assignment_policy TO 'round-robin';
|
||||||
|
WITH q1 AS (SELECT * FROM task_assignment_test_table_2) SELECT * FROM q1;
|
||||||
|
test_id
|
||||||
|
---------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
ROLLBACK;
|
||||||
|
|
|
@ -118,4 +118,19 @@ SET LOCAL citus.task_assignment_policy TO 'round-robin';
|
||||||
EXPLAIN (COSTS FALSE) SELECT * FROM task_assignment_reference_table;
|
EXPLAIN (COSTS FALSE) SELECT * FROM task_assignment_reference_table;
|
||||||
EXPLAIN (COSTS FALSE) SELECT * FROM task_assignment_reference_table;
|
EXPLAIN (COSTS FALSE) SELECT * FROM task_assignment_reference_table;
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- we should be able to use round-robin with router queries that
|
||||||
|
-- only contains intermediate results
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE task_assignment_test_table_2 (test_id integer);
|
||||||
|
SELECT create_distributed_table('task_assignment_test_table_2', 'test_id');
|
||||||
|
|
||||||
|
WITH q1 AS (SELECT * FROM task_assignment_test_table_2) SELECT * FROM q1;
|
||||||
|
SET LOCAL citus.task_assignment_policy TO 'round-robin';
|
||||||
|
WITH q1 AS (SELECT * FROM task_assignment_test_table_2) SELECT * FROM q1;
|
||||||
|
ROLLBACK;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue