Re: pg_rewind exiting with error code 1 when source and target are on the same timeline - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: pg_rewind exiting with error code 1 when source and target are on the same timeline
Date
Msg-id CAB7nPqSKpFs_azsc__cMr2Tc1MNqS=1t0KxL4pSVR6C9afWNoQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_rewind exiting with error code 1 when source and target are on the same timeline  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pg_rewind exiting with error code 1 when source and target are on the same timeline  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
On Fri, Dec 4, 2015 at 12:22 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On 10/22/15 1:42 AM, Michael Paquier wrote:
>> I am not sure that I am not getting completely your point, why would
>> it be a win to remove this safety check? We surely do not want to look
>> for the common ancestor timeline if the target and source nodes have
>> the same timeline, so we should not remove this check and just set
>> rewind_needed to false to fallback to the same exit(0) for all those
>> code paths. Per se the attached for example.
>
> After playing with this a bit, I think your patch is correct.  The code
> has drifted a bit in the meantime, so attached is an updated patch.

Thanks for looking at it.

> Your patch added variable initializations for divergerec and
> lastcommontli.  Was that to avoid compiler warnings about uninitialized
> variables?  I didn't get these here.  If that's the issue, maybe these
> initializations should be moved to the if (same timeline) branch, to get
> it a bit closer to the action.

Looking again at this patch, I don't actually recall why I added them.
It does not matter to initialize them anyway..

> I also added a test for this case.  (It would currently fail.)

Thanks, this looks good to me.
--
Michael

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_rewind exiting with error code 1 when source and target are on the same timeline
Next
From: Michael Paquier
Date:
Subject: Re: Incorrect UPDATE trigger invocation in the UPDATE clause of an UPSERT statement.