Re: Idea for fixing parallel pg_dump's lock acquisition problem - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Idea for fixing parallel pg_dump's lock acquisition problem
Date
Msg-id 16681.1555694236@sss.pgh.pa.us
Whole thread Raw
In response to Re: Idea for fixing parallel pg_dump's lock acquisition problem  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Idea for fixing parallel pg_dump's lock acquisition problem
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Apr 17, 2019 at 11:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ... If there are user applications
>> running that also use advisory locks, there could be unwanted
>> interference.  One easy improvement is to use pg_try_advisory_lock(k) in
>> step 2, and just choose a different k if the lock's in use.  Perhaps,
>> since we don't expect that the locks would be held long, that's
>> sufficient --- but I suspect that users might wish for some pg_dump
>> options to restrict the set of keys it could use.

> This seems like a pretty significant wart.  I think we probably need a
> better solution, but I'm not sure what it is.  I guess we could define
> a new lock space that is specifically intended for this kind of
> inter-process coordination, where it's expected that the key is a PID.

My thought was that we'd like this to work without requiring any new
server-side facilities, so that pg_dump could use it against any server
version that supports parallel dump.  If we're willing to restrict
the fix to server >= v13, or whenever this gets done, then yes we could
(probably) arrange things to avoid the hazard.  I'm not quite sure how
it'd work though.  We can't just invent a process-local key space,
because both the master and worker need to be able to lock the same
key.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Idea for fixing parallel pg_dump's lock acquisition problem
Next
From: Andres Freund
Date:
Subject: Re: ExecForceStoreMinimalTuple leaks memory like there's no tomorrow