| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl |
| Date: | 2026-10-30 11:53:11 |
| Message-ID: | E1xMlAV-00000001Obd-00Vy@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix crash-restart race in 041_checkpoint_at_promote.pl
The buildfarm member bushmaster reported failures in the final test query
in 041_checkpoint_at_promote.pl with "the database system is in recovery
mode".
After killing a backend to trigger crash recovery, the test should wait
for the postmaster to terminate the remaining server processes and restart
the server, then wait for recovery to finish and connections to be accepted
before running the final query.
Previously, the test assumed that the killed backend's connection closing
meant the postmaster had noticed the crash and begun restarting. However,
the connection can close before the postmaster notices the crash. The
subsequent connection check can then succeed before recovery starts,
causing the test to mistake this for recovery having completed. The final
query could then run during recovery and fail.
Fix this by waiting for the postmaster to log that all server processes
have terminated and it is reinitializing before checking that connections
are accepted again. This ensures that the postmaster has noticed the crash
and begun restarting before the test waits for recovery to finish.
Backpatch to v17, where this test was introduced.
Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Discussion: https://postgr.es/m/e7abd282-655d-495e-94c9-e38a58917ebf@gmail.com
Backpatch-through: 17
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/6621f2b062e20d8d2ea2cc225b2509ec9fca45a8
Modified Files
--------------
src/test/recovery/t/041_checkpoint_at_promote.pl | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-10-30 11:53:20 | pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl |
| Previous Message | Fujii Masao | 2026-10-30 11:52:50 | pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl |