diff options
Diffstat (limited to 'src/test/recovery/t')
-rw-r--r-- | src/test/recovery/t/005_replay_delay.pl | 32 | ||||
-rw-r--r-- | src/test/recovery/t/025_stuck_on_old_timeline.pl | 20 |
2 files changed, 28 insertions, 24 deletions
diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl index 496fa40fe1..bd7ed4e304 100644 --- a/src/test/recovery/t/005_replay_delay.pl +++ b/src/test/recovery/t/005_replay_delay.pl @@ -64,9 +64,10 @@ $node_standby2->init_from_backup($node_primary, $backup_name, $node_standby2->start; # Recovery is not yet paused. -is($node_standby2->safe_psql('postgres', - "SELECT pg_get_wal_replay_pause_state()"), - 'not paused', 'pg_get_wal_replay_pause_state() reports not paused'); +is( $node_standby2->safe_psql( + 'postgres', "SELECT pg_get_wal_replay_pause_state()"), + 'not paused', + 'pg_get_wal_replay_pause_state() reports not paused'); # Request to pause recovery and wait until it's actually paused. $node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_pause()"); @@ -74,28 +75,28 @@ $node_primary->safe_psql('postgres', "INSERT INTO tab_int VALUES (generate_series(21,30))"); $node_standby2->poll_query_until('postgres', "SELECT pg_get_wal_replay_pause_state() = 'paused'") - or die "Timed out while waiting for recovery to be paused"; + or die "Timed out while waiting for recovery to be paused"; # Even if new WAL records are streamed from the primary, # recovery in the paused state doesn't replay them. -my $receive_lsn = $node_standby2->safe_psql('postgres', - "SELECT pg_last_wal_receive_lsn()"); -my $replay_lsn = $node_standby2->safe_psql('postgres', - "SELECT pg_last_wal_replay_lsn()"); +my $receive_lsn = + $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_receive_lsn()"); +my $replay_lsn = + $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"); $node_primary->safe_psql('postgres', "INSERT INTO tab_int VALUES (generate_series(31,40))"); $node_standby2->poll_query_until('postgres', "SELECT '$receive_lsn'::pg_lsn < pg_last_wal_receive_lsn()") - or die "Timed out while waiting for new WAL to be streamed"; -is($node_standby2->safe_psql('postgres', - "SELECT pg_last_wal_replay_lsn()"), - qq($replay_lsn), 'no WAL is replayed in the paused state'); + or die "Timed out while waiting for new WAL to be streamed"; +is( $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"), + qq($replay_lsn), + 'no WAL is replayed in the paused state'); # Request to resume recovery and wait until it's actually resumed. $node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_resume()"); $node_standby2->poll_query_until('postgres', - "SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn") - or die "Timed out while waiting for recovery to be resumed"; + "SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn" +) or die "Timed out while waiting for recovery to be resumed"; # Check that the paused state ends and promotion continues if a promotion # is triggered while recovery is paused. @@ -107,6 +108,5 @@ $node_standby2->poll_query_until('postgres', or die "Timed out while waiting for recovery to be paused"; $node_standby2->promote; -$node_standby2->poll_query_until('postgres', - "SELECT NOT pg_is_in_recovery()") +$node_standby2->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()") or die "Timed out while waiting for promotion to finish"; diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl index dbaab8e6e6..fb15f9576b 100644 --- a/src/test/recovery/t/025_stuck_on_old_timeline.pl +++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl @@ -32,13 +32,14 @@ my $perlbin = TestLib::perl2host($^X); $perlbin =~ s!\\!/!g if $TestLib::windows_os; my $archivedir_primary = $node_primary->archive_dir; $archivedir_primary =~ s!\\!/!g if $TestLib::windows_os; -$node_primary->append_conf('postgresql.conf', qq( +$node_primary->append_conf( + 'postgresql.conf', qq( archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"' wal_keep_size=128MB )); # Make sure that Msys perl doesn't complain about difficulty in setting locale # when called from the archive_command. -local $ENV{PERL_BADLANG}=0; +local $ENV{PERL_BADLANG} = 0; $node_primary->start; # Take backup from primary @@ -47,8 +48,11 @@ $node_primary->backup($backup_name); # Create streaming standby linking to primary my $node_standby = get_new_node('standby'); -$node_standby->init_from_backup($node_primary, $backup_name, - allows_streaming => 1, has_streaming => 1, has_archiving => 1); +$node_standby->init_from_backup( + $node_primary, $backup_name, + allows_streaming => 1, + has_streaming => 1, + has_archiving => 1); $node_standby->start; # Take backup of standby, use -Xnone so that pg_wal is empty. @@ -60,7 +64,8 @@ my $node_cascade = get_new_node('cascade'); $node_cascade->init_from_backup($node_standby, $backup_name, has_streaming => 1); $node_cascade->enable_restoring($node_primary); -$node_cascade->append_conf('postgresql.conf', qq( +$node_cascade->append_conf( + 'postgresql.conf', qq( recovery_target_timeline='latest' )); @@ -68,9 +73,8 @@ recovery_target_timeline='latest' $node_standby->promote; # Wait for promotion to complete -$node_standby->poll_query_until('postgres', - "SELECT NOT pg_is_in_recovery();") - or die "Timed out while waiting for promotion"; +$node_standby->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery();") + or die "Timed out while waiting for promotion"; # Find next WAL segment to be archived my $walfile_to_be_archived = $node_standby->safe_psql('postgres', |