pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Alexander Shutyaev <shutyaev@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: pg_upgrade and wraparound
Date: Mon, 11 Jun 2018 13:14:12 -0400
Message-ID: <7382.1528737252@sss.pgh.pa.us> (raw)
In-Reply-To: <20180611170812.7ypf6xs6dlteo57j@alap3.anarazel.de>
References: <CAGBp8g_=Zxfiny8pa8sOb7pDxjzSGmcTBAJGYUrOJ6TDK9+nyQ@mail.gmail.com>
	<107c7c17-2e53-6cd1-1dbd-94d63f7a205f@aklaver.com>
	<9825.1528573946@sss.pgh.pa.us>
	<20180611170812.7ypf6xs6dlteo57j@alap3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> I suspect the issue is that pg_resetwal does:
> 	if (set_xid != 0)
> 	{
> 		ControlFile.checkPointCopy.nextXid = set_xid;

> 		/*
> 		 * For the moment, just set oldestXid to a value that will force
> 		 * immediate autovacuum-for-wraparound.  It's not clear whether adding
> 		 * user control of this is useful, so let's just do something that's
> 		 * reasonably safe.  The magic constant here corresponds to the
> 		 * maximum allowed value of autovacuum_freeze_max_age.
> 		 */
> 		ControlFile.checkPointCopy.oldestXid = set_xid - 2000000000;
> 		if (ControlFile.checkPointCopy.oldestXid < FirstNormalTransactionId)
> 			ControlFile.checkPointCopy.oldestXid += FirstNormalTransactionId;
> 		ControlFile.checkPointCopy.oldestXidDB = InvalidOid;
> 	}

> but we have codepath that doesn't check for oldestXidDB being
> InvalidOid.  Not great.

Hm, I think I'd define the problem as "pg_resetwal is violating the
expectation that oldestXidDB be valid".

However, this just explains the basically-cosmetic issue that the
complaint message mentions OID 0.  It doesn't really get us to the
answer to why Alexander is seeing a failure.  It might be useful
to see pg_controldata output for the old cluster, as well as
"select datname, datfrozenxid from pg_database" output from the
old cluster.

			regards, tom lane




view thread (30+ messages)  latest in thread

Message-ID: <7382.1528737252@sss.pgh.pa.us>
Permalink:  ../7382.1528737252@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7382.1528737252@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, adrian.klaver@aklaver.com, shutyaev@gmail.com
  Subject: Re: pg_upgrade and wraparound
  In-Reply-To: <7382.1528737252@sss.pgh.pa.us>
  References: <CAGBp8g_=Zxfiny8pa8sOb7pDxjzSGmcTBAJGYUrOJ6TDK9+nyQ@mail.gmail.com> <107c7c17-2e53-6cd1-1dbd-94d63f7a205f@aklaver.com> <9825.1528573946@sss.pgh.pa.us> <20180611170812.7ypf6xs6dlteo57j@alap3.anarazel.de> <7382.1528737252@sss.pgh.pa.us>

* 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