>From 25be31719c8011cc1030b15661da31c56774b9e2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Mon, 1 May 2017 12:11:25 -0400
Subject: [PATCH 2/2] Remove unnecessary pg_is_in_recovery calls in tests

Since pg_ctl promote already waits for recovery to end, these calls are
obsolete.
---
 src/test/modules/commit_ts/t/003_standby_2.pl         | 1 -
 src/test/recovery/t/008_fsm_truncation.pl             | 3 ---
 src/test/recovery/t/009_twophase.pl                   | 9 ---------
 src/test/recovery/t/010_logical_decoding_timelines.pl | 3 ---
 src/test/recovery/t/012_subtransactions.pl            | 9 ---------
 5 files changed, 25 deletions(-)

diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl
index d7898b8355..fad28501cf 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -55,7 +55,6 @@
 $master->restart;
 
 system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote');
-$standby->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true");
 
 $standby->safe_psql('postgres', "create table t11()");
 my $standby_ts = $standby->safe_psql('postgres',
diff --git a/src/test/recovery/t/008_fsm_truncation.pl b/src/test/recovery/t/008_fsm_truncation.pl
index 8aa8a4fe82..c189bcd7f7 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -78,9 +78,6 @@
 
 # Promote 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";
 $node_standby->psql('postgres', 'checkpoint');
 
 # Restart to discard in-memory copy of FSM
diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl
index 73103252a7..2079ae8d7d 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -180,9 +180,6 @@
 	PREPARE TRANSACTION 'xact_009_1';");
 $node_master->teardown_node;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $psql_rc = $node_slave->psql('postgres', "COMMIT PREPARED 'xact_009_1'");
 is($psql_rc, '0', "Restore of prepared transaction on promoted slave");
@@ -211,9 +208,6 @@
 $node_master->stop;
 $node_slave->restart;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $node_slave->psql('postgres', "SELECT count(*) FROM pg_prepared_xacts",
 	  stdout => \$psql_out);
@@ -245,9 +239,6 @@
 $node_slave->teardown_node;
 $node_slave->start;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $node_slave->psql('postgres', "SELECT count(*) FROM pg_prepared_xacts",
 	  stdout => \$psql_out);
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index cdddb4d13d..7d97456e4a 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -129,9 +129,6 @@
 $node_master->stop('immediate');
 
 $node_replica->promote;
-print "waiting for replica to come up\n";
-$node_replica->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery();");
 
 $node_replica->safe_psql('postgres',
 	"INSERT INTO decoding(blah) VALUES ('after failover');");
diff --git a/src/test/recovery/t/012_subtransactions.pl b/src/test/recovery/t/012_subtransactions.pl
index 5e02c28cb8..caafe5348e 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -97,9 +97,6 @@
 is($psql_out, '8128', "Visible");
 $node_master->stop;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $node_slave->psql('postgres', "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
 	  stdout => \$psql_out);
@@ -141,9 +138,6 @@
 is($psql_out, '-1', "Not visible");
 $node_master->stop;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $node_slave->psql('postgres', "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
 	  stdout => \$psql_out);
@@ -174,9 +168,6 @@
 is($psql_out, '-1', "Not visible");
 $node_master->stop;
 $node_slave->promote;
-$node_slave->poll_query_until('postgres',
-	"SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby";
 
 $node_slave->psql('postgres', "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
 	  stdout => \$psql_out);
-- 
2.12.2

