pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: thusson@informiciel.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable.
Date: Fri, 7 Jun 2019 12:02:31 -0700
Message-ID: <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de> (raw)
In-Reply-To: <15840-06c9565bfd8099f6@postgresql.org>
References: <15840-06c9565bfd8099f6@postgresql.org>

Hi,

On 2019-06-07 18:22:20 +0000, PG Bug reporting form wrote:
> I was doing tables COPY between my old server with PG10.8 and the new one
> with 12Beta1. After each table is done, I make a vacuum of it.
> However PG12 has stopped working for wraparound protection. I was doing it
> on around 10 cpu, 1 table by cpu.

That was a new postgres 12 cluster, not a pg_upgraded one? And you just
did a bunch of COPYs? How many?

I'm not clear as to how the cluster got to wraparound if that's the
scenario. We use one xid per transaction, and copy doesn't use multiple
transactions internally.  Any chance you have triggers on these tables
that use savepoints internally?


> postgres --single emet_zhen
> VACUUM FREEZE VERBOSE;

Don't FREEZE in wraparound cases, that just makes it take longer.


> It worked a few hours and when I was thinking it was done as nothing was
> loggin anymore, I made a ctrl-\ and restarted the DB.
> I was still getting wraparound protection messages so I shutdown the DB
> again & redo the vacuum command but it didn't work anymore:

> zhen:semt700 $ postgres --single emet_zhen
> 2019-06-07 17:23:36 UTC  7251 WARNING:  database with OID 16394 must be
> vacuumed within 999995 transactions
> 2019-06-07 17:23:36 UTC  7251 HINT:  To avoid a database shutdown, execute a
> database-wide VACUUM in that database.
>         You might also need to commit or roll back old prepared
> transactions, or drop stale replication slots.
> PostgreSQL stand-alone backend 12beta1
> backend> VACUUM VERBOSE;
> 2019-06-07 17:23:59 UTC  7251 WARNING:  database "emet_zhen" must be
> vacuumed within 999995 transactions
> 2019-06-07 17:23:59 UTC  7251 HINT:  To avoid a database shutdown, execute a
> database-wide VACUUM in that database.
>         You might also need to commit or roll back old prepared
> transactions, or drop stale replication slots.
> 2019-06-07 17:23:59 UTC  7251 LOG:  duration: 2417.639 ms  statement: VACUUM
> VERBOSE;

What do you mean by "didn't work anymore"? As far as I can tell the
VACUUM here succeeded?


> HINT:  To avoid a database shutdown, execute a database-wide VACUUM in that
> database.
> You might also need to commit or roll back old prepared transactions, or
> drop stale replication slots.

Did you check whether any of these are the case?

SELECT * FROM pg_replication_slots;
SELECT * FROM pg_prepared_xacts;

Could you also show

SELECT oid, datname, datfrozenxid, age(datfrozenxid), datminmxid, mxid_age(datminmxid) FROM pg_database ORDER BY age(datfrozenxid) DESC;
SELECT * FROM pg_control_checkpoint();

Greetings,

Andres Freund





view thread (9+ messages)  latest in thread

Message-ID: <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de>
Permalink:  ../20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de

 · 

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: andres@anarazel.de, thusson@informiciel.com
  Subject: Re: BUG #15840: Vacuum does not work after database stopped for wraparound protection. Database seems unrepearable.
  In-Reply-To: <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de>
  References: <15840-06c9565bfd8099f6@postgresql.org> <20190607190231.6psb6w3bvlod7lvk@alap3.anarazel.de>

* 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