pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: David Gilman <davidgilman1@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: "tuple concurrently updated" in pg_restore --jobs
Date: Fri, 10 Jul 2020 16:54:40 -0400
Message-ID: <2116463.1594414480@sss.pgh.pa.us> (raw)
In-Reply-To: <20200706050129.GW4107@telsasoft.com>
References: <20200706050129.GW4107@telsasoft.com>

Justin Pryzby <pryzby@telsasoft.com> writes:
> I hit this issue intermittently (roughly half the time) while working with a
> patch David submitted, and finally found a recipe to reproduce it on an
> unpatched v12 instance.

> I was surprised to see pg_restore -j2 is restoring ACLs in pre-data in
> parallel.

It's not pre-data.  But it's true that pg_restore figures it can restore
ACLs in parallel during the ACL-restoring pass, on the theory that pg_dump
will not emit two different ACL entries for the same object, so that we
can do all the catalog updates in parallel without conflicts.

This works about 99% of the time, in fact.  It falls down in the --clean
case if we have to revoke existing table permissions, because in that case
the REVOKE at table level is required to clear the table's per-column ACLs
as well, so that that ACL entry involves touching the same catalog rows
that the per-column ACLs want to touch.

I think the right fix is to give the per-column ACL entries dependencies
on the per-table ACL, if there is one.  This will not fix the problem
for the case of restoring from an existing pg_dump archive that lacks
such dependency links --- but given the lack of field complaints, I'm
okay with that.

This looks straightforward, if somewhat tedious because we'll have to
change the API of pg_dump's dumpACL() function, which is called by
a lot of places.  Barring objections, I'll go do that.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2116463.1594414480@sss.pgh.pa.us>
Permalink:  ../2116463.1594414480@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2116463.1594414480@sss.pgh.pa.us

 · 

reply

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, davidgilman1@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: "tuple concurrently updated" in pg_restore --jobs
  In-Reply-To: <2116463.1594414480@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