$node_publisher->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
+# To avoid a shutdown checkpoint WAL record (that gets generated as part of
+# the publisher restart below) falling into a new page, advance the WAL
+# segment. Otherwise, the confirmed_flush_lsn and shutdown_checkpoint
+# location won't match.
+$node_publisher->advance_wal(1);
+
# Insert some data
$node_publisher->safe_psql('postgres',
"INSERT INTO test_tbl VALUES (generate_series(1, 5));");
my $offset = -s $node_publisher->logfile;
+# Note: Don't insert any data on the publisher that may cause the shutdown
+# checkpoint to fall into a new WAL file. See the comments atop advance_wal()
+# above.
+
# Restart the publisher to ensure that the slot will be flushed if required
$node_publisher->restart();