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 1kB6Hu-0003ZD-ST for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Aug 2020 01:01:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kB6Ht-0000Jb-M4 for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Aug 2020 01:01:09 +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 1kB6Hr-0000JU-TC for pgsql-bugs@lists.postgresql.org; Thu, 27 Aug 2020 01:01:09 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kB6Hm-00072T-MA for pgsql-bugs@lists.postgresql.org; Thu, 27 Aug 2020 01:01:06 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0FF135C01EF; Wed, 26 Aug 2020 21:01:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 26 Aug 2020 21:01:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=GE85kfUzVvPqQyMIQVSsDEZHiyc gj6ZAdhSSipSHWew=; b=KPToGBD+Y2R/R1pTESQVot3kdrRlZoFbeOblP+tyEJU Wj6md7n8DS+m0g1FxKundC/XE01PzGaEfchrfc8o0GH3JfqXKLORQT+uQ9OSmCkN 0cC1ryZ4nFkS9aNoxwHJg1bSvVZ83ONI2Qg0/BRRsibN6lPUiaYWHctTVVwiLVAY mB5UMlv5pNlhmr7JDnGqdE0rb2O2PAdVFqL9dvfJQzJqmBsnfIk9bQF6IfZTXpqT uAM7ExV8dtfNBaAwPVSRyff6WDLpR7tzjKIkshHQBcno/xjmk8n7JJAeoknoI8PX hCVDm5LO1vvlib4rUaLAzlBVoFRr26jtkIhiRU5zJVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=GE85kf UzVvPqQyMIQVSsDEZHiycgj6ZAdhSSipSHWew=; b=XCIiHAjBmVfqit62GfNRUa lobSqHvsGdUgsqVWxjwz+lWEtFEPOwRt79VD9axTCvyggvchfrh5NAjVovO+YROi EDu/jceXS9L/wg19ZHVRU5DmC5aOYD0Uo04g6dWj3yUUeiDeSmKtSCLh/NIXQ1V4 +a7Rjl9teycU2wjPnoEn4soxHP9pU4fNv9J1zmTSrjWjzlIOa/qh4nsDehUQCV+y smO1jcHGOaAOsATtdJmO3Qh5t5xgSsD6pywDj5paNMdD3zxLxmqxFQySSevirlYn Xxs1YKTYUNndwLBq1Qxom+BjMB46JR1thodZlI/cZmoywhWC2vXDwXMx7WOuOmqg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddvfedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpedvgeduuefhtdeuleettdevjeehheeiveeuieegleetgeeljeelieeuieehgeevhfen ucfkphepudduuddruddtvddrudektddrudekheenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 0ED8E30600B7; Wed, 26 Aug 2020 21:00:57 -0400 (EDT) Date: Thu, 27 Aug 2020 10:00:54 +0900 From: Michael Paquier To: jan.mussler@zalando.de, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16594: DROP INDEX CONCURRENTLY fails on partitioned table with a non helpful error message. Message-ID: <20200827010054.GK2017@paquier.xyz> References: <16594-d2956ca909585067@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MSd2ShuMixI0uVaZ" Content-Disposition: inline In-Reply-To: <16594-d2956ca909585067@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --MSd2ShuMixI0uVaZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Aug 26, 2020 at 08:11:16PM +0000, PG Bug reporting form wrote: > After more digging the user elaborated that this is in fact a partitioned > table. This error happens in index_drop() as of index.c, where we need to assume that the index drop is the first action happening in a transaction. Now comes the tricky problem: when you drop the index of a partitioned table, the dependency machinery needs to find the set of dependent objects, and this assigns a transaction ID for the list of partitions. Still, it seems to me that we are far from being able to support fully this operation on partitioned indexes, and we need to do more than what we have now if we want this feature. So I think that the concurrent drop of partitioned indexes should respect the following flow: 1) Drop all the dependencies for the partition tree in a single, first, transaction. 2) Drop each index after that, in its own two sets of transactions for each entry, one to clear indisvalid and a second one to do the actual drop. The whole operation should make sure that we still have a fully consistent state in the catalogs for any transaction, so as we have no risk of finishing with a semi-broken partition tree if the thing fails while processing for a reason or another. As long as 1) is not implemented, I don't think that this can really be safe, still this requires careful thinking in the way we gather the list of indexes to drop beforehand. The error message is really confusing though, so for now I would recommend to just drop an error if trying the operation on a partitioned table, and we also do that now for CREATE INDEX CONCURRENTLY. -- Michael --MSd2ShuMixI0uVaZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl9HBcYACgkQnvQgOdby QH0GTA/9FmhoGV8OaZiAqZhxpuy44WYI1h/LTw3XrucSOY5UnKX1Y/QwBUTu0z73 k8u8n9AEXes9Zhzz2Mqh5JytDHQ4lrWdiQppGR8H4vERwr49WKPXgz7l8NLWHys1 CwX5Apem+zZ7oK+MPY7a7bGFIIuBoA2ryIGZHv3kJp81jIrL2s3pg21TzIeiRzn+ aZBkR7NJ92AxmbG6KNoLB9nfLW4LWx0FS/0LK5NfSkhN5taQdwin1jFv11N+NOka zGdnPdr0w6xy7JLyIhH1Mr+2JfCActzwwNDXI6B2mErcyHrO0fpN0vxOLCajzxMj d3jZ9RTq3guQBu9kI1i6xYzFQjyEV2bKAvMsRmRxxG0rGqVdiY5ZrbXch6zXE4ly /kfZGPpwcD6J5Leu2c01nA7j7gWjK2hYl56hNZJm73raoES2y6Cnm35X/fQKOWvS Y70HzWCVIefiipmBz1kPCzeDolm5inHmBMI9FGzKvq/wKVd0yq5Dm9MWs3RoqB1w aFYhu8Hg+ogM6iPNyIOEEe07vIr8DKVFVw0JAiagT3WunruFKYGWPDJWboP+plo6 85IYqljRIWGV4qMZ5Ridon0O1+6cIDunlRnTr7LrR8xrzK0YAH/5zQven0eUf9EY xLnmxdPieHFyMtjd6ZF+yyXI0l9uCAHRPKTlIWwj8HINVQvRKhM= =4apG -----END PGP SIGNATURE----- --MSd2ShuMixI0uVaZ--