Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKm1I-0002EC-6l for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 13:38:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKm1H-0004U2-Pq for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 13:38:07 +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.84_2) (envelope-from ) id 1dKm1G-0004Ss-Iv for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 13:38:06 +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.84_2) (envelope-from ) id 1dKm1E-0003yN-AD for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 13:38:05 +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 v5DDbx1Q032234; Tue, 13 Jun 2017 09:37:59 -0400 From: Tom Lane To: Robert Haas cc: Andres Freund , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: Transactional sequence stuff breaks pg_upgrade In-reply-to: References: <19785.1497215827@sss.pgh.pa.us> <9761.1497225808@sss.pgh.pa.us> <20170612210221.vz2u373tcwu3g624@alap3.anarazel.de> <23291.1497302014@sss.pgh.pa.us> <20170612212517.j3xe6am7hlztl6fw@alap3.anarazel.de> Comments: In-reply-to Robert Haas message dated "Tue, 13 Jun 2017 07:55:38 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32232.1497361079.1@sss.pgh.pa.us> Date: Tue, 13 Jun 2017 09:37:59 -0400 Message-ID: <32233.1497361079@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > The problem is that if a relfilenode ever gets assigned by > GetNewRelFileNode() during a binary-upgrade restore, that OID may turn > out to be used by some other object later in the dump. And then > you're dead, because the dump restore will fail later on complaining > about, well, I forget the error message wording exactly, but, > basically, an OID collision. Right. > So if we change the rules in such a way > that objects which currently lack TOAST tables acquire them, we need > to first restore all of the objects *without* adding any new TOAST > tables, and then at the end create any new TOAST tables once we have a > complete list of the relfilenodes that are actually used. toasting.c explains why this currently doesn't seem necessary: /* * In binary-upgrade mode, create a TOAST table if and only if * pg_upgrade told us to (ie, a TOAST table OID has been provided). * * This indicates that the old cluster had a TOAST table for the * current table. We must create a TOAST table to receive the old * TOAST file, even if the table seems not to need one. * * Contrariwise, if the old cluster did not have a TOAST table, we * should be able to get along without one even if the new version's * needs_toast_table rules suggest we should have one. There is a lot * of daylight between where we will create a TOAST table and where * one is really necessary to avoid failures, so small cross-version * differences in the when-to-create heuristic shouldn't be a problem. * If we tried to create a TOAST table anyway, we would have the * problem that it might take up an OID that will conflict with some * old-cluster table we haven't seen yet. */ I don't really see any near-term reason why we would need to change this. In the long run, it would certainly be cleaner if pg_upgrade dropped the force-the-relfilenode-assignment approach and instead remapped relfilenodes from old cluster to new. But I think it's just for cleanliness rather to fix any live or foreseeable bug. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers