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
This commit is contained in:
parent
0265e5c120
commit
0b84f5c419
@ -60,6 +60,12 @@ $node_subscriber->start;
|
|||||||
$node_publisher->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
|
$node_publisher->safe_psql('postgres', "CREATE TABLE test_tbl (id int)");
|
||||||
$node_subscriber->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
|
# Insert some data
|
||||||
$node_publisher->safe_psql('postgres',
|
$node_publisher->safe_psql('postgres',
|
||||||
"INSERT INTO test_tbl VALUES (generate_series(1, 5));");
|
"INSERT INTO test_tbl VALUES (generate_series(1, 5));");
|
||||||
@ -81,6 +87,10 @@ is($result, qq(5), "check initial copy was done");
|
|||||||
|
|
||||||
my $offset = -s $node_publisher->logfile;
|
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
|
# Restart the publisher to ensure that the slot will be flushed if required
|
||||||
$node_publisher->restart();
|
$node_publisher->restart();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user