Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1E0971337BA6 for ; Fri, 4 Mar 2011 16:24:25 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 81688-03 for ; Fri, 4 Mar 2011 20:24:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og114.obsmtp.com (exprod7og114.obsmtp.com [64.18.2.215]) by mail.postgresql.org (Postfix) with ESMTP id EF75A1337BBB for ; Fri, 4 Mar 2011 16:24:15 -0400 (AST) Received: from source ([209.85.215.50]) (using TLSv1) by exprod7ob114.postini.com ([64.18.6.12]) with SMTP ID DSNKTXFKbiFR8ZYzPrLfQQCwD3agwgUK1XuS@postini.com; Fri, 04 Mar 2011 12:24:16 PST Received: by mail-ew0-f50.google.com with SMTP id 26so933801ewy.37 for ; Fri, 04 Mar 2011 12:24:14 -0800 (PST) Received: by 10.213.12.212 with SMTP id y20mr684341eby.29.1299270254042; Fri, 04 Mar 2011 12:24:14 -0800 (PST) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id t5sm2207461eeh.2.2011.03.04.12.24.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 12:24:13 -0800 (PST) Message-ID: <4D714A6B.3030506@enterprisedb.com> Date: Fri, 04 Mar 2011 22:24:11 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.1.16) Gecko/20101226 Icedove/3.0.11 MIME-Version: 1.0 To: Kevin Grittner CC: YAMAMOTO Takashi , pgsql-bugs@postgresql.org Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much References: <201103041241.p24CfDZV063217@wwwmaster.postgresql.org> <4D70E897020000250003B4B8@gw.wicourts.gov> In-Reply-To: <4D70E897020000250003B4B8@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201103/109 X-Sequence-Number: 29619 On 04.03.2011 21:26, Kevin Grittner wrote: > "YAMAMOTO Takashi" 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