Re: pgsql: Add kqueue(2) support to the WaitEventSet API.

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Rémi Zara <remi_zara@mac.com>, Michael Paquier <michael@paquier.xyz>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-02-24T06:42:52Z
Lists: pgsql-hackers
On Mon, Feb 24, 2020 at 12:24 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> On reflection, trying to make ReserveExternalFD serve two different
> use-cases was pretty messy.  Here's a version that splits it into two
> functions.  I also took the trouble to fix dblink.

+    /*
+     * We don't want more than max_safe_fds / 3 FDs to be consumed for
+     * "external" FDs.
+     */
+    if (numExternalFDs < max_safe_fds / 3)

This looks pretty reasonable to me.

I'll have a new patch set to create a common WES at startup over on
that other thread in a day or two.



Commits

  1. Don't use EV_CLEAR for kqueue events.

  2. Fix kqueue support under debugger on macOS.

  3. Account explicitly for long-lived FDs that are allocated outside fd.c.

  4. Add kqueue(2) support to the WaitEventSet API.

  5. Introduce WaitEventSet API.