Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKWgC-00062C-6J for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jun 2017 21:15:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKWgB-0002ky-P6 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jun 2017 21:15:19 +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 1dKWee-0008Qj-QW for pgsql-hackers@postgresql.org; Mon, 12 Jun 2017 21:13:44 +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 1dKWeY-0001xP-2s for pgsql-hackers@postgresql.org; Mon, 12 Jun 2017 21:13:43 +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 v5CLDYU0023292; Mon, 12 Jun 2017 17:13:34 -0400 From: Tom Lane To: Andres Freund cc: Peter Eisentraut , pgsql-hackers@postgresql.org Subject: Re: Transactional sequence stuff breaks pg_upgrade In-reply-to: <20170612210221.vz2u373tcwu3g624@alap3.anarazel.de> References: <19785.1497215827@sss.pgh.pa.us> <9761.1497225808@sss.pgh.pa.us> <20170612210221.vz2u373tcwu3g624@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 12 Jun 2017 14:02:21 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23290.1497302014.1@sss.pgh.pa.us> Date: Mon, 12 Jun 2017 17:13:34 -0400 Message-ID: <23291.1497302014@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 Andres Freund writes: > On 2017-06-11 20:03:28 -0400, Tom Lane wrote: >> @@ -391,6 +391,13 @@ GetNewRelFileNode(Oid reltablespace, Rel >> bool collides; >> BackendId backend; >> >> + /* >> + * If we ever get here during pg_upgrade, there's something wrong; all >> + * relfilenode assignments during a binary-upgrade run should be >> + * determined by commands in the dump script. >> + */ >> + Assert(!IsBinaryUpgrade); >> + > I'm very doubtful that a) this doesn't get hit in practice, and b) that > we can rely on it going forward. At least until we change toasting to > not use the global oid counter. This is not about assignments from the global OID counter; the function it's touching is GetNewRelFileNode() not GetNewObjectId(). GetNewObjectId() definitely does get hit during a binary-upgrade restore, for all object types that pg_upgrade doesn't try to control the OIDs of --- which is most. We don't care, for the most part. But we *do* care about relfilenode assignments, for precisely the reason seen in this bug. *All* assignments of relfilenodes have to be shortcircuited by pg_upgrade override calls during a binary-restore run, or we risk filename collisions. So if this assert ever gets hit, we have something to fix. I intend to not only commit this, but back-patch it. There's enough changes in relevant code paths that logic that is fine in HEAD might not be fine in back branches. 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