Re: Improve sleep processing of pg_rewind TAP tests

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve sleep processing of pg_rewind TAP tests
Date: 2015-04-16 04:00:28
Message-ID: CAB7nPqSQfTfge-whbpRD99BEbJOX3Z+Pepwa+TUBxA0fDtuVyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 16, 2015 at 12:51 PM, Alvaro Herrera wrote:
> Michael Paquier wrote:
>
>> However after discussion with a colleague we have noticed that those
>> values may not be enough in slow environments, a value of up to 10s
>> being sometimes needed after promotion to make tests pass.
>
> Yeah, hardcoded sleep times are not reliable. (/me would love to get
> rid of hardcoded times in isolationtester timeout.spec test ...)
>
>> Attached is a patch improving this sleep logic and doing the following things:
>> 1) To ensure that standby has caught up, check replay position on the
>> standby and compare it with the current WAL position of master.
>
>> 2) To ensure that promotion is effective, use pg_is_in_recovery() and
>> continue processing until we are sure that the standby is out of
>> recovery.
>
> Seems reasonable, but why are you sleeping 1s if pg_ctl -w is in use? I
> thought the -w would wait until promotion has taken effect, so there's
> no need to sleep additional time.

Visibly that's not the case for this test case, the timing issues that
we saw happened not because of the standby not catching up, but
because of the promotion not taking effect in a timely fashion. And
that's as well something I saw on my OSX box some days ago as well,
explaining why the sleep time has been increased from 1 to 2 in
53ba1077. This patch just takes it the careful way. In perl, system
waits for the process of pg_ctl to exit before moving on, perhaps the
problem is that pg_ctl thinks that promotion is done, but the node is
not quite ready, explaining why the test fails.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Fittl 2015-04-16 04:36:32 Re: reparsing query
Previous Message Alvaro Herrera 2015-04-16 03:51:05 Re: Improve sleep processing of pg_rewind TAP tests