Re: Re: [COMMITTERS] pgsql: Properly access a buffer's LSN using existing access macros

Lists: pgsql-committerspgsql-hackers
From: alvherre(at)postgresql(dot)org (Alvaro Herrera)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Properly access a buffer's LSN using existing access macros
Date: 2008-10-20 21:11:15
Message-ID: 20081020211115.2DEAE7545A4@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Properly access a buffer's LSN using existing access macros instead of abusing
knowledge of page layout.

Stolen from Jonah Harris' CRC patch

Modified Files:
--------------
pgsql/src/backend/storage/buffer:
bufmgr.c (r1.238 -> r1.239)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/buffer/bufmgr.c?r1=1.238&r2=1.239)


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Properly access a buffer's LSN using existing access macros
Date: 2008-10-20 21:23:22
Message-ID: 20081020212322.GG4116@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera wrote:
> Log Message:
> -----------
> Properly access a buffer's LSN using existing access macros instead of abusing
> knowledge of page layout.

Hmm, I just noticed this comment in bufpage.h (which was also in Jonah's
patch) :-(

typedef struct PageHeaderData
{
/* XXX LSN is member of *any* block, not only page-organized ones */
...

So I'm now wondering if the above patch is really correct. It'll of
course work, but is it appropriate?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Properly access a buffer's LSN using existing access macros
Date: 2008-10-20 21:49:15
Message-ID: 36e682920810201449w1e1bfca7j41f4aa44ee171cee@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Mon, Oct 20, 2008 at 5:23 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
> Hmm, I just noticed this comment in bufpage.h (which was also in Jonah's
> patch) :-(
>
> typedef struct PageHeaderData
> {
> /* XXX LSN is member of *any* block, not only page-organized ones */

Passed regressions and several benchmarks for me.

--
Jonah H. Harris, Senior DBA
myYearbook.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Properly access a buffer's LSN using existing access macros
Date: 2008-10-20 22:54:04
Message-ID: 5757.1224543244@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Hmm, I just noticed this comment in bufpage.h (which was also in Jonah's
> patch) :-(

> typedef struct PageHeaderData
> {
> /* XXX LSN is member of *any* block, not only page-organized ones */
> ...

We don't have any non-page-organized blocks ;-)

Seriously, if the issue ever became significant I'd expect that we'd add
a buffer flag to tell whether the buffer had a LSN or not, and set this
appropriately at buffer readin time depending on where we got the page
from. That would then cue the write logic to know what to do. (In
particular, I suppose we'd need to do this if we try to migrate clog and
friends into the main buffer arena.)

regards, tom lane