pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: drkp@csail.mit.edu
Cc: yamt@mwd.biglobe.ne.jp
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much
Date: Tue, 08 Mar 2011 12:23:47 +0200
Message-ID: <4D7603B3.4000102@enterprisedb.com> (raw)
In-Reply-To: <4D737EDB020000250003B531@gw.wicourts.gov>
References: <4D737EDB020000250003B531@gw.wicourts.gov>

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



view thread (11+ messages)

Message-ID: <4D7603B3.4000102@enterprisedb.com>
Permalink:  ../4D7603B3.4000102@enterprisedb.com/
Also on:    postgresql.org/message-id/4D7603B3.4000102@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, Kevin.Grittner@wicourts.gov, drkp@csail.mit.edu, yamt@mwd.biglobe.ne.jp
  Subject: Re: BUG #5915: OldSerXidAdd inflates pg_serial too much
  In-Reply-To: <4D7603B3.4000102@enterprisedb.com>
  References: <4D737EDB020000250003B531@gw.wicourts.gov> <4D7603B3.4000102@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox