Skip to content

Commit

Permalink
Fix flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomello committed Sep 26, 2024
1 parent 4d49e7d commit 36e6f32
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 75 deletions.
13 changes: 12 additions & 1 deletion .github/gh_matrix_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,18 @@ def macos_config(overrides):
"coverage": False,
"installcheck_args": f'TESTS="{" ".join(list(tests) * 20)}"',
"name": "Flaky Check Debug",
"pg": PG14_LATEST,
"pg": PG16_LATEST,
"pginstallcheck": False,
}
)
)
m["include"].append(
build_debug_config(
{
"coverage": False,
"installcheck_args": f'TESTS="{" ".join(list(tests) * 20)}"',
"name": "Flaky Check Debug",
"pg": PG17_LATEST,
"pginstallcheck": False,
}
)
Expand Down
3 changes: 2 additions & 1 deletion tsl/test/shared/expected/constraint_exclusion_prepared.out
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set
-- 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 max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
28 changes: 13 additions & 15 deletions tsl/test/shared/expected/ordered_append-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down Expand Up @@ -168,23 +169,20 @@ ORDER BY device_id,
LIMIT 1;
QUERY PLAN
Limit (actual rows=1 loops=1)
-> Incremental Sort (actual rows=1 loops=1)
-> Sort (actual rows=1 loops=1)
Sort Key: _hyper_X_X_chunk.device_id, _hyper_X_X_chunk."time"
Presorted Key: _hyper_X_X_chunk.device_id
Full-sort Groups: 1 Sort Method: top-N heapsort
Pre-sorted Groups: 1 Sort Method: top-N heapsort
-> Merge Append (actual rows=13675 loops=1)
Sort Key: _hyper_X_X_chunk.device_id
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=3599 loops=1)
Sort Method: top-N heapsort
-> Append (actual rows=27348 loops=1)
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=7196 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 3599
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 7196
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 10076
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
(17 rows)
Heap Fetches: 10076
(14 rows)

-- test equality constraint on ORDER BY prefix
-- currently not optimized
Expand Down
28 changes: 13 additions & 15 deletions tsl/test/shared/expected/ordered_append-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down Expand Up @@ -171,23 +172,20 @@ ORDER BY device_id,
LIMIT 1;
QUERY PLAN
Limit (actual rows=1 loops=1)
-> Incremental Sort (actual rows=1 loops=1)
-> Sort (actual rows=1 loops=1)
Sort Key: _hyper_X_X_chunk.device_id, _hyper_X_X_chunk."time"
Presorted Key: _hyper_X_X_chunk.device_id
Full-sort Groups: 1 Sort Method: top-N heapsort
Pre-sorted Groups: 1 Sort Method: top-N heapsort
-> Merge Append (actual rows=13675 loops=1)
Sort Key: _hyper_X_X_chunk.device_id
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=3599 loops=1)
Sort Method: top-N heapsort
-> Append (actual rows=27348 loops=1)
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=7196 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 3599
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 7196
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 10076
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
(17 rows)
Heap Fetches: 10076
(14 rows)

-- test equality constraint on ORDER BY prefix
-- currently not optimized
Expand Down
28 changes: 13 additions & 15 deletions tsl/test/shared/expected/ordered_append-16.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down Expand Up @@ -171,23 +172,20 @@ ORDER BY device_id,
LIMIT 1;
QUERY PLAN
Limit (actual rows=1 loops=1)
-> Incremental Sort (actual rows=1 loops=1)
-> Sort (actual rows=1 loops=1)
Sort Key: _hyper_X_X_chunk.device_id, _hyper_X_X_chunk."time"
Presorted Key: _hyper_X_X_chunk.device_id
Full-sort Groups: 1 Sort Method: top-N heapsort
Pre-sorted Groups: 1 Sort Method: top-N heapsort
-> Merge Append (actual rows=13675 loops=1)
Sort Key: _hyper_X_X_chunk.device_id
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=3599 loops=1)
Sort Method: top-N heapsort
-> Append (actual rows=27348 loops=1)
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=7196 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 3599
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 7196
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 10076
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
(17 rows)
Heap Fetches: 10076
(14 rows)

-- test equality constraint on ORDER BY prefix
-- currently not optimized
Expand Down
28 changes: 13 additions & 15 deletions tsl/test/shared/expected/ordered_append-17.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down Expand Up @@ -171,23 +172,20 @@ ORDER BY device_id,
LIMIT 1;
QUERY PLAN
Limit (actual rows=1 loops=1)
-> Incremental Sort (actual rows=1 loops=1)
-> Sort (actual rows=1 loops=1)
Sort Key: _hyper_X_X_chunk.device_id, _hyper_X_X_chunk."time"
Presorted Key: _hyper_X_X_chunk.device_id
Full-sort Groups: 1 Sort Method: top-N heapsort
Pre-sorted Groups: 1 Sort Method: top-N heapsort
-> Merge Append (actual rows=13675 loops=1)
Sort Key: _hyper_X_X_chunk.device_id
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=3599 loops=1)
Sort Method: top-N heapsort
-> Append (actual rows=27348 loops=1)
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=7196 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 3599
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 7196
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=5039 loops=1)
Heap Fetches: 10076
-> Index Only Scan using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk (actual rows=10076 loops=1)
Index Cond: (device_id = ANY ('{1,2}'::integer[]))
Heap Fetches: 5039
(17 rows)
Heap Fetches: 10076
(14 rows)

-- test equality constraint on ORDER BY prefix
-- currently not optimized
Expand Down
5 changes: 3 additions & 2 deletions tsl/test/shared/expected/ordered_append_join-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
5 changes: 3 additions & 2 deletions tsl/test/shared/expected/ordered_append_join-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
5 changes: 3 additions & 2 deletions tsl/test/shared/expected/ordered_append_join-16.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
5 changes: 3 additions & 2 deletions tsl/test/shared/expected/ordered_append_join-17.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
-- 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';
set max_parallel_workers_per_gather to 0;
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort TO off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
3 changes: 2 additions & 1 deletion tsl/test/shared/sql/constraint_exclusion_prepared.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set
-- 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 enable_incremental_sort 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
5 changes: 3 additions & 2 deletions tsl/test/shared/sql/ordered_append.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\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';
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort 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
5 changes: 3 additions & 2 deletions tsl/test/shared/sql/ordered_append_join.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\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';
SET work_mem TO '64MB';
SET max_parallel_workers_per_gather TO 0;
SET enable_incremental_sort 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

0 comments on commit 36e6f32

Please sign in to comment.