Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4sY2-00066x-Lh for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jan 2021 21:40:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4sY1-0006Qm-8f for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jan 2021 21:40:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4sUt-0002Z4-1f for pgsql-hackers@lists.postgresql.org; Wed, 27 Jan 2021 21:37:07 +0000 Received: from new3-smtp.messagingengine.com ([66.111.4.229]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4sUq-0003bN-LZ for pgsql-hackers@lists.postgresql.org; Wed, 27 Jan 2021 21:37:06 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 4021F5808CC; Wed, 27 Jan 2021 16:37:03 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 27 Jan 2021 16:37:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=SVxwVEFGR4GN1xietTE/tJcV9hlUgGY96RBOyPYvHa0=; b=XsHCA9+/ pUWCn5K/oYqB9OdydewR5iShva9yqg29Yjo4XtgPYVInZoE+2g4RRLYB4G97g1vm OVYRXC416Qnka38RH7r0uCx+D/Y0oaDEIRo/C/QJqOeoQHORWlspCAfk4WtzhlQi Vo+wEUfCI3egqIcHG+vdKKQM7ort7WStnxIMDtbpEACzdWOvsvIWpVgxRV3OWed4 d8tVtBCbJb6XwKHKNZUmF0O/gm+SWqzacMOsmaw2r/YkIzeiTwkcXeNQDhJLRK4m 2VWckepsUHeCRFX+cfL60Wjp6b39gsJ6bkgT79u6zyoMtyqTpjK3Wi4inU+dg+uW USInwNu8uq4/yQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdekgddugeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjfgesthekredttderudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepueffhfejieeuueffgedvudekgeeltdeviedvieeufeei ieevgfetheeufeethedvnecukfhppeduledtrdelhedrudelrddujeejnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegr lhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.177]) by mail.messagingengine.com (Postfix) with ESMTPA id 778961080059; Wed, 27 Jan 2021 16:37:01 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 962B32A0D40; Wed, 27 Jan 2021 18:36:58 -0300 (-03) Date: Wed, 27 Jan 2021 18:36:58 -0300 From: Alvaro Herrera To: Alexey Kondratov Cc: Michael Paquier , Justin Pryzby , Peter Eisentraut , Masahiko Sawada , Steve Singer , pgsql-hackers@lists.postgresql.org, Robert Haas , Alexander Korotkov , Masahiko Sawada , Jose Luis Tallon Subject: Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly Message-ID: <20210127213658.GA736@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021-Jan-28, Alexey Kondratov wrote: > I have read more about lock levels and ShareLock should prevent any kind of > physical modification of indexes. We already hold ShareLock doing > find_all_inheritors(), which is higher than ShareUpdateExclusiveLock, so > using ShareLock seems to be safe here, but I will look on it closer. You can look at lock.c where LockConflicts[] is; that would tell you that ShareLock indeed conflicts with ShareUpdateExclusiveLock ... but it does not conflict with itself! So it would be possible to have more than one process doing this thing at the same time, which surely makes no sense. I didn't look at the patch closely enough to understand why you're trying to do something like CLUSTER, VACUUM FULL or REINDEX without holding full AccessExclusiveLock on the relation. But do keep in mind that once you hold a lock on a relation, trying to grab a weaker lock afterwards is pretty pointless. -- Álvaro Herrera 39°49'30"S 73°17'W "E pur si muove" (Galileo Galilei)