Re: pg_rewind exiting with error code 1 when source and target are on the same timeline

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: pg_rewind exiting with error code 1 when source and target are on the same timeline
Date: 2015-12-04 03:22:31
Message-ID: 566106F7.4000404@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

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.

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

Attachment Content-Type Size
0001-pg_rewind-Don-t-error-if-the-two-clusters-are-alread.patch application/x-patch 3.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-12-04 04:10:49 Re: pg_rewind exiting with error code 1 when source and target are on the same timeline
Previous Message Peter Geoghegan 2015-12-04 01:34:12 Re: Incorrect UPDATE trigger invocation in the UPDATE clause of an UPSERT statement.