]> granicus.if.org Git - postgresql/commitdiff
Use pg_ctl promote -w in TAP tests
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 19 Oct 2016 16:00:00 +0000 (12:00 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 19 Oct 2016 13:18:50 +0000 (09:18 -0400)
Switch TAP tests to use the new wait mode of pg_ctl promote.  This
allows avoiding extra logic with poll_query_until() to be sure that a
promoted standby is ready for read-write queries.

From: Michael Paquier <michael.paquier@gmail.com>

src/bin/pg_rewind/RewindTest.pm
src/test/perl/PostgresNode.pm
src/test/recovery/t/004_timeline_switch.pl

index c7c3a8f45c6abe8b05006d899fcf885ecfd6934c..1c482617add5d388f7fdb01dbc8ad145425700ad 100644 (file)
@@ -161,12 +161,8 @@ sub promote_standby
          or die "Timed out while waiting for standby to receive and write WAL";
 
        # Now promote slave and insert some new data on master, this will put
-       # the master out-of-sync with the standby. Wait until the standby is
-       # out of recovery mode, and is ready to accept read-write connections.
+       # the master out-of-sync with the standby.
        $node_standby->promote;
-       $node_standby->poll_query_until('postgres',
-               "SELECT NOT pg_is_in_recovery()")
-         or die "Timed out while waiting for promotion of standby";
 
        # Force a checkpoint after the promotion. pg_rewind looks at the control
        # file to determine what timeline the server is on, and that isn't updated
index 6e5a75a050b076925f966388e824eb01350d0af1..c1b16ca9e9ef94488724a48fd87a5049829c82d8 100644 (file)
@@ -723,7 +723,7 @@ sub restart
 
 =item $node->promote()
 
-Wrapper for pg_ctl promote
+Wrapper for pg_ctl promote -w
 
 =cut
 
@@ -735,7 +735,8 @@ sub promote
        my $logfile = $self->logfile;
        my $name    = $self->name;
        print "### Promoting node \"$name\"\n";
-       TestLib::system_log('pg_ctl', '-D', $pgdata, '-l', $logfile, 'promote');
+       TestLib::system_log('pg_ctl', '-D', $pgdata, '-w', '-l', $logfile,
+               'promote');
 }
 
 # Internal routine to enable streaming replication on a standby node.
index 3ee8df2cdc24885b1b2e4f86a54004c6d03e0836..5f3b2fe1ddb730e23a5ebdebff3d025994352a5a 100644 (file)
@@ -57,10 +57,7 @@ recovery_target_timeline='latest'
 $node_standby_2->restart;
 
 # Insert some data in standby 1 and check its presence in standby 2
-# to ensure that the timeline switch has been done. Standby 1 needs
-# to exit recovery first before moving on with the test.
-$node_standby_1->poll_query_until('postgres',
-       "SELECT pg_is_in_recovery() <> true");
+# to ensure that the timeline switch has been done.
 $node_standby_1->safe_psql('postgres',
        "INSERT INTO tab_int VALUES (generate_series(1001,2000))");
 $until_lsn = $node_standby_1->safe_psql('postgres',