A micro-optimisation for ProcSendSignal()

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-03-11T11:31:44Z
Lists: pgsql-hackers

Attachments

Hi,

ProcSendSignal(pid) searches the ProcArray for the given pid and then
sets that backend's procLatch.  It has only two users: UnpinBuffer()
and ReleasePredicateLocks().  In both cases, we could just as easily
have recorded the pgprocno instead, avoiding the locking and the
searching.  We'd also be able to drop some special book-keeping for
the startup process, whose pid can't be found via the ProcArray.

A related idea, saving space in BufferDesc but having to do slightly
more expensive work, would be for UnpinBuffer() to reuse the new
condition variable instead of ProcSendSignal().

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Change ProcSendSignal() to take pgprocno.