From 2f11814b5874c072020690b5451ef18f872fcbf0 Mon Sep 17 00:00:00 2001 From: Ante Kresic Date: Fri, 29 Sep 2023 13:55:41 +0200 Subject: [PATCH] Fix bgw_custom flakiness by stopping bgws When dropping a table, we get notices if that causes to cancel background jobs and thus fail tests. By stopping the workers before dropping the table, we should reduce this flakiness. (cherry picked from commit 6e4d174a6ad7c6367ebe7b646ebdbb15c9a16ef3) --- tsl/test/expected/bgw_custom.out | 12 ++++++++++++ tsl/test/sql/bgw_custom.sql | 2 ++ 2 files changed, 14 insertions(+) diff --git a/tsl/test/expected/bgw_custom.out b/tsl/test/expected/bgw_custom.out index 19004e794da..3544b4ca0a6 100644 --- a/tsl/test/expected/bgw_custom.out +++ b/tsl/test/expected/bgw_custom.out @@ -972,7 +972,19 @@ SELECT count(*) = 0 (1 row) -- cleanup +SELECT _timescaledb_functions.stop_background_workers(); + stop_background_workers +------------------------- + t +(1 row) + DROP TABLE sensor_data; +SELECT _timescaledb_functions.restart_background_workers(); + restart_background_workers +---------------------------- + t +(1 row) + -- Github issue #5537 -- Proc that waits until the given job enters the expected state CREATE OR REPLACE PROCEDURE wait_for_job_status(job_param_id INTEGER, expected_status TEXT, spins INTEGER=:TEST_SPINWAIT_ITERS) diff --git a/tsl/test/sql/bgw_custom.sql b/tsl/test/sql/bgw_custom.sql index 45e0c6dc352..de4d66e7a09 100644 --- a/tsl/test/sql/bgw_custom.sql +++ b/tsl/test/sql/bgw_custom.sql @@ -629,7 +629,9 @@ SELECT count(*) = 0 WHERE hypertable_name = 'sensor_data' AND NOT is_compressed; -- cleanup +SELECT _timescaledb_functions.stop_background_workers(); DROP TABLE sensor_data; +SELECT _timescaledb_functions.restart_background_workers(); -- Github issue #5537 -- Proc that waits until the given job enters the expected state