pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: StandbyAcquireAccessExclusiveLock doesn't necessarily
Date: Fri, 07 Sep 2018 18:37:15 -0400
Message-ID: <6202.1536359835@sss.pgh.pa.us> (raw)

Commit 37c54863c removed the code in StandbyAcquireAccessExclusiveLock
that checked the return value of LockAcquireExtended.  AFAICS this was
flat out wrong, because it's still passing reportMemoryError = false
to LockAcquireExtended, meaning there are still cases where
LOCKACQUIRE_NOT_AVAIL will be returned.  In such a situation, the
startup process would believe it had acquired exclusive lock even
though it hadn't, with potentially dire consequences.

While we could certainly put back a test there, it's not clear to me
that it could do anything more useful than erroring out, at least
not without largely reverting 37c54863c.

So my inclination is to remove the reportMemoryError = false parameter,
and just let an error happen in the unlikely situation that we hit OOM
for the lock table.

That would allow this code to not use LockAcquireExtended at all.
Indeed, I'd be rather tempted to remove that parameter from
LockAcquireExtended altogether, as I don't believe it's either
particularly useful, or at all well tested, or even testable.

			regards, tom lane




view thread (19+ messages)  latest in thread

Message-ID: <6202.1536359835@sss.pgh.pa.us>
Permalink:  ../6202.1536359835@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6202.1536359835@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, jeff.janes@gmail.com, simon@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: StandbyAcquireAccessExclusiveLock doesn't necessarily
  In-Reply-To: <6202.1536359835@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