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

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is
Дата
Msg-id 54AD4182.7040601@vmware.com
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is  (Andres Freund <andres@2ndquadrant.com>)
Список 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: psql -c does not honor ON_ERROR_STOP
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Turning recovery.conf into GUCs