Skip to content

Commit

Permalink
PG16: adjust tests to use debug_parallel_query
Browse files Browse the repository at this point in the history
PG16 renamed force_parallel_mode to debug_parallel_query.

postgres/postgres@5352ca22e
  • Loading branch information
svenklemm committed Oct 2, 2023
1 parent c1b500f commit e7026a9
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 45 deletions.
7 changes: 6 additions & 1 deletion test/expected/loader-tsl.out
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,13 @@ INSERT INTO test SELECT x, x+0.1 FROM generate_series(1,100) AS x;
WARNING: mock post_analyze_hook "mock-2"
DISCARD ALL;
WARNING: mock post_analyze_hook "mock-2"
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
WARNING: mock post_analyze_hook "mock-2"
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 1;
WARNING: mock post_analyze_hook "mock-2"
SELECT count(*) FROM test;
Expand Down
21 changes: 18 additions & 3 deletions test/expected/parallel-13.out
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ ANALYZE test;
ALTER TABLE :CHUNK1 SET (parallel_workers=2);
ALTER TABLE :CHUNK2 SET (parallel_workers=2);
SET work_mem TO '50MB';
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost TO 0;
EXPLAIN (costs off) SELECT first(i, j) FROM "test";
Expand Down Expand Up @@ -498,7 +503,12 @@ SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time >
RESET parallel_leader_participation;
-- Ensure the same query result is produced by a sequencial query
SET max_parallel_workers_per_gather TO 0;
SET force_parallel_mode = 'off';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time > '2020-01-01 00:00:30'::text::timestamptz AND s2.time > '2020-01-01 00:00:30' AND s2.time < '2021-01-01 00:00:30' AND s1.sensor_id > 50 ORDER BY s2.time, s1.time, s1.sensor_id, s2.sensor_id;
time | sensor_id | time | sensor_id
------------------------------+-----------+------------------------------+-----------
Expand All @@ -522,7 +532,12 @@ RESET min_parallel_index_scan_size;
RESET enable_hashjoin;
RESET enable_nestloop;
RESET parallel_tuple_cost;
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

-- test worker assignment
-- first chunk should have 1 worker and second chunk should have 2
SET max_parallel_workers_per_gather TO 2;
Expand Down
21 changes: 18 additions & 3 deletions test/expected/parallel-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ ANALYZE test;
ALTER TABLE :CHUNK1 SET (parallel_workers=2);
ALTER TABLE :CHUNK2 SET (parallel_workers=2);
SET work_mem TO '50MB';
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost TO 0;
EXPLAIN (costs off) SELECT first(i, j) FROM "test";
Expand Down Expand Up @@ -498,7 +503,12 @@ SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time >
RESET parallel_leader_participation;
-- Ensure the same query result is produced by a sequencial query
SET max_parallel_workers_per_gather TO 0;
SET force_parallel_mode = 'off';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time > '2020-01-01 00:00:30'::text::timestamptz AND s2.time > '2020-01-01 00:00:30' AND s2.time < '2021-01-01 00:00:30' AND s1.sensor_id > 50 ORDER BY s2.time, s1.time, s1.sensor_id, s2.sensor_id;
time | sensor_id | time | sensor_id
------------------------------+-----------+------------------------------+-----------
Expand All @@ -522,7 +532,12 @@ RESET min_parallel_index_scan_size;
RESET enable_hashjoin;
RESET enable_nestloop;
RESET parallel_tuple_cost;
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

-- test worker assignment
-- first chunk should have 1 worker and second chunk should have 2
SET max_parallel_workers_per_gather TO 2;
Expand Down
21 changes: 18 additions & 3 deletions test/expected/parallel-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ ANALYZE test;
ALTER TABLE :CHUNK1 SET (parallel_workers=2);
ALTER TABLE :CHUNK2 SET (parallel_workers=2);
SET work_mem TO '50MB';
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost TO 0;
EXPLAIN (costs off) SELECT first(i, j) FROM "test";
Expand Down Expand Up @@ -499,7 +504,12 @@ SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time >
RESET parallel_leader_participation;
-- Ensure the same query result is produced by a sequencial query
SET max_parallel_workers_per_gather TO 0;
SET force_parallel_mode = 'off';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time > '2020-01-01 00:00:30'::text::timestamptz AND s2.time > '2020-01-01 00:00:30' AND s2.time < '2021-01-01 00:00:30' AND s1.sensor_id > 50 ORDER BY s2.time, s1.time, s1.sensor_id, s2.sensor_id;
time | sensor_id | time | sensor_id
------------------------------+-----------+------------------------------+-----------
Expand All @@ -523,7 +533,12 @@ RESET min_parallel_index_scan_size;
RESET enable_hashjoin;
RESET enable_nestloop;
RESET parallel_tuple_cost;
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

-- test worker assignment
-- first chunk should have 1 worker and second chunk should have 2
SET max_parallel_workers_per_gather TO 2;
Expand Down
2 changes: 1 addition & 1 deletion test/sql/loader.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ CREATE TABLE test (i int, j double precision);
INSERT INTO test SELECT x, x+0.1 FROM generate_series(1,100) AS x;

DISCARD ALL;
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
SET max_parallel_workers_per_gather = 1;
SELECT count(*) FROM test;

Expand Down
6 changes: 3 additions & 3 deletions test/sql/parallel.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ALTER TABLE :CHUNK1 SET (parallel_workers=2);
ALTER TABLE :CHUNK2 SET (parallel_workers=2);

SET work_mem TO '50MB';
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost TO 0;

