1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-31 10:30:33 +03:00

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>
This commit is contained in:
Alexander Korotkov
2025-07-18 00:04:52 +03:00
parent 91ad1bdef8
commit 6aefde2a2d

View File

@@ -119,12 +119,18 @@ $node->safe_psql('postgres',
q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())} q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())}
); );
# Generate a long WAL record, spawning at least two pages for the follow-up
# post-recovery check.
$node->safe_psql('postgres',
q{select pg_logical_emit_message(false, '', repeat('123456789', 1000))});
# Continue the checkpoint. # Continue the checkpoint.
my $log_offset = -s $node->logfile;
$node->safe_psql('postgres', $node->safe_psql('postgres',
q{select injection_points_wakeup('checkpoint-before-old-wal-removal')}); q{select injection_points_wakeup('checkpoint-before-old-wal-removal')});
$node->wait_for_log(qr/checkpoint complete/, $log_offset);
# Abruptly stop the server (1 second should be enough for the checkpoint # Abruptly stop the server.
# to finish; it would be better).
$node->stop('immediate'); $node->stop('immediate');
$node->start; $node->start;