Re: BUG #5915: OldSerXidAdd inflates pg_serial too much

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: YAMAMOTO Takashi <yamt(at)mwd(dot)biglobe(dot)ne(dot)jp>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much
Date: 2011-03-04 20:24:11
Message-ID: 4D714A6B.3030506@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 04.03.2011 21:26, Kevin Grittner wrote:
> "YAMAMOTO Takashi"<yamt(at)mwd(dot)biglobe(dot)ne(dot)jp> wrote:
>
>> a seemingly wrong math in OldSerXidAdd makes it busy writing zeros
>> to pg_serial.
>>
>> [patch]
>
> Your fix looks correct to me -- we want to get from a SLRU segment
> number to the first page of that segment, so SLRU_PAGES_PER_SEGMENT
> is the right multiplier.
>
> Thanks!
>
> While I was looking at it, I noticed some obsolete comment lines
> which should be removed. Trivial patch attached.

Hmm, if I'm reading that function correctly, it makes sure that when
headPage < 0 (which implies that the SLRU has not been used since
startup, right? ), it zeroes out the whole SLRU file, not only the
currently active region. At least pg_subtrans doesn't seem to bother
with that, StartupSubTrans only zeroes the active region.

I wonder if we should move the responsibility of truncating the SLRU to
checkpoint. At the moment, it's done in OldSerXidSetActiveSerXmin(),
while the callers are holding SerializableXactHashLock in exclusive
mode. While it'll probably go quickly in practice, it still seems like
there's a risk of stalling all new transactions for a few seconds while
that happens.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2011-03-04 20:33:40 Re: BUG #5915: OldSerXidAdd inflates pg_serial too much
Previous Message Peter Eisentraut 2011-03-04 20:16:26 Re: Cannot create collation?