From d7fd56df8985f90716451d8de83052676972f881 Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Thu, 5 May 2016 11:49:58 +0300 Subject: [PATCH] Fix check-full failures This commit fixes failures happen during check-full. The change does make clean seperation of executor types in certain places to keep the outputs stable. --- src/test/regress/expected/multi_explain.out | 1 + src/test/regress/expected/multi_explain_0.out | 1 + .../regress/expected/multi_hash_pruning.out | 117 ++++++++++++++---- src/test/regress/sql/multi_explain.sql | 1 + src/test/regress/sql/multi_hash_pruning.sql | 31 ++++- 5 files changed, 124 insertions(+), 27 deletions(-) diff --git a/src/test/regress/expected/multi_explain.out b/src/test/regress/expected/multi_explain.out index 917aa8aac..58fb90d64 100644 --- a/src/test/regress/expected/multi_explain.out +++ b/src/test/regress/expected/multi_explain.out @@ -2,6 +2,7 @@ -- MULTI_EXPLAIN -- \a\t +SET citus.task_executor_type TO 'real-time'; SET citus.explain_distributed_queries TO on; -- Test Text format EXPLAIN (COSTS FALSE, FORMAT TEXT) diff --git a/src/test/regress/expected/multi_explain_0.out b/src/test/regress/expected/multi_explain_0.out index b920cd5fd..88831924f 100644 --- a/src/test/regress/expected/multi_explain_0.out +++ b/src/test/regress/expected/multi_explain_0.out @@ -2,6 +2,7 @@ -- MULTI_EXPLAIN -- \a\t +SET citus.task_executor_type TO 'real-time'; SET citus.explain_distributed_queries TO on; -- Test Text format EXPLAIN (COSTS FALSE, FORMAT TEXT) diff --git a/src/test/regress/expected/multi_hash_pruning.out b/src/test/regress/expected/multi_hash_pruning.out index 458372e91..84a977fce 100644 --- a/src/test/regress/expected/multi_hash_pruning.out +++ b/src/test/regress/expected/multi_hash_pruning.out @@ -31,6 +31,14 @@ SELECT master_create_worker_shards('orders_hash_partitioned', 4, 1); SET client_min_messages TO DEBUG2; -- Check that we can prune shards for simple cases, boolean expressions and -- immutable functions. +-- Since router plans are not triggered for task-tracker executor type, +-- we need to run the tests that triggers router planning seperately for +-- both executors. Otherwise, check-full fails on the task-tracker. +-- Later, we need to switch back to the actual task executor +-- to contuinue with correct executor type for check-full. +SELECT quote_literal(current_setting('citus.task_executor_type')) AS actual_task_executor +\gset +SET citus.task_executor_type TO 'real-time'; SELECT count(*) FROM orders_hash_partitioned; count ------- @@ -81,6 +89,92 @@ DEBUG: Plan is router executable 0 (1 row) +SELECT count(*) FROM orders_hash_partitioned + WHERE o_orderkey = 1 AND o_clerk = 'aaa'; +DEBUG: Creating router plan +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 +DEBUG: Plan is router executable + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); +DEBUG: Creating router plan +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 +DEBUG: Plan is router executable + count +------- + 0 +(1 row) + +SET citus.task_executor_type TO 'task-tracker'; +SELECT count(*) FROM orders_hash_partitioned; + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1; +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2; +DEBUG: predicate pruning for shardId 102033 +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3; +DEBUG: predicate pruning for shardId 102033 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4; +DEBUG: predicate pruning for shardId 102033 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned + WHERE o_orderkey = 1 AND o_clerk = 'aaa'; +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 + count +------- + 0 +(1 row) + +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); +DEBUG: predicate pruning for shardId 102034 +DEBUG: predicate pruning for shardId 102035 +DEBUG: predicate pruning for shardId 102036 + count +------- + 0 +(1 row) + +SET citus.task_executor_type TO :actual_task_executor; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey is NULL; DEBUG: predicate pruning for shardId 102033 DEBUG: predicate pruning for shardId 102034 @@ -118,18 +212,6 @@ SELECT count(*) FROM orders_hash_partitioned 0 (1 row) -SELECT count(*) FROM orders_hash_partitioned - WHERE o_orderkey = 1 AND o_clerk = 'aaa'; -DEBUG: Creating router plan -DEBUG: predicate pruning for shardId 102034 -DEBUG: predicate pruning for shardId 102035 -DEBUG: predicate pruning for shardId 102036 -DEBUG: Plan is router executable - count -------- - 0 -(1 row) - SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'aaa'); DEBUG: predicate pruning for shardId 102035 @@ -158,17 +240,6 @@ DEBUG: predicate pruning for shardId 102036 0 (1 row) -SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); -DEBUG: Creating router plan -DEBUG: predicate pruning for shardId 102034 -DEBUG: predicate pruning for shardId 102035 -DEBUG: predicate pruning for shardId 102036 -DEBUG: Plan is router executable - count -------- - 0 -(1 row) - -- Check that we don't support pruning for ANY (array expression) and give -- a notice message when used with the partition column SELECT count(*) FROM orders_hash_partitioned diff --git a/src/test/regress/sql/multi_explain.sql b/src/test/regress/sql/multi_explain.sql index d079b544d..143ec3a02 100644 --- a/src/test/regress/sql/multi_explain.sql +++ b/src/test/regress/sql/multi_explain.sql @@ -4,6 +4,7 @@ \a\t +SET citus.task_executor_type TO 'real-time'; SET citus.explain_distributed_queries TO on; -- Test Text format diff --git a/src/test/regress/sql/multi_hash_pruning.sql b/src/test/regress/sql/multi_hash_pruning.sql index 9ad2f6038..981b6b22c 100644 --- a/src/test/regress/sql/multi_hash_pruning.sql +++ b/src/test/regress/sql/multi_hash_pruning.sql @@ -27,11 +27,38 @@ SET client_min_messages TO DEBUG2; -- Check that we can prune shards for simple cases, boolean expressions and -- immutable functions. + +-- Since router plans are not triggered for task-tracker executor type, +-- we need to run the tests that triggers router planning seperately for +-- both executors. Otherwise, check-full fails on the task-tracker. +-- Later, we need to switch back to the actual task executor +-- to contuinue with correct executor type for check-full. +SELECT quote_literal(current_setting('citus.task_executor_type')) AS actual_task_executor +\gset + +SET citus.task_executor_type TO 'real-time'; SELECT count(*) FROM orders_hash_partitioned; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4; +SELECT count(*) FROM orders_hash_partitioned + WHERE o_orderkey = 1 AND o_clerk = 'aaa'; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); + + +SET citus.task_executor_type TO 'task-tracker'; +SELECT count(*) FROM orders_hash_partitioned; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 2; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 3; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 4; +SELECT count(*) FROM orders_hash_partitioned + WHERE o_orderkey = 1 AND o_clerk = 'aaa'; +SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); + +SET citus.task_executor_type TO :actual_task_executor; + SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey is NULL; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey is not NULL; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey > 2; @@ -40,8 +67,6 @@ SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1 OR o_orderkey = 2; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1 OR o_clerk = 'aaa'; -SELECT count(*) FROM orders_hash_partitioned - WHERE o_orderkey = 1 AND o_clerk = 'aaa'; SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = 1 OR (o_orderkey = 3 AND o_clerk = 'aaa'); SELECT count(*) FROM orders_hash_partitioned @@ -49,8 +74,6 @@ SELECT count(*) FROM orders_hash_partitioned SELECT count(*) FROM (SELECT o_orderkey FROM orders_hash_partitioned WHERE o_orderkey = 1) AS orderkeys; -SELECT count(*) FROM orders_hash_partitioned WHERE o_orderkey = abs(-1); - -- Check that we don't support pruning for ANY (array expression) and give -- a notice message when used with the partition column SELECT count(*) FROM orders_hash_partitioned