From 6deb52b202e0f673b583b03ad141ccad6f8e7fba 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] 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         | 2 --
 src/test/recovery/t/008_fsm_truncation.pl             | 2 --
 src/test/recovery/t/009_twophase.pl                   | 6 ------
 src/test/recovery/t/010_logical_decoding_timelines.pl | 4 ----
 src/test/recovery/t/012_subtransactions.pl            | 6 ------
 5 files changed, 20 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 eccaf07561e..c3000f5b4c6 100644
--- a/src/test/modules/commit_ts/t/003_standby_2.pl
+++ b/src/test/modules/commit_ts/t/003_standby_2.pl
@@ -55,8 +55,6 @@ $master->append_conf('postgresql.conf', 'track_commit_timestamp = off');
 $master->restart;
 
 system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote');
-$standby->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
-  or die "standby never exited recovery";
 
 $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 56eecf722c5..ddab464a973 100644
--- a/src/test/recovery/t/008_fsm_truncation.pl
+++ b/src/test/recovery/t/008_fsm_truncation.pl
@@ -83,8 +83,6 @@ $node_standby->poll_query_until('postgres', $caughtup_query)
 
 # 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 2922c763b3f..d5bcd25fed7 100644
--- a/src/test/recovery/t/009_twophase.pl
+++ b/src/test/recovery/t/009_twophase.pl
@@ -215,8 +215,6 @@ $cur_master->psql(
 	PREPARE TRANSACTION 'xact_009_10';");
 $cur_master->teardown_node;
 $cur_slave->promote;
-$cur_slave->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby " . $cur_slave->name;
 
 # change roles
 note "Now paris is master and london is slave";
@@ -254,8 +252,6 @@ $cur_master->psql(
 $cur_master->stop;
 $cur_slave->restart;
 $cur_slave->promote;
-$cur_slave->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby " . $cur_slave->name;
 
 # change roles
 note "Now london is master and paris is slave";
@@ -296,8 +292,6 @@ $cur_master->stop;
 $cur_slave->teardown_node;
 $cur_slave->start;
 $cur_slave->promote;
-$cur_slave->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
-  or die "Timed out while waiting for promotion of standby " . $cur_slave->name;
 
 # change roles
 note "Now paris is master and london is slave";
diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl
index ed9e4997c40..d4259808ddb 100644
--- a/src/test/recovery/t/010_logical_decoding_timelines.pl
+++ b/src/test/recovery/t/010_logical_decoding_timelines.pl
@@ -137,10 +137,6 @@ $node_master->safe_psql('postgres', 'CHECKPOINT');
 $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();")
-  or die "replica never exited 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 30677e16752..c99733cad71 100644
--- a/src/test/recovery/t/012_subtransactions.pl
+++ b/src/test/recovery/t/012_subtransactions.pl
@@ -109,8 +109,6 @@ $node_slave->psql(
 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',
@@ -162,8 +160,6 @@ $node_slave->psql(
 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',
@@ -205,8 +201,6 @@ $node_slave->psql(
 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',
-- 
GitLab