Skip to content

Commit 6aefde2

Browse files
akorotkovHUUTFJ
andcommitted
Improve recovery test 046_checkpoint_logical_slot
This commit improves 046_checkpoint_logical_slot in two aspects: - Add one pg_logical_emit_message() call to force the creation of a record that spawns across two pages. - Make the logic wait for the checkpoint completion. Discussion: https://postgr.es/m/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com Author: Alexander Korotkov <akorotkov@postgresql.org> Co-authored-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Michael Paquier <michael@paquier.xyz>
1 parent 91ad1bd commit 6aefde2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/recovery/t/046_checkpoint_logical_slot.pl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,18 @@
119119
q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())}
120120
);
121121

122+
# Generate a long WAL record, spawning at least two pages for the follow-up
123+
# post-recovery check.
124+
$node->safe_psql('postgres',
125+
q{select pg_logical_emit_message(false, '', repeat('123456789', 1000))});
126+
122127
# Continue the checkpoint.
128+
my $log_offset = -s $node->logfile;
123129
$node->safe_psql('postgres',
124130
q{select injection_points_wakeup('checkpoint-before-old-wal-removal')});
131+
$node->wait_for_log(qr/checkpoint complete/, $log_offset);
125132

126-
# Abruptly stop the server (1 second should be enough for the checkpoint
127-
# to finish; it would be better).
133+
# Abruptly stop the server.
128134
$node->stop('immediate');
129135

130136
$node->start;

0 commit comments

Comments
 (0)