Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 62A2D1337BD7 for ; Tue, 8 Mar 2011 06:24:02 -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 13984-07 for ; Tue, 8 Mar 2011 10:23:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og109.obsmtp.com (exprod7og109.obsmtp.com [64.18.2.171]) by mail.postgresql.org (Postfix) with ESMTP id 195901337BD6 for ; Tue, 8 Mar 2011 06:23:53 -0400 (AST) Received: from source ([209.85.215.180]) (using TLSv1) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKTXYDuFLQUDevm+1WMV/qWQYeXJHY0zEx@postini.com; Tue, 08 Mar 2011 02:23:54 PST Received: by eyg24 with SMTP id 24so1843615eyg.25 for ; Tue, 08 Mar 2011 02:23:51 -0800 (PST) Received: by 10.213.14.129 with SMTP id g1mr2586469eba.93.1299579831281; Tue, 08 Mar 2011 02:23:51 -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 t5sm496122eeh.8.2011.03.08.02.23.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2011 02:23:49 -0800 (PST) Message-ID: <4D7603B3.4000102@enterprisedb.com> Date: Tue, 08 Mar 2011 12:23:47 +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: drkp@csail.mit.edu, yamt@mwd.biglobe.ne.jp, pgsql-bugs@postgresql.org Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much References: <4D737EDB020000250003B531@gw.wicourts.gov> In-Reply-To: <4D737EDB020000250003B531@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/146 X-Sequence-Number: 29656 On 06.03.2011 20:32, Kevin Grittner wrote: > Heikki Linnakangas wrote: > >> Here's what I had in mind. Can you review > > The additions and modifications to the comments all look good to me. > I can see why you renamed one field and eliminated another; no > problem there. I'm really surprised, when you ignore those changes, > how little was needed to move this to checkpoint time. I hadn't > looked into that, and expected it to be much harder to do, even > though I should know better by now. :-) Ok, committed, so that we get it into the alpha4 release that's wrapped soon. > I looked it over and pondered a bit, and have three concerns. > > (1) Why is it safe to assume that checkpoint will occur before this > wraps around? Is it just that it takes a billion transactions, and > one can reasonably expect a checkpoint before reaching that point, or > is there some other safety net? Hmm, good question. The maximum checkpoint interval is 30 minutes, so you would need a sustained transaction rate of over 500000 transactions per second to bump into that. If it happens, I don't think there's any harm done. OldSerXidAdd() initializes any new pages to zero, and the truncation code should never truncate away files that are still in use. > (2) What if there are only occassional clusters of serializable > transactions? If the one SLRU page is held so that it isn't > repeatedly truncated and re-zeroed, does it pose a risk if > transaction IDs wrap around while that page is held? (I don't think > this is a new problem with the proposed patch, it just made it more > obvious.) Should we be using RecentGlobalXmin or something in that > checkpoint function to truncate that last page when it is safe to do > so? I didn't quite understand this, but I believe the fact that OldSerXidAdd() initializes any new pages to zero protects from this too. > (3) That unnecessary SLRU flush should probably be conditioned on a > #ifdef or some not-very-visible GUC or something. With the problems > which some people have with writes glutting the I/O during checkpoint > I'd hate to add to the writes at checkpoint time just for debugging > info -- at least without a specific request for that behavior. We have similar unnecessary SLRU flush in CheckpointSUBTRANS too, so I don't think that's necessary. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com