Skip to content

Commit

Permalink
Fix race in bgw_db_scheduler_fixed
Browse files Browse the repository at this point in the history
When deleting a job in the test, the job does not necessarily terminate
immediately, so wait for a log entries from the job before checking the
jobs table.

Fixed timescale#4859
  • Loading branch information
mkindahl committed Nov 14, 2022
1 parent 9e276c5 commit cf92dd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tsl/test/expected/bgw_db_scheduler_fixed.out
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ SELECT delete_job(:job_id);
(1 row)

RESET client_min_messages;
SELECT count(*) FROM wait_for_logentry(:job_id);
count
-------
1
(1 row)

SELECT application_name FROM pg_stat_activity WHERE application_name LIKE 'User-Defined Action%';
application_name
------------------
Expand Down
1 change: 1 addition & 0 deletions tsl/test/sql/bgw_db_scheduler_fixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ SELECT datname, usename, application_name, state, query, wait_event_type, wait_e
SET client_min_messages TO WARNING;
SELECT delete_job(:job_id);
RESET client_min_messages;
SELECT count(*) FROM wait_for_logentry(:job_id);
SELECT application_name FROM pg_stat_activity WHERE application_name LIKE 'User-Defined Action%';

--
Expand Down

0 comments on commit cf92dd8

Please sign in to comment.