Persistent wait event sets and socket changes

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>
Subject: Persistent wait event sets and socket changes
Date: 2017-07-31 06:08:58
Message-ID: CAMsr+YG8zjxu6WfAAA-i33PQ17jvgSO7_CfSh9cncg_kRQ2NDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all

I've been looking into the wait event set interface added in 9.6 with an
eye to using it in an extension that maintains a set of non-blocking libpq
connections to other PostgreSQL instances.

In the process I've been surprised to find that there does not appear to be
any interface to remove a socket once added to the wait event set, or
replace it with a new socket.

ModifyWaitEvent(...) doesn't take a pgsocket. There doesn't seem to be a
way to remove an event from the set either.

Discussion in
https://www.postgresql.org/message-id/flat/20160114143931.GG10941%40awork2.anarazel.de
talks about a proposed SetSocketToWaitOn(...)/AddSocketToWaitSet and
RemoveSocketFromWaitSet etc. But it looks like it petered out and went
nowhere, apparently mainly due to not being needed by any current core
users.

See:

*
https://www.postgresql.org/message-id/CA%2BTgmoZ_2EgBCXinHsJn%3Dv8bfg3Y3uXpG1xHiQ8g7yRJzwt3Yg%40mail.gmail.com

*
https://www.postgresql.org/message-id/CAEepm%3D14htYKhJ67OEvX%3DXmtiB5677K6ehQACH1ySkebeYh8Nw%40mail.gmail.com

I'd like to add such interfaces at some point, but for now can work around
it by destroying and re-creating the wait event set when the fd-set
changes. So I'm posting mostly to confirm that it's not supposed to work,
and ask if anyone thinks I should submit a comment patch to latch.c
documenting it.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2017-07-31 06:11:58 Re: pl/perl extension fails on Windows
Previous Message Thomas Munro 2017-07-31 05:49:34 Re: Causal reads take II