Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is
Date: 2015-01-07 14:24:02
Message-ID: 54AD4182.7040601@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 01/06/2015 03:22 PM, Andres Freund wrote:
> On 2015-01-05 18:45:22 +0200, Heikki Linnakangas wrote:
>> On 01/03/2015 08:59 PM, Andres Freund wrote:
>>> Did you perhaps intend to use XLogFileInit(use_existing = true)
>>> instead of XLogFileOpen()? That works for me.
>>
>> Hmm, that doesn't sound right either. XLogFileInit is used when you switch
>> to a new segment, not to open an old segment for writing. It happens to
>> work, because with use_existing = true it will in fact always open the old
>> segment, instead of creating a new one, but I don't think that's in the
>> spirit of how that function's intended to be used.
>
> Well, its docs say "Create a new XLOG file segment, or open a
> pre-existing one.", so it's not that mismatched. We really don't know
> whether the EndOfLog's segment already exist in this scenario. Also,
> doesn't XLogWrite() essentially use it in the same way?

XLogWrite() is smarter. It uses XLogFileInit() when switching to a new
segment, and XLogFileOpen when writing to the middle of a segment.

Committed the fix to not open the segment at all.

- Heikki

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2015-01-07 19:50:35 pgsql: docs: Reword CREATE POLICY documentation.
Previous Message Heikki Linnakangas 2015-01-07 14:20:39 pgsql: Don't open a WAL segment for writing at end of recovery.

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2015-01-07 15:14:05 Re: Turning recovery.conf into GUCs
Previous Message Joe Conway 2015-01-07 13:53:05 Re: psql -c does not honor ON_ERROR_STOP