Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLX8m-0003rN-BK for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2019 18:06:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hLX8j-00033c-M0 for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2019 18:06:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLX8j-0002zx-BV for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2019 18:06:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLX8g-0004yt-Bu for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2019 18:06:00 +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 x3UI5oin029547; Tue, 30 Apr 2019 14:05:50 -0400 From: Tom Lane To: Andres Freund cc: Michael Paquier , Postgres hackers Subject: Re: REINDEX INDEX results in a crash for an index of pg_class since 9.6 In-reply-to: <20190430173457.pg6i6urvevse5jer@alap3.anarazel.de> References: <20190426020248.iyev66bkpf2abxqd@alap3.anarazel.de> <7882.1556290296@sss.pgh.pa.us> <12189.1556575627@sss.pgh.pa.us> <20190429220924.lfptluzkujb26y2n@alap3.anarazel.de> <20190430030342.jmbgnih4q3cdoufz@alap3.anarazel.de> <26051.1556599053@sss.pgh.pa.us> <26528.1556599820@sss.pgh.pa.us> <20190430070552.jzqgcy4ihalx7nur@alap3.anarazel.de> <30579.1556639470@sss.pgh.pa.us> <20190430173457.pg6i6urvevse5jer@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 30 Apr 2019 10:34:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29545.1556647550.1@sss.pgh.pa.us> Date: Tue, 30 Apr 2019 14:05:50 -0400 Message-ID: <29546.1556647550@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > It's the lock-upgrade problem I theorized about > upthread. ReindexIndex(), via RangeVarCallbackForReindexIndex(), takes a > ShareLock on pg_class, and then goes on to upgrade to RowExclusiveLock > in RelationSetNewRelfilenode(). But at that time another session > obviously can already have the ShareLock and would also want to upgrade. Hmm. Note that this is totally independent of the deadlock mechanism I reported in my last message on this thread. I also wonder whether clobber-cache testing would expose cases we haven't seen that trace to the additional catalog accesses caused by cache reloads. > I'm not sure it's worth fixing this. I am not sure it's even *possible* to fix all these cases. Even if we could, it's out of scope for v12 let alone the back branches. I think the only practical solution is to remove those reindex tests. Even if we ran them in a script with no concurrent scripts, there'd be risk of failures against autovacuum, I'm afraid. Not often, but often enough to be annoying. Possibly we could run them in a TAP test that configures a cluster with autovac disabled? regards, tom lane