Re: Re: [COMMITTERS] pgsql: Correctly align page's images in generic wal API

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Correctly align page's images in generic wal API
Date: 2016-05-17 15:35:46
Message-ID: 1146.1463499346@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
>> Instead of allocating this memory unconditionally for each buffer,
>> wouldn't it be better to set all the page pointers to NULL in
>> GenericXLogStart and allocate memory only once a buffer is registered
>> in GenericXLogRegisterBuffer when finding a free slot? This patch is
>> wasting many cycles.

> GenericXLogRegisterBuffer() could be called in another MemoryContext what
> can be a reason for strange bugs. Right now only a few pages could be
> involved in one round of GenericWal. I don't believe that such allocation
> could be a reason of noticable performance degradation. Although I didn't
> check that.

You could allocate all the pages in one palloc, though, and then just
set the pointers via address arithmetic.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Teodor Sigaev 2016-05-17 19:09:47 pgsql: Allocate all page images at once in generic wal interface
Previous Message Magnus Hagander 2016-05-17 15:29:08 pgsql: Fix typo

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2016-05-17 15:37:29 Re: 10.0
Previous Message Shay Rojansky 2016-05-17 15:35:30 Parameters don't work in FETCH NEXT clause?