pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: David Gould <daveg@sonic.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything
Date: Wed, 1 Oct 2014 18:32:12 -0300
Message-ID: <20141001213211.GW5311@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <loom.20140930T022539-927@post.gmane.org>
References: <20140825225029.2536.5315@wrigleys.postgresql.org>
	<20140827152636.GC7046@eldon.alvh.no-ip.org>
	<33085ff949d9484f8d3e6a1b86d15717@CO2PR05MB569.namprd05.prod.outlook.com>
	<20140827154800.GE7046@eldon.alvh.no-ip.org>
	<f7046bb9cac04dbb817905760a1e9c8d@CO2PR05MB569.namprd05.prod.outlook.com>
	<20140827164527.GG7046@eldon.alvh.no-ip.org>
	<D0235DA4.15146%dbhandary@switchfly.com>
	<20140827175105.GI7046@eldon.alvh.no-ip.org>
	<loom.20140930T022539-927@post.gmane.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

David Gould wrote:

> We ran into this on two instances last night and I'm starting to worry that 
> many others may hit it as well. As far as I can tell any postgres instance 
> that was upgraded to 9.3 by a pre-9.3.5 pg_upgrade is at risk as they all 
> will have:
> 
>   Latest checkpoint's oldestMultiXid:   1
> 
> The workaround above is good if you still have the old cluster around from 
> before the upgrade. We did not, that was all cleaned up months ago. Which 
> raises the question: how do you fix a 9.3 instance that has oldestMultiXid = 
> 1 without access to the pre-upgrade instance. That is, where do you get the 
> correct value of oldestMultiXid to set into pg_database.datxminmxid?
> 
> I took a guess that the oldest pg_class.relminmxid for all the tables in all 
> the databases would be ok and updated pg_database.datminmxid witt that. That 
> is, in each database I ran:
> 
>   select relname, relminmxid, age(relminmxid)
>     from pg_class
>     where relkind = 'r'
>       and age(relminmxid) < 2147483647
>     order by 3 desc limit 1 ;

Unfortunately, the age() function is only valid for transaction IDs, not
multixacts.  In certain cases the values returned might be sensible, but
they don't have to be, and if the counters are not relatively close to
one another, most likely they won't be sensible.  A new function was
added to 9.4, but that doesn't help those in 9.3.
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=36ad1a87a368d837d5c2260b2fd2ff83e9...
(I guess you could have an extension containing that function.)
My bet is that is the reason you had to add the condition that the value
is less than 2^31 - 1.

Offhand, other than the way to obtain the multixact age, the procedure
seems sensible.

A better way not involving mxid_age() would be to use pg_controldata to
extract the current value of the mxid counter, then subtract the current
relminmxid from that value.

> 3) Is this likely to affect all 9.3.x<5 upgraded databases?

Yes.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (24+ messages)  latest in thread

Message-ID: <20141001213211.GW5311@eldon.alvh.no-ip.org>
Permalink:  ../20141001213211.GW5311@eldon.alvh.no-ip.org/
Also on:    postgresql.org/message-id/20141001213211.GW5311@eldon.alvh.no-ip.org

 · 

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: alvherre@2ndquadrant.com, daveg@sonic.net
  Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything
  In-Reply-To: <20141001213211.GW5311@eldon.alvh.no-ip.org>
  References: <20140825225029.2536.5315@wrigleys.postgresql.org> <20140827152636.GC7046@eldon.alvh.no-ip.org> <33085ff949d9484f8d3e6a1b86d15717@CO2PR05MB569.namprd05.prod.outlook.com> <20140827154800.GE7046@eldon.alvh.no-ip.org> <f7046bb9cac04dbb817905760a1e9c8d@CO2PR05MB569.namprd05.prod.outlook.com> <20140827164527.GG7046@eldon.alvh.no-ip.org> <D0235DA4.15146%dbhandary@switchfly.com> <20140827175105.GI7046@eldon.alvh.no-ip.org> <loom.20140930T022539-927@post.gmane.org> <20141001213211.GW5311@eldon.alvh.no-ip.org>

* 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