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 1lOiuS-0003fV-Mb for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 15:25:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOiuR-0007lL-Kv for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Mar 2021 15:25:31 +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 1lOiuQ-0007lE-Qa for pgsql-hackers@lists.postgresql.org; Tue, 23 Mar 2021 15:25:31 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOiuO-0003ol-TW for pgsql-hackers@lists.postgresql.org; Tue, 23 Mar 2021 15:25:29 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CE53911CB; Tue, 23 Mar 2021 11:25:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 23 Mar 2021 11:25:27 -0400 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= fm2; bh=pPCzlMwFpEVuhY85seqV9VXYpYyczxYETmzxUQCCudM=; b=uIvWopZS UKW3uG4AG/wNGZoquu/1J+fWVWt53HPkkaTnWhH/1iDqldybWcr/9qLGGC8qG+4C 9iRPVuQ0ED1CZwe+i2MOtbH7YYCxlIUFkeBjSfR+M64JGZYMA/Lbq7YhFEFdPhOe IqUKqGn6UGPLAYMULB9ww8ZAEj63yKyRphSuqoMsH/UCX3KPnYUcVZxzPgP4x69g 6sWlngn5Lsu6pcec4SI6AXavb9KWqm8CV4QN/in1sM+oUrtcglL6mwOqfuo2lCY2 vEGjUAnRyVMnJEUz4S+LSszeSR3LUlZw33oNTReVbzCXGA9o02Mx7aqeHadegjnz rlzNNlSGhf0laA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegiedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjfgesthekredttderudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepueffhfejieeuueffgedvudekgeeltdeviedvieeufeei ieevgfetheeufeethedvnecukfhppeduledtrdelhedrudelrdelheenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C1E91080057; Tue, 23 Mar 2021 11:25:25 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 85A1C2A0FC3; Tue, 23 Mar 2021 12:25:23 -0300 (-03) Date: Tue, 23 Mar 2021 12:25:23 -0300 From: Alvaro Herrera To: Justin Pryzby Cc: Amit Langote , pgsql-hackers@lists.postgresql.org Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY Message-ID: <20210323152523.GA9721@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210323145554.GA7700@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I'm coming around to the idea that the fact that you can cancel the wait phase of DETACH CONCURRENTLY creates quite a disaster, and it's not easy to get away from it. The idea that REPEATABLE READ mode means that you now see detached partitions as if they were in normal condition, is completely at odds with that behavior. I think a possible solution to this problem is that the "detach" flag in pg_inherits is not a boolean anymore, but an Xid (or maybe two Xids). Not sure exactly which Xid(s) yet, and I'm not sure what are the exact rules, but the Xid becomes a marker that indicates an horizon past which the partition is no longer visible. Then, REPEATABLE READ can see the partition, but only if its snapshot is older than the Xid. -- Álvaro Herrera Valdivia, Chile "La persona que no quería pecar / estaba obligada a sentarse en duras y empinadas sillas / desprovistas, por cierto de blandos atenuantes" (Patricio Vogel)