pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Gould <daveg@sonic.net>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything
Date: Tue, 30 Sep 2014 00:44:11 +0000 (UTC)
Message-ID: <loom.20140930T022539-927@post.gmane.org> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Alvaro Herrera <alvherre <at> 2ndquadrant.com> writes:

> Well, yes, 9.3.4 had a bug fixed by this commit:
> 
> Author: Bruce Momjian <bruce <at> momjian.us>
> Branch: master [a61daa14d] 2014-07-02 15:29:38 -0400
> Branch: REL9_4_STABLE [b446a384b] 2014-07-02 15:29:38 -0400
> Branch: REL9_3_STABLE Release: REL9_3_5 [3d2e18510] 2014-07-02 15:29:38 
-0400
> 
>     pg_upgrade:  preserve database and relation minmxid values
> 
>     Also set these values for pre-9.3 old clusters that don't have values 
to
>     preserve.
> 
>     Analysis by Alvaro
> 
>     Backpatch through 9.3
> 
> > How do we fix the current issue with this one server? Is there an easy 
fix?
> > Thanks.
> 
> As far as I am aware, you should
>   UPDATE pg_database SET datminmxid=20783
> 
> and that should fix it.  The oldestMulti value in pg_control would get
> updated by itself some time later.  If you experience stalls before
> oldestMulti fixes itself, you could stop the server (cleanly!) and then
> pg_resetxlog -m x,y where x is the correct nextMulti value from
> pg_controldata and y is 20783.

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 ;

And then used the oldest one to update pg_database.datminmxid. After a 
checkpoint and shutdown/restart I see that it was written to pg_controldata
too. Afterwards I was able to run a vacuum freeze on the problem table.

Questions:

1) Is the procedure above safe and effective for this, or did I just hose my 
databases?

2) If the procedure above is not safe, what do we do instead?

3) Is this likely to affect all 9.3.x<5 upgraded databases? If so, how do we 
fix it before too much damage happens in the wider world?

-dg

--
David Gould                               daveg <at> sonic.net
If simplicity worked, the world would be overrun with insects.




-- 
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: <loom.20140930T022539-927@post.gmane.org>
Permalink:  ../loom.20140930T022539-927@post.gmane.org/
Also on:    postgresql.org/message-id/loom.20140930T022539-927@post.gmane.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: daveg@sonic.net
  Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything
  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>

* 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