v5-PG17-0003-Improve-recovery-test-046_checkpoint_logical.patch
application/octet-stream
Filename: v5-PG17-0003-Improve-recovery-test-046_checkpoint_logical.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch v5-0003
Subject: Improve recovery test 046_checkpoint_logical_slot
| File | + | − |
|---|---|---|
| src/test/recovery/t/046_checkpoint_logical_slot.pl | 8 | 2 |
From 753aa3c063c9fd9f690583cf0a7bde19624e69d1 Mon Sep 17 00:00:00 2001
From: Alexander Korotkov <akorotkov@postgresql.org>
Date: Fri, 18 Jul 2025 00:04:52 +0300
Subject: [PATCH v5-PG17] 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>
---
src/test/recovery/t/046_checkpoint_logical_slot.pl | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/test/recovery/t/046_checkpoint_logical_slot.pl b/src/test/recovery/t/046_checkpoint_logical_slot.pl
index 0468d4609e4..d2cf1cb4464 100644
--- a/src/test/recovery/t/046_checkpoint_logical_slot.pl
+++ b/src/test/recovery/t/046_checkpoint_logical_slot.pl
@@ -119,12 +119,18 @@ $node->safe_psql('postgres',
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.
+my $log_offset = -s $node->logfile;
$node->safe_psql('postgres',
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
-# to finish; it would be better).
+# Abruptly stop the server.
$node->stop('immediate');
$node->start;
--
2.39.5 (Apple Git-154)