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 1hC811-0004KH-QD for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2019 19:27:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hC810-0000TJ-Cz for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2019 19:27:10 +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 1hC810-0000Sx-4Q for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2019 19:27:10 +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 1hC80x-0002aN-VK for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2019 19:27:09 +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 x34JQt19030376; Thu, 4 Apr 2019 15:26:55 -0400 From: Tom Lane To: David Rowley cc: Amit Langote , Julien Rouhaud , Robert Haas , Andres Freund , Thomas Munro , Amit Kapila , Haribabu Kommi , PostgreSQL Hackers , Rushabh Lathia Subject: Re: Inadequate executor locking of indexes In-reply-to: References: <19465.1541636036@sss.pgh.pa.us> <31575bce-fbcd-530d-1f97-455c7959cd73@lab.ntt.co.jp> <995.1554224619@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Fri, 05 Apr 2019 02:25:21 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30374.1554406015.1@sss.pgh.pa.us> Date: Thu, 04 Apr 2019 15:26:55 -0400 Message-ID: <30375.1554406015@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > Wrong patch. Here's what I meant to send. Pushed with some minor tweaking, mostly comments. Some notes: * We now have a general convention that queries always take the same lock type on indexes as on their parent tables, but that convention is not respected by index DDL. I'm not sure if there is any additional cleanup that should be done there. The DDL code intends to block concurrent execution of other DDL on the same index, in most cases, so it may be fine. At the very least, the different lock levels for those cases are clearly intentional, while I don't think that was true for DML. * I dropped the extra assertion you'd added to infer_arbiter_indexes, as it didn't seem necessary or appropriate. That function's just interested in inspecting the index, so it doesn't need to assume anything about how strong the lock is. I think the comment that was there was just trying to justify the shortcut of hard-wiring the lock level as RowExclusiveLock. * I went ahead and changed gin_clean_pending_list() to take RowExclusiveLock not AccessShareLock on its target index. I'm not quite sure that AccessShareLock is an actual bug there; it may be that GIN's internal conventions are such that that's safe. But it sure seemed darn peculiar, and at risk of causing future problems. regards, tom lane