Skip to content

Commit

Permalink
Remove version specific checks for GUC
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomello committed Sep 30, 2024
1 parent b6db580 commit 6e53db1
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 114 deletions.
9 changes: 2 additions & 7 deletions test/expected/append-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
\gset
SET timescaledb.enable_now_constify TO false;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\ir :TEST_LOAD_NAME
-- This file and its contents are licensed under the Apache License 2.0.
Expand Down
9 changes: 2 additions & 7 deletions test/expected/append-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
\gset
SET timescaledb.enable_now_constify TO false;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\ir :TEST_LOAD_NAME
-- This file and its contents are licensed under the Apache License 2.0.
Expand Down
9 changes: 2 additions & 7 deletions test/expected/append-16.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
\gset
SET timescaledb.enable_now_constify TO false;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\ir :TEST_LOAD_NAME
-- This file and its contents are licensed under the Apache License 2.0.
Expand Down
9 changes: 2 additions & 7 deletions test/expected/append-17.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
\gset
SET timescaledb.enable_now_constify TO false;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\ir :TEST_LOAD_NAME
-- This file and its contents are licensed under the Apache License 2.0.
Expand Down
4 changes: 2 additions & 2 deletions test/sql/append.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized resul

SET timescaledb.enable_now_constify TO false;

-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';

\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'

Expand Down
9 changes: 2 additions & 7 deletions tsl/test/expected/transparent_decompression-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMP
SET work_mem TO '50MB';
SET enable_incremental_sort TO off;
SET timezone TO PST8PDT;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
CREATE TABLE metrics (
filler_1 int,
filler_2 int,
Expand Down
9 changes: 2 additions & 7 deletions tsl/test/expected/transparent_decompression-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMP
SET work_mem TO '50MB';
SET enable_incremental_sort TO off;
SET timezone TO PST8PDT;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
CREATE TABLE metrics (
filler_1 int,
filler_2 int,
Expand Down
9 changes: 2 additions & 7 deletions tsl/test/expected/transparent_decompression-16.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMP
SET work_mem TO '50MB';
SET enable_incremental_sort TO off;
SET timezone TO PST8PDT;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
CREATE TABLE metrics (
filler_1 int,
filler_2 int,
Expand Down
9 changes: 2 additions & 7 deletions tsl/test/expected/transparent_decompression-17.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMP
SET work_mem TO '50MB';
SET enable_incremental_sort TO off;
SET timezone TO PST8PDT;
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
CREATE TABLE metrics (
filler_1 int,
filler_2 int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ SELECT format('include/%s_query.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",
format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED",
format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset
SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
-- Testing Index Scan backwards ----
-- We want more than 1 segment in atleast 1 of the chunks
CREATE TABLE metrics_ordered_idx (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ SELECT format('include/%s_query.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",
format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED",
format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset
SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
-- Testing Index Scan backwards ----
-- We want more than 1 segment in atleast 1 of the chunks
CREATE TABLE metrics_ordered_idx (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ SELECT format('include/%s_query.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",
format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED",
format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset
SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
-- Testing Index Scan backwards ----
-- We want more than 1 segment in atleast 1 of the chunks
CREATE TABLE metrics_ordered_idx (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ SELECT format('include/%s_query.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",
format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED",
format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset
SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
----------------
off
(1 row)

-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
-- Testing Index Scan backwards ----
-- We want more than 1 segment in atleast 1 of the chunks
CREATE TABLE metrics_ordered_idx (
Expand Down
22 changes: 7 additions & 15 deletions tsl/test/shared/expected/constraint_exclusion_prepared.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,22 @@ SELECT
\gset
SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed results" %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') as "DIFF_CMD"
\gset
-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
enable_memoize
off
(1 row)

-- get EXPLAIN output for all variations
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
-- disable incremental sort here to make plans comparable to PG < 13
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set_config('enable_incremental_sort','off',false) ELSE 'off' END;
case
off
(1 row)

SET work_mem TO '64MB';
-- In the following test cases, we test that certain indexes are used. By using the
-- timescaledb.enable_decompression_sorted_merge optimization, we are pushing a sort node
-- below the DecompressChunk node, which operates on the batches. This could lead to flaky
-- tests because the input data is small and PostgreSQL switches from IndexScans to
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
set max_parallel_workers_per_gather to 0;
SET timescaledb.enable_decompression_sorted_merge TO 'off';
SET max_parallel_workers_per_gather TO '0';
-- disable incremental sort to avoid flaky results
SET enable_incremental_sort TO 'off';
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
17 changes: 8 additions & 9 deletions tsl/test/shared/sql/constraint_exclusion_prepared.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@ SELECT
SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed results" %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') as "DIFF_CMD"
\gset

-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;

-- get EXPLAIN output for all variations
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'

set work_mem to '64MB';
-- disable incremental sort here to make plans comparable to PG < 13
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set_config('enable_incremental_sort','off',false) ELSE 'off' END;

SET work_mem TO '64MB';

-- In the following test cases, we test that certain indexes are used. By using the
-- timescaledb.enable_decompression_sorted_merge optimization, we are pushing a sort node
-- below the DecompressChunk node, which operates on the batches. This could lead to flaky
-- tests because the input data is small and PostgreSQL switches from IndexScans to
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
SET timescaledb.enable_decompression_sorted_merge TO 'off';
SET max_parallel_workers_per_gather TO '0';

-- disable incremental sort to avoid flaky results
SET enable_incremental_sort TO 'off';
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';

set max_parallel_workers_per_gather to 0;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
\set TEST_TABLE 'metrics_space'
Expand Down
4 changes: 2 additions & 2 deletions tsl/test/sql/transparent_decompression.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ SET work_mem TO '50MB';
SET enable_incremental_sort TO off;
SET timezone TO PST8PDT;

-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';

CREATE TABLE metrics (
filler_1 int,
Expand Down
4 changes: 2 additions & 2 deletions tsl/test/sql/transparent_decompression_ordered_index.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ SELECT format('include/%s_query.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",

SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset

-- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize;
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';

-- Testing Index Scan backwards ----
-- We want more than 1 segment in atleast 1 of the chunks
Expand Down

0 comments on commit 6e53db1

Please sign in to comment.