Skip to content

Commit c71c702

Browse files
committed
Improve the stability of the recovery test 047_checkpoint_physical_slot
Currently, the comments in 047_checkpoint_physical_slot. It shows an incomplete intention to wait for checkpoint completion before performing an immediate database stop. However, an immediate node stop can occur both before and after checkpoint completion. Both cases should work correctly. But we would like the test to be more stable and deterministic. This is why this commit makes this test explicitly wait for the checkpoint completion log message. Discussion: https://postgr.es/m/CAPpHfdurV-j_e0pb%3DUFENAy3tyzxfF%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com Discussion: https://postgr.es/m/aHXLep3OaX_vRTNQ%40paquier.xyz Author: Alexander Korotkov <akorotkov@postgresql.org> Reviewed-by: Michael Paquier <michael@paquier.xyz> Backpatch-through: 17
1 parent 5449d5b commit c71c702

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/recovery/t/047_checkpoint_physical_slot.pl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,19 @@
9494
q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())}
9595
);
9696

97-
# Continue the checkpoint.
97+
# Continue the checkpoint and wait for its completion.
98+
my $log_offset = -s $node->logfile;
9899
$node->safe_psql('postgres',
99100
q{select injection_points_wakeup('checkpoint-before-old-wal-removal')});
101+
$node->wait_for_log(qr/checkpoint complete/, $log_offset);
100102

101103
my $restart_lsn_old = $node->safe_psql('postgres',
102104
q{select restart_lsn from pg_replication_slots where slot_name = 'slot_physical'}
103105
);
104106
chomp($restart_lsn_old);
105107
note("restart lsn before stop: $restart_lsn_old");
106108

107-
# Abruptly stop the server (1 second should be enough for the checkpoint
108-
# to finish; it would be better).
109+
# Abruptly stop the server.
109110
$node->stop('immediate');
110111

111112
$node->start;

0 commit comments

Comments
 (0)