Re: pg_ctl promote wait - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_ctl promote wait
Date
Msg-id CAB7nPqR8u9ToOqN2u_7bV_d1tuVQVgK=fkbpugDXG8cB9Z2+0A@mail.gmail.com
Whole thread Raw
In response to Re: pg_ctl promote wait  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: pg_ctl promote wait  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On Thu, Aug 11, 2016 at 3:24 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> On 8/7/16 9:44 PM, Michael Paquier wrote:
>>>> This is not a good
>>>> >> idea, and the idea of putting a wait argument in get_controlfile does
>>>> >> not seem a good interface to me. I'd rather see get_controlfile be
>>>> >> extended with a flag saying no_error_on_failure and keep the wait
>>>> >> logic within pg_ctl.
>>> >
>>> > I guess we could write a wrapper function in pg_ctl that encapsulated
>>> > the wait logic.
>> That's what I would do.
>
> New patches, incorporating your suggestions.

Thanks for the new set!

> I moved some of the error handling out of get_controlfile() and back
> into the callers, because it was getting too weird that that function
> knew so much about the callers' intentions.  That way we don't actually
> have to change the signature.

I have looked at them and the changes are looking fine for me. So I
have switched the patch as ready for committer, aka you.

Just a nit:
+       if (wait_seconds > 0)
+       {
+           sleep(1);
+           wait_seconds--;
+           continue;
+       }
This may be better this pg_usleep() instead of sleep().
-- 
Michael



pgsql-hackers by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: Slowness of extended protocol
Next
From: Jim Nasby
Date:
Subject: Re: Heap WARM Tuples - Design Draft