Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X8yHK-0005yX-KD for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jul 2014 21:04:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X8yHJ-0007S5-4l for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jul 2014 21:04:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X8yHH-0007Rw-39 for pgsql-bugs@postgresql.org; Sun, 20 Jul 2014 21:04:15 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X8yHD-0006cH-EC for pgsql-bugs@postgresql.org; Sun, 20 Jul 2014 21:04:13 +0000 Received: from intern.anarazel.de (p5DDC4963.dip0.t-ipconnect.de [93.220.73.99]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 4EA18500001; Sun, 20 Jul 2014 23:04:09 +0200 (CEST) Date: Sun, 20 Jul 2014 23:04:08 +0200 From: Andres Freund To: Tom Lane Cc: Bruce Momjian , Alvaro Herrera , PostgreSQL Bugs Subject: Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts Message-ID: <20140720210408.GC5974@alap3.anarazel.de> References: <20140619220425.GQ18688@eldon.alvh.no-ip.org> <20140620010653.GS18688@eldon.alvh.no-ip.org> <20140620180725.GD29143@momjian.us> <20140624201346.GB17110@momjian.us> <20140627210520.GP7340@eldon.alvh.no-ip.org> <20140701161419.GA16033@momjian.us> <20140701190105.GA7340@eldon.alvh.no-ip.org> <20140701193047.GB16033@momjian.us> <9879.1405877821@sss.pgh.pa.us> <13210.1405886125@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13210.1405886125@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2014-07-20 15:55:25 -0400, Tom Lane wrote: > I wrote: > > I started transcribing Bruce's proposed fix procedure at > > https://wiki.postgresql.org/wiki/20140702pg_upgrade_fix > > into the release notes, but I'm afraid it's all wet. > > > He's suggesting copying the last checkpoint's NextMultiXactId into > > datminmxid/relminmxid, which is surely the wrong thing: that's likely to > > be newer than all mxids in the tables, not older than them. I thought at > > first that this was a simple thinko and he meant to write oldestMultiXid, > > but here's the thing: if we're in the situation where we've got > > wraparound, isn't oldestMultiXid going to be 1? The value recorded in the > > checkpoint isn't magic, it's just going to be extracted from whatever's in > > pg_database; and the whole problem here is that we can't trust that data. > > Where can we get a useful lower bound from? > > Ugh: it's worse than that. pg_upgrade itself is using this utterly > nonsensical logic to set datminmxid/relminmxid. This is a stop-ship > issue for 9.3.5. > > After some reflection it seems to me that we could estimate oldestmxid for > a pre-9.3 source cluster as the NextMultiXactId from its pg_control less > 2000000000 or so. This will nearly always be much older than the actual > oldest mxid, but that's okay --- the next vacuuming cycle will advance the > datminmxid/relminmxid values to match reality, so long as they aren't > wrapped around already. I think NextMultiXactId should be fine when upgrading from pre 9.3 clusters. Pre 9.3 multis that have been written before a shutdown don't really have a meaning: To the point that we actually never look at them. MultiXactIdSetOldestVisible() would have set oldestMXact to MultiXactState->nextMXact if no backend has any active ones. GetMultiXactIdMembers et al will deal with that. So I think for pg_upgrade itself using NextMulti as a replacement for oldestMXact is fine. Now that obviously does *not* mean it's safe to do that to after the cluster has already been running 9.3+. Greetings, Andres Freund -- Andres Freund 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