From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Wells Oliver <wells.oliver@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Odd pg dump error: cache lookup failure
Date: Wed, 21 Oct 2020 16:33:54 -0400
Message-ID: <209234.1603312434@sss.pgh.pa.us> (raw)
In-Reply-To: <20201021200659.GA32358@alvherre.pgsql>
References: <20201021200659.GA32358@alvherre.pgsql>
Alvaro Herrera <alvherre@alvh.no-ip.org> 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.
In the first place, demanding exclusive lock on a system view has a
pretty high probability of failing due to someone else accessing the
view at that moment, and/or causing failures in other transations.
Since you only need to find out if the command can work at all, you
could make this a lot less fragile and unfriendly by just asking for
ACCESS SHARE lock.
Even with the lower lock level, you might get back a transient
can't-lock-it failure rather than the condition you are looking for.
So I think there needs to be a check on the errcode here.
Should there be a timeout on the LOCK? Or even better, use NOWAIT
where available (which actually appears to be all versions of
interest).
I'd also advise skipping the whole thing if server version >= 14.
I see you have a lower-bound check which is good, but not nearly
as useful over time as the other will be.
(Also, personally I'd put the version check in IsLockTableGeneric,
not its caller.)
Why is it OK to drop the check for RELKIND_PARTITIONED_TABLE
when !hasGenericLockTable? Surely that does the wrong thing
on released minor versions?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, wells.oliver@gmail.com, sfrost@snowman.net
Subject: Re: Odd pg dump error: cache lookup failure
In-Reply-To: <209234.1603312434@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox