Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X8y2U-0005L4-Tq for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jul 2014 20:48:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X8y2U-0003yi-Dn for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Jul 2014 20:48:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X8y2T-0003yb-Fi for pgsql-bugs@postgresql.org; Sun, 20 Jul 2014 20:48:57 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X8y2P-0002cN-KB for pgsql-bugs@postgresql.org; Sun, 20 Jul 2014 20:48:56 +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 9A87C500001; Sun, 20 Jul 2014 22:48:52 +0200 (CEST) Date: Sun, 20 Jul 2014 22:48:52 +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: <20140720204852.GB5974@alap3.anarazel.de> References: <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> <20140720200225.GA5974@alap3.anarazel.de> <13755.1405887378@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13755.1405887378@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 16:16:18 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2014-07-20 13:37:01 -0400, Tom Lane 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. > > > I don't understand why we should do anything but remove the 0000 file if > > it's all zeroes? This seems far too complicated. Beside the fact that I > > doubt it's actually achieving anything reliably? > > This one is not about the extra 0000 file. It's about whether datminmxid > and relminmxid are wrong. In the previous coding of pg_upgrade, they'd > have been left at "1" even if that value has wrapped around into the > future. Yea, I'm rereading the thread atm. I'd stopped following it after a while and didn't notice the drift into a second problem. > Now, if you were lucky, you'd have no bad side-effects even if they had > wrapped around ... Hm. If relminmxid = 1 is still in the past everything should be fine, right? The next vacuum (which will run soon) will just set it anew. But if not /* relminmxid must never go backward, either */ if (MultiXactIdIsValid(minmulti) && MultiXactIdPrecedes(pgcform->relminmxid, minmulti)) { pgcform->relminmxid = minmulti; dirty = true; } will prevent it from being changed. Similarly /* ditto */ if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti)) { dbform->datminmxid = newMinMulti; dirty = true; } will prevent datminmxid from becoming sane. vac_truncate_clog() will be called with ReadNextMultiXactId() - - autovacuum_multixact_freeze_max_age as the truncation for multis. That itself would be fine since there won't be any actual multis in that range. The problem is that we might miss having to do a full table vacuum because we check relminmxid to determine that: scan_all |= MultiXactIdPrecedesOrEquals(onerel->rd_rel->relminmxid, mxactFullScanLimit); which then could cause problems in the future. Imo that means we need to fix this :( for existing clusters. 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