pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl
@ 2026-10-30 11:52 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-10-30 11:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/e7abd282-655d-495e-94c9-e38a58917ebf@gmail.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/eda9d98fac4f22d31ffd3507ca7b470da572a1c3

Modified Files
--------------
src/test/recovery/t/041_checkpoint_at_promote.pl | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl
@ 2026-10-30 11:53 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-10-30 11:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.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(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl
@ 2026-10-30 11:53 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-10-30 11:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/e7abd282-655d-495e-94c9-e38a58917ebf@gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7ba657cba1303d2d6b89b13a5bdade500c09c88e

Modified Files
--------------
src/test/recovery/t/041_checkpoint_at_promote.pl | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl
@ 2026-10-30 11:53 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-10-30 11:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/e7abd282-655d-495e-94c9-e38a58917ebf@gmail.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/abab508718463e5d3a43ba2f95874127fb8739f3

Modified Files
--------------
src/test/recovery/t/041_checkpoint_at_promote.pl | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-10-30 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 11:52 pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl Fujii Masao <fujii@postgresql.org>
2026-10-30 11:53 pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl Fujii Masao <fujii@postgresql.org>
2026-10-30 11:53 pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl Fujii Masao <fujii@postgresql.org>
2026-10-30 11:53 pgsql: Fix crash-restart race in 041_checkpoint_at_promote.pl Fujii Masao <fujii@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox