diff --git a/src/test/recovery/t/026_overwrite_contrecord.pl b/src/test/recovery/t/026_overwrite_contrecord.pl index 78feccd9aa..bce3d6d701 100644 --- a/src/test/recovery/t/026_overwrite_contrecord.pl +++ b/src/test/recovery/t/026_overwrite_contrecord.pl @@ -68,8 +68,7 @@ ok($initfile ne $endfile, "$initfile differs from $endfile"); # contents $node->stop('immediate'); -unlink $node->basedir . "/pgdata/pg_wal/$endfile" - or die "could not unlink " . $node->basedir . "/pgdata/pg_wal/$endfile: $!"; +system(sprintf("mv %s/pgdata/pg_wal/$endfile %s/archives/", $node->basedir, $node->basedir)); # OK, create a standby at this spot. $node->backup_fs_cold('backup'); @@ -106,4 +105,17 @@ $node_standby->promote; $node->stop; $node_standby->stop; +my $node_primary_2 = PostgreSQL::Test::Cluster->new('primary_2'); +$node_primary_2->init_from_backup($node, 'backup', has_restoring => 1, standby => 0); + +$node_primary_2->append_conf( + 'postgresql.conf', qq( +log_min_messages = debug1 +)); +$node_primary_2->start; +$node_primary_2->poll_query_until('postgres', + 'SELECT NOT pg_is_in_recovery()'); +is($node_primary_2->safe_psql('postgres', 'SELECT pg_is_in_recovery()'), 'f', + 'check if the copied server has promoted'); + done_testing();