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 1ovhzO-0002rc-Mi for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Nov 2022 16:43:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ovhzN-0004Bd-B7 for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Nov 2022 16:43:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovhzN-00048k-1D for pgsql-hackers@lists.postgresql.org; Thu, 17 Nov 2022 16:43:45 +0000 Received: from 7.mo560.mail-out.ovh.net ([188.165.48.182]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovhzK-0002qb-TM for pgsql-hackers@postgresql.org; Thu, 17 Nov 2022 16:43:44 +0000 Received: from player779.ha.ovh.net (unknown [10.109.146.82]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 84BDB2167B for ; Thu, 17 Nov 2022 16:43:40 +0000 (UTC) Received: from darold.net (amontpellier-652-1-149-133.w81-251.abo.wanadoo.fr [81.251.156.133]) (Authenticated sender: gilles@darold.net) by player779.ha.ovh.net (Postfix) with ESMTPSA id A750930B7F2FB for ; Thu, 17 Nov 2022 16:43:39 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-108S002ac402650-1936-4a8e-a68e-86540d626b0f, 2FB7A4D535DE49E0D1264D6F24D686B1499140AF) smtp.auth=gilles@darold.net X-OVh-ClientIp: 81.251.156.133 Content-Type: multipart/alternative; boundary="------------7BmLFQhaTny0Q0u6DbAmrNy9" Message-ID: <45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net> Date: Thu, 17 Nov 2022 17:43:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: PostgreSQL Hackers From: Gilles Darold Subject: [BUG] pg_dump blocked X-Ovh-Tracer-Id: 7258395225576742496 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvgedrgeekgdeltdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpegtkfffgggfvffhufesrgdtreertdefjeenucfhrhhomhepifhilhhlvghsucffrghrohhlugcuoehgihhllhgvshesuggrrhholhgurdhnvghtqeenucggtffrrghtthgvrhhnpeehhffghfdtfeejkefhueegfffhleevkeefteefgfffteeutdevjeekuddvvdekjeenucfkphepuddvjedrtddrtddruddpkedurddvhedurdduheeirddufeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeoghhilhhlvghssegurghrohhlugdrnhgvtheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdfovfetjfhoshhtpehmohehiedtpdhmohguvgepshhmthhpohhuth List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------7BmLFQhaTny0Q0u6DbAmrNy9 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, I have an incorrect behavior with pg_dump prior PG version 15. With PostgreSQL 15, thanks to commit e3fcbbd623b9ccc16cdbda374654d91a4727d173 the problem is gone but for older versions it persists with locks on partitioned tables. When we try to dump a database where a table is locked, pg_dump wait until the lock is released, this is expected. Now if the table is excluded from the dump using the -T option, obviously pg_dump is not concerned by the lock. Unfortunately this is not the case when the table is partitioned because of the call to pg_get_partkeydef(), pg_get_expr() in the query generated in getTables().  Here is the use case to reproduce. In a psql session execute: BEGIN; LOCK TABLE measurement; then run a pg_dump command excluding the measurement partitions:     pg_dump -d test -T "measurement*" > /dev/null it will not end until the lock on the partition is released. I think the problem is the same if we use a schema exclusion where the partitioned table is locked. Is it possible to consider a backport fix? If yes, does adding the table/schema filters in the query generated in getTables() is enough or do you think about of a kind of backport of commit e3fcbbd623b9ccc16cdbda374654d91a4727d173 ? Best regards, -- Gilles Darold --------------7BmLFQhaTny0Q0u6DbAmrNy9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi,


I have an incorrect behavior with pg_dump prior PG version 15. With PostgreSQL 15, thanks to commit e3fcbbd623b9ccc16cdbda374654d91a4727d173 the problem is gone but for older versions it persists with locks on partitioned tables.


When we try to dump a database where a table is locked, pg_dump wait until the lock is released, this is expected. Now if the table is excluded from the dump using the -T option, obviously pg_dump is not concerned by the lock. Unfortunately this is not the case when the table is partitioned because of the call to pg_get_partkeydef(), pg_get_expr() in the query generated in getTables().  Here is the use case to reproduce.


In a psql session execute:

BEGIN;

LOCK TABLE measurement;

then run a pg_dump command excluding the measurement partitions:

    pg_dump -d test -T "measurement*" > /dev/null

it will not end until the lock on the partition is released.

I think the problem is the same if we use a schema exclusion where the partitioned table is locked.


Is it possible to consider a backport fix? If yes, does adding the table/schema filters in the query generated in getTables() is enough or do you think about of a kind of backport of commit e3fcbbd623b9ccc16cdbda374654d91a4727d173 ?


Best regards,

-- 
Gilles Darold
--------------7BmLFQhaTny0Q0u6DbAmrNy9--