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 1kVfrJ-0004Nr-CU for pgsql-admin@arkaria.postgresql.org; Thu, 22 Oct 2020 19:02: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 1kVfqk-0001KU-VC for pgsql-admin@arkaria.postgresql.org; Thu, 22 Oct 2020 19:02:10 +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 1kVfqk-0001IT-4A for pgsql-admin@lists.postgresql.org; Thu, 22 Oct 2020 19:02:10 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVfqc-0004bv-GW for pgsql-admin@postgresql.org; Thu, 22 Oct 2020 19:02:09 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id CBA635C0047; Thu, 22 Oct 2020 15:01:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 22 Oct 2020 15:01:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=B5LzscYMKHH40NX8k PwcxpW1MSerIhl0yEpvW16wU10=; b=rC3gbfhzvhirQalPlbQLSXb53XyV0oTQF aFWeHlxMeI+hMRITEAiNUwXLKAST+0lBHDnke3xAhXT/twIxWiMGEcqh7PdlnMso /8rRsTRmm6xv7CXJAJBuhSChAbwmzWtynvsKBQ1APSdSERnctIwbAbCAG8RFKmV0 PfR8EAcT8ZQxAfTgsFDFufe/F634YzYKfTTWCQkIdQsDt8Cfiw+YvZPkrSKu40mJ PzampCOV6AzvjqKkxVNS8PifT3LIEjwEETTRo32UoFOKSEfy5Io7BQWVtarAR27j v5i/piJ6Oh1/voBobvhQn1YdAXPbCR6dzDaqoBqJueoo/rq4HsHnQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrjeekgdehudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtuggjfgesmhdtreertdervdenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepieeghfelueduheegtdekjeehueffvddujefgteduieekjefh udefgeefiedvjeetnecukfhppeduledtrdelhedrudelrddugeeknecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.148]) by mail.messagingengine.com (Postfix) with ESMTPA id 14EF93280065; Thu, 22 Oct 2020 15:01:58 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 783B82A0ADF; Thu, 22 Oct 2020 16:01:55 -0300 (-03) Date: Thu, 22 Oct 2020 16:01:55 -0300 From: Alvaro Herrera To: Tom Lane Cc: Wells Oliver , Stephen Frost , pgsql-admin Subject: Re: Odd pg dump error: cache lookup failure Message-ID: <20201022190155.GA29948@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline In-Reply-To: <209234.1603312434@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2020-Oct-21, Tom Lane wrote: > Alvaro Herrera writes: > > Here's a quick patchset that makes pg_dump do LOCK TABLE on all > > relations it dumps; patch 0001 allows server-side LOCK TABLE to run on > > any relkind, and then 0002 makes pg_dump test for that capability at > > connection start, and if it exists, then it's used for all relations to > > dump. > > I think the "test for that capability" bit needs more subtlety. Great ideas, thanks -- all adopted in the attached version. I didn't test this with 9.5 but as you say NOWAIT is already supported there and the command itself does work. Since the wrong-object error was thrown before the lock-unavailable error, and both before the ACL check, it works to test for those codes specifically; it's not a problem if the lock is unavailable or denied. Right now if any other error occurs in the LOCK TABLE, pg_dump aborts with an error. I don't know what that could be. I suppose if it dies with OOM then it doesn't matter whether it's here or elsewhere. Testing for a view as I was doing was not good, because PG12 does allow locks on views. I decided to use pg_aggregate_fnoid_index because it's easier for manual tests: it doesn't prevent connecting to the database when a strong lock is held. This in contrast with other more obvious candidates. It's a pretty arbitrary choice but it shouldn't harm anything since we don't actually hold the lock for more than an instant, and that only if it's not contended. I discovered once again that fallthrough comment handling in combination with ccache are pretty obnoxious. --HlL+5n6rz5pIUxbD Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-accept-any-relkind-in-LOCK-TABLE.patch"