Re: The return value of allocate_recordbuf()

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: The return value of allocate_recordbuf()
Дата
Msg-id CAHGQGwHULFc0YXtpxMw_=OEY-33VKgdYYt9UL2joo0EBNSpdxg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: The return value of allocate_recordbuf()  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: The return value of allocate_recordbuf()  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On Thu, Feb 12, 2015 at 4:02 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Feb 11, 2015 at 2:13 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>>
>> On Mon, Feb 9, 2015 at 7:02 AM, Michael Paquier
>> <michael.paquier@gmail.com> wrote:
>> > On Mon, Feb 9, 2015 at 7:58 PM, Fujii Masao <masao.fujii@gmail.com>
>> > wrote:
>> >> MemoryContextAllocExtended() was added, so isn't it time to replace
>> >> palloc()
>> >> with MemoryContextAllocExtended(CurrentMemoryContext,
>> >> MCXT_ALLOC_NO_OOM)
>> >> in allocate_recordbuf()?
>> >
>> > Yeah, let's move on here, but not with this patch I am afraid as this
>> > breaks any client utility using xlogreader.c in frontend, like
>> > pg_xlogdump or pg_rewind because MemoryContextAllocExtended is not
>> > available in frontend, only in backend. We are going to need something
>> > like palloc_noerror, defined on both backend (mcxt.c) and frontend
>> > (fe_memutils.c) side.
>>
>> Unfortunately, that gets us back into the exact terminological dispute
>> that we were hoping to avoid.  Perhaps we could compromise on
>> palloc_extended().
>
>
> Yes, why not using palloc_extended instead of palloc_noerror that has been
> clearly rejected in the other thread. Now, for palloc_extended we should
> copy the flags of MemoryContextAllocExtended to fe_memutils.h and have the
> same interface between frontend and backend (note that MCXT_ALLOC_HUGE has
> no real utility for frontends). Attached is a patch to achieve that,
> completed with a second patch for the problem related to this thread. Note
> that in the second patch I have added an ERROR in logical.c after calling
> XLogReaderAllocate, this was missing..

The first patch looks good to me basically. But I have one comment:
shouldn't we expose pg_malloc_extended as a global function like
we did pg_malloc? Some frontends might need to use it in the future.

Regards,

-- 
Fujii Masao



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

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: Abbreviated keys for Numeric
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: The return value of allocate_recordbuf()