Persistent wait event sets and socket changes

Started by Craig Ringerover 8 years ago2 messages
#1Craig Ringer
craig@2ndquadrant.com

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
/messages/by-id/20160114143931.GG10941@awork2.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:

*
/messages/by-id/CA+TgmoZ_2EgBCXinHsJn=v8bfg3Y3uXpG1xHiQ8g7yRJzwt3Yg@mail.gmail.com

*
/messages/by-id/CAEepm=14htYKhJ67OEvX=XmtiB5677K6ehQACH1ySkebeYh8Nw@mail.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

#2Andres Freund
andres@anarazel.de
In reply to: Craig Ringer (#1)
Re: Persistent wait event sets and socket changes

Hi Craig,

On 2017-07-31 14:08:58 +0800, Craig Ringer wrote:

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.

Yea, and what's even more annoying, you can't "disable" waiting for
readyness events on a socket, we've an assert that we're waiting for
something.

Discussion in
/messages/by-id/20160114143931.GG10941@awork2.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.

I think it just needs somebody to push this forward.

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.

It doesn't work, right. I'm not sure I see the point of adding comments
explaining that a nonexistant interface doesn't exist?

Greetings,

Andres Freund

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers