From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Wells Oliver <wells(dot)oliver(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Odd pg dump error: cache lookup failure |
Date: | 2020-10-22 19:01:55 |
Message-ID: | 20201022190155.GA29948@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 2020-Oct-21, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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.
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.
Attachment | Content-Type | Size |
---|---|---|
v2-0001-accept-any-relkind-in-LOCK-TABLE.patch | text/x-diff | 1.0 KB |
v2-0002-pg_dump-lock-all-rels-not-just-RELKIND_RELATION.patch | text/x-diff | 4.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-10-22 20:04:24 | Re: Odd pg dump error: cache lookup failure |
Previous Message | Lars Aksel Opsahl | 2020-10-22 13:18:13 | Re: free(): invalid pointer , when to dumping data to a new server |