Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSQSn-00026r-9L for pgsql-general@arkaria.postgresql.org; Mon, 11 Jun 2018 17:18:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSQSm-0006EC-0Y for pgsql-general@arkaria.postgresql.org; Mon, 11 Jun 2018 17:18:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSQOb-0005yo-CZ for pgsql-general@lists.postgresql.org; Mon, 11 Jun 2018 17:14:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSQOY-00071q-DG for pgsql-general@postgresql.org; Mon, 11 Jun 2018 17:14:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5BHECiw007383; Mon, 11 Jun 2018 13:14:12 -0400 From: Tom Lane To: Andres Freund cc: Adrian Klaver , Alexander Shutyaev , pgsql-general Subject: Re: pg_upgrade and wraparound In-reply-to: <20180611170812.7ypf6xs6dlteo57j@alap3.anarazel.de> References: <107c7c17-2e53-6cd1-1dbd-94d63f7a205f@aklaver.com> <9825.1528573946@sss.pgh.pa.us> <20180611170812.7ypf6xs6dlteo57j@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 11 Jun 2018 10:08:12 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7381.1528737251.1@sss.pgh.pa.us> Date: Mon, 11 Jun 2018 13:14:12 -0400 Message-ID: <7382.1528737252@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund 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