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.
> Note that this patch adds a small routine called command_result in
> TestLib.pm, able to return stdout, stderr and the exit code. That's
> really handy, and I am planning to use something like that as well in
> the replication test suite.
Makes sense to me.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services