Re: foreign key locks

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Kevin Grittner <kgrittn(at)mail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: foreign key locks
Date: 2013-01-18 20:46:43
Message-ID: 20130118204643.GA4359@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-01-18 15:37:47 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > The reason is that there is an (unknown to me) rule that there must be
> > some data not associated with a buffer:
>
> > /*
> > * NOTE: We disallow len == 0 because it provides a useful bit of extra
> > * error checking in ReadRecord. This means that all callers of
> > * XLogInsert must supply at least some not-in-a-buffer data. [...]
> > */
>
> > This seems pretty strange to me. And having the rule be spelled out
> > only in a comment within XLogInsert and not at its top, and not nearby
> > the XLogRecData struct definition either, seems pretty strange to me.
> > I wonder how come every PG hacker except me knows this.
>
> I doubt it ever came up before. What use is logging only the content of
> a buffer page? Surely you'd need to know, for example, which relation
> and page number it is from.

It only got to be a length of 0 because the the data got removed due to
a logged full page write. And the backup block contains the data about
which blocks it is logging in itself.
I wonder if the check shouldn't just check write_len instead, directly
below the loop that ads backup blocks.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Boszormenyi Zoltan 2013-01-18 20:48:25 Re: Re: Proposal for Allow postgresql.conf values to be changed via SQL [review]
Previous Message Tom Lane 2013-01-18 20:37:47 Re: foreign key locks