On Tue, Dec 14, 2021 at 11:18 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Tue, Dec 14, 2021 at 7:53 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > On 2021-12-13 17:51:00 +1300, Thomas Munro wrote:
> > > I tried that. It seems OK, and gets rid of the PG_FINALLY(), which is
> > > nice. Latches still have higher priority, and still have the fast
> > > return if already set and you asked for only one event, but now if you
> > > ask for nevents > 1 we'll make the syscall too so we'll see the
> > > WL_SOCKET_CLOSED.
> >
> > Isn't a certain postgres committer that cares a lot about unnecessary syscalls
> > going to be upset about this one? Even with the nevents > 1 optimization? Yes,
> > right now there's no other paths that do so, but I don't like the corner this
> > paints us in.
>
> Well, I was trying to avoid bikeshedding an API change just for a
> hypothetical problem we could solve when the time comes (say, after
> fixing the more egregious problems with Append's WES usage), but here
> goes: we could do something like AddWaitEventToSet(FeBeWaitSet,
> WL_LATCH_SET_LOPRIO, ...) that is translated to WL_LATCH_SET
> internally but also sets a flag to enable this
> no-really-please-poll-all-the-things-if-there-is-space behaviour.
Here's one like that.