Expand Down Expand Up @@ -126,7 +126,7 @@ RESET parallel_leader_participation;

-- Ensure the same query result is produced by a sequencial query
SET max_parallel_workers_per_gather TO 0;
SET force_parallel_mode = 'off';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
SELECT * FROM sensor_data AS s1 JOIN sensor_data AS s2 ON (TRUE) WHERE s1.time > '2020-01-01 00:00:30'::text::timestamptz AND s2.time > '2020-01-01 00:00:30' AND s2.time < '2021-01-01 00:00:30' AND s1.sensor_id > 50 ORDER BY s2.time, s1.time, s1.sensor_id, s2.sensor_id;

RESET enable_material;
Expand All @@ -135,7 +135,7 @@ RESET min_parallel_index_scan_size;
RESET enable_hashjoin;
RESET enable_nestloop;
RESET parallel_tuple_cost;
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);

-- test worker assignment
-- first chunk should have 1 worker and second chunk should have 2
Expand Down
7 changes: 6 additions & 1 deletion tsl/test/expected/agg_partials_pushdown.out
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t
(32 rows)

-- Force parallel query
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t DESC NULLS LAST limit 2;
Expand Down
7 changes: 6 additions & 1 deletion tsl/test/expected/continuous_aggs-13.out
Original file line number Diff line number Diff line change
Expand Up @@ -2309,7 +2309,12 @@ FROM conditions
GROUP BY 1
ORDER BY 2 DESC;
NOTICE: refreshing continuous aggregate "conditions_daily"
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
Expand Down
7 changes: 6 additions & 1 deletion tsl/test/expected/continuous_aggs-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,12 @@ FROM conditions
GROUP BY 1
ORDER BY 2 DESC;
NOTICE: refreshing continuous aggregate "conditions_daily"
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
Expand Down
7 changes: 6 additions & 1 deletion tsl/test/expected/continuous_aggs-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,12 @@ FROM conditions
GROUP BY 1
ORDER BY 2 DESC;
NOTICE: refreshing continuous aggregate "conditions_daily"
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET max_parallel_workers_per_gather = 4;
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
Expand Down
7 changes: 6 additions & 1 deletion tsl/test/expected/partialize_finalize.out
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,12 @@ CREATE OR REPLACE FUNCTION mix(x INTEGER) RETURNS INTEGER AS $$ SELECT (((hashin
INSERT INTO issue4922 (time, value)
SELECT '2022-01-01 00:00:00-03'::timestamptz + interval '1 year' * mix(x), mix(x)
FROM generate_series(1, 100000) x(x);
SET force_parallel_mode = 'on';
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

SET parallel_setup_cost = 0;
-- Materialize partials from execution of parallel query plan
EXPLAIN (VERBOSE, COSTS OFF)
Expand Down
28 changes: 24 additions & 4 deletions tsl/test/expected/plan_skip_scan-13.out
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,12 @@ UNION SELECT b.* FROM
(6 rows)

-- parallel query
SET force_parallel_mode TO true;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

:PREFIX SELECT DISTINCT dev FROM :TABLE ORDER BY dev;
QUERY PLAN
-------------------------------------------------------------------------------------------
Expand All @@ -1286,7 +1291,12 @@ SET force_parallel_mode TO true;
Heap Fetches: 12
(5 rows)

RESET force_parallel_mode;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

TRUNCATE skip_scan_insert;
-- table with only nulls
:PREFIX SELECT DISTINCT ON (time) time FROM skip_scan_nulls;
Expand Down Expand Up @@ -3710,7 +3720,12 @@ UNION SELECT b.* FROM
(14 rows)

-- parallel query
SET force_parallel_mode TO true;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

:PREFIX SELECT DISTINCT dev FROM :TABLE ORDER BY dev;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Expand All @@ -3735,7 +3750,12 @@ SET force_parallel_mode TO true;
Heap Fetches: 11
(19 rows)

RESET force_parallel_mode;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

TRUNCATE skip_scan_insert;
-- table with only nulls
:PREFIX SELECT DISTINCT ON (time) time FROM skip_scan_nulls;
Expand Down
28 changes: 24 additions & 4 deletions tsl/test/expected/plan_skip_scan-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,12 @@ UNION SELECT b.* FROM
(6 rows)

-- parallel query
SET force_parallel_mode TO true;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

:PREFIX SELECT DISTINCT dev FROM :TABLE ORDER BY dev;
QUERY PLAN
-------------------------------------------------------------------------------------------
Expand All @@ -1285,7 +1290,12 @@ SET force_parallel_mode TO true;
Heap Fetches: 12
(5 rows)

RESET force_parallel_mode;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

TRUNCATE skip_scan_insert;
-- table with only nulls
:PREFIX SELECT DISTINCT ON (time) time FROM skip_scan_nulls;
Expand Down Expand Up @@ -3708,7 +3718,12 @@ UNION SELECT b.* FROM
(14 rows)

-- parallel query
SET force_parallel_mode TO true;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false);
set_config
------------
on
(1 row)

:PREFIX SELECT DISTINCT dev FROM :TABLE ORDER BY dev;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Expand All @@ -3733,7 +3748,12 @@ SET force_parallel_mode TO true;
Heap Fetches: 11
(19 rows)

RESET force_parallel_mode;
SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'off', false);
set_config
------------
off
(1 row)

TRUNCATE skip_scan_insert;
-- table with only nulls
:PREFIX SELECT DISTINCT ON (time) time FROM skip_scan_nulls;
Expand Down
Loading

0 comments on commit e7026a9

Please sign in to comment.