Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0b84f5c

Browse files
author
Amit Kapila
committed
Fix a random failure in 038_save_logical_slots_shutdown.pl.
The test ensures that all the WAL on the publisher is sent to the subscriber before shutdown by comparing the confirmed_flush_lsn of the associated slot with the shutdown_checkpoint WAL location. But if the shutdown_checkpoint location falls into a new page in the WAL then the check won't work. So, ensure that the shutdown_checkpoint WAL record doesn't fall into a new page. Reported-by: Bharath Rupireddy Author: Bharath Rupireddy Reviewed-by: Vignesh C, Kuroda Hayato, Amit Kapila Discussion: https://postgr.es/m/CALj2ACVLzH5CN-h9=S26mdRHPuJ9yDLUw70yh4JOiPw03WL0CQ@mail.gmail.com
1 parent 0265e5c commit 0b84f5c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/recovery/t/038_save_logical_slots_shutdown.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ sub compare_confirmed_flush
6060
$node_publisher->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
6161
$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
6262

63+
# To avoid a shutdown checkpoint WAL record (that gets generated as part of
64+
# the publisher restart below) falling into a new page, advance the WAL
65+
# segment. Otherwise, the confirmed_flush_lsn and shutdown_checkpoint
66+
# location won't match.
67+
$node_publisher->advance_wal(1);
68+
6369
# Insert some data
6470
$node_publisher->safe_psql('postgres',
6571
"INSERT INTO test_tbl VALUES (generate_series(1, 5));");
@@ -81,6 +87,10 @@ sub compare_confirmed_flush
8187

8288
my $offset = -s $node_publisher->logfile;
8389

90+
# Note: Don't insert any data on the publisher that may cause the shutdown
91+
# checkpoint to fall into a new WAL file. See the comments atop advance_wal()
92+
# above.
93+
8494
# Restart the publisher to ensure that the slot will be flushed if required
8595
$node_publisher->restart();
8696

0 commit comments

Comments
 (0)