On Wed, Mar 2, 2016 at 2:04 PM, Michael Paquier
<michael.paqu...@gmail.com> wrote:
> Here are a couple of ways to address this problem:
> 1) Remove the check before applying the delay
> 2) Increase recovery_min_apply_delay to a time that will allow even
> slow machines to see a difference. By experience with the other tests
> 30s would be enough. The sleep time needs to be increased as well,
> making the time taken for the test to run longer
> 3) Remove all together 005, because doing either 1) or 2) reduces the
> value of the test.
> I'd like 1) personally, I still see value in this test.

So, as doing 1) would be actually equivalent to simply having a master
and checking that its standby replicates correctly, I have been
looking at 2) to see to how long the delay has to be set to make the
test failure-proof. After doing some measurements with hamster, 10s
and 15s have proved to not be enough unfortunately, 20s has not failed
in 10 attempts though. Attached is a patch to bump it to 20s, though I
would not complain if the test is actually removed to accelerate the
runs of this test suite.
diff --git a/src/test/recovery/t/005_replay_delay.pl b/src/test/recovery/t/005_replay_delay.pl
index 986851b..9b25f9e 100644
--- a/src/test/recovery/t/005_replay_delay.pl
+++ b/src/test/recovery/t/005_replay_delay.pl
@@ -24,19 +24,18 @@ $node_standby->init_from_backup($node_master, $backup_name,
 	has_streaming => 1);
 	'recovery.conf', qq(
-recovery_min_apply_delay = '2s'
+recovery_min_apply_delay = '20s'
 # Make new content on master and check its presence in standby
-# depending on the delay of 2s applied above.
+# depending on the delay of 20s applied above.
 	"INSERT INTO tab_int VALUES (generate_series(11,20))");
-sleep 1;
 # Here we should have only 10 rows
 my $result = $node_standby->safe_psql('postgres', "SELECT count(*) FROM tab_int");
-is($result, qq(10), 'check content with delay of 1s');
+is($result, qq(10), 'check content with no delay');
 # Now wait for replay to complete on standby
 my $until_lsn =
@@ -46,4 +45,4 @@ my $caughtup_query =
 $node_standby->poll_query_until('postgres', $caughtup_query)
   or die "Timed out while waiting for standby to catch up";
 $result = $node_standby->safe_psql('postgres', "SELECT count(*) FROM tab_int");
-is($result, qq(20), 'check content with delay of 2s');
+is($result, qq(20), 'check content with delay of 20s');
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to