]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add regression test for background worker restart after crash.
authorFujii Masao <fujii@postgresql.org>
Tue, 29 Jul 2025 10:43:10 +0000 (19:43 +0900)
committerFujii Masao <fujii@postgresql.org>
Tue, 29 Jul 2025 10:43:10 +0000 (19:43 +0900)
Previously, if a background worker crashed and the server restarted
with restart_after_crash enabled, the worker was not restarted
as expected. This issue was fixed by commit b5d084c5353,
which ensures that background workers without the never-restart flag
are correctly restarted after a crash-and-restart cycle.

To guard against regressions, this commit adds a test that verifies
a background worker successfully restarts in such a scenario.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: ChangAo Chen <cca5507@qq.com>
Discussion: https://postgr.es/m/CAHGQGwHF-PdUOgiXCH_8K5qBm8b13h0Qt=dSoFXZybXQdbf-tw@mail.gmail.com

src/test/recovery/t/013_crash_restart.pl

index debfa635c36febf2c2cf3c8d4ab2343ac39b0ccd..4c5af018ee44ecb628b0d42b076173779a17750a 100644 (file)
@@ -228,6 +228,13 @@ is( $node->safe_psql(
        'before-orderly-restart',
        'can still write after crash restart');
 
+# Confirm that the logical replication launcher, a background worker
+# without the never-restart flag, has also restarted successfully.
+is($node->poll_query_until('postgres',
+       "SELECT count(*) = 1 FROM pg_stat_activity WHERE backend_type = 'logical replication launcher'"),
+       '1',
+       'logical replication launcher restarted after crash');
+
 # Just to be sure, check that an orderly restart now still works
 $node->restart();