Re: BUG #14230: Wrong timeline returned by pg_stop_backup on a standby

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, Francesco Canovai <francesco(dot)canovai(at)2ndquadrant(dot)it>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #14230: Wrong timeline returned by pg_stop_backup on a standby
Date: 2016-07-11 11:26:59
Message-ID: CAA4eK1KvW4EVWcAngYhBK_9Qy5qCxrNP+x2vHAxN8Qv=PpUzvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Jul 11, 2016 at 3:31 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
>
> On Thu, Jul 7, 2016 at 8:38 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>>
>> On Thu, Jul 7, 2016 at 12:57 AM, Marco Nenciarini
>> <marco(dot)nenciarini(at)2ndquadrant(dot)it> wrote:
>> > After further analysis, the issue is that we retrieve the starttli from
>> > the ControlFile structure, but it was using ThisTimeLineID when writing
>> > the backup label.
>> >
>> > I've attached a very simple patch that fixes it.
>>
>> ThisTimeLineID is always set at 0 on purpose on a standby, so we
>> cannot rely on it (well it is set temporarily when recycling old
>> segments). At recovery when parsing the backup_label file there is no
>> actual use of the start segment name, so that's only a cosmetic
>> change. But surely it would be better to get that fixed, because
>> that's useful for debugging.
>>
>> While looking at your patch, I thought that it would have been
>> tempting to use GetXLogReplayRecPtr() to get the timeline ID when in
>> recovery, but what we really want to know here is the timeline of the
>> last REDO pointer, which is starttli, and that's more consistent with
>> the fact that we use startpoint when writing the backup_label file. In
>> short, +1 for this fix.
>>
>> I am adding that in the list of open items, adding Magnus in CC whose
>> commit for non-exclusive backups is at the origin of this defect.
>
>
> I agree this looks correct.
>
> But isn't this also a pre-existing bug in 9.5? Or did we change something
> else that suddenly made it visible?
>

I think the bug is pre-existing, but it becomes visible to user now by new API.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-07-11 13:05:54 Re: BUG #14230: Wrong timeline returned by pg_stop_backup on a standby
Previous Message Magnus Hagander 2016-07-11 10:01:40 Re: BUG #14230: Wrong timeline returned by pg_stop_backup on a standby

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2016-07-11 11:36:37 pg_xlogdump bad error msg?
Previous Message Netanel Katzburg 2016-07-11 11:14:51 Re: Disable WAL completely - Performance and Persistency research