Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X9GXZ-0000ap-Kl for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Jul 2014 16:34:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X9GXY-0004AL-Fa for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Jul 2014 16:34:16 +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 1X9GXX-00047y-5y for pgsql-bugs@postgresql.org; Mon, 21 Jul 2014 16:34:15 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X9GXT-0002d5-FE for pgsql-bugs@postgresql.org; Mon, 21 Jul 2014 16:34:13 +0000 Received: from intern.anarazel.de (p5DDC7BF8.dip0.t-ipconnect.de [93.220.123.248]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id C8B22500001; Mon, 21 Jul 2014 18:34:09 +0200 (CEST) Date: Mon, 21 Jul 2014 18:34:09 +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: <20140721163409.GB14989@alap3.anarazel.de> References: <20140720225653.GG5974@alap3.anarazel.de> <18673.1405897470@sss.pgh.pa.us> <18851.1405897900@sss.pgh.pa.us> <20140720233125.GI5974@alap3.anarazel.de> <19458.1405899435@sss.pgh.pa.us> <20140720234925.GJ5974@alap3.anarazel.de> <22178.1405903964@sss.pgh.pa.us> <26504.1405912770@sss.pgh.pa.us> <20140721161222.GA17049@alap3.anarazel.de> <3655.1405959656@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3655.1405959656@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-21 12:20:56 -0400, Tom Lane wrote: > Andres Freund writes: > > 2) From a pedantic POV lastSane* should be initialized to > > ReadNewTransactionId()/ReadNextMultiXactId(). On a busy system we could > > otherwise consider concurrently updated values as being too new if some > > longrunning transaction finishes. Also GetOldestXmin() can sometimes go > > backwards... > > If it's wrong then that's a pre-existing bug, but I don't think it's > wrong. I'm not wondering so much about vac_update_relstats(). There indeed the calls aren't new and the worst that can happen is a slightly older freeze limit. I'm more wondering about vac_update_datfrozenxid(). Afaics we very well could hit newFrozenXid = lastSaneFrozenXid = GetOldestXmin(NULL, true); newMinMulti = lastSaneMinMulti = GetOldestMultiXactId(); ... /* * If things are working properly, no relation should have a * relfrozenxid or relminmxid that is "in the future". However, such * cases have been known to arise due to bugs in pg_upgrade. If we * see any entries that are "in the future", chicken out and don't do * anything. This ensures we won't truncate clog before those * relations have been scanned and cleaned up. */ if (TransactionIdPrecedes(lastSaneFrozenXid, classForm->relfrozenxid) || MultiXactIdPrecedes(lastSaneMinMulti, classForm->relminmxid)) { bogus = true; break; } for a relation that has just been vacuumed by another backend. In a database with a high number of pg_class entries/much bloat it's not that unrealistic that relfrozenxid/relminmxid have been updated since the GetOldest* calls above. Since vac_update_relstats() writes them using heap_inplace_update() the window for that isn't particularly small. That could potentially lead to never updating the database freeze limits, right? 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