Re: Unportable implementation of background worker start
Andres Freund <andres@anarazel.de>
Tom, On 2017-04-21 13:49:27 -0400, Tom Lane wrote: > >> * If we are in PM_WAIT_DEAD_END state, then we don't want to accept > >> - * any new connections, so we don't call select(), and just sleep. > >> + * any new connections, so we don't call WaitEventSetWait(), and just > >> + * sleep. XXX not ideal > >> */ > > > Couldn't we just deactive the sockets in the set instead? > > Yeah, I think it'd be better to do something like that. The pg_usleep > call has the same issue of possibly not responding to interrupts. The > risks are a lot less, since it's a much shorter wait, but I would rather > eliminate the separate code path in favor of doing it honestly. Didn't > seem like something to fuss over in the first draft though. Ok, cool. > >> + ServerWaitSet = CreateWaitEventSet(PostmasterContext, MAXLISTEN + 1); > > > Why are we using MAXLISTEN, rather than the actual number of things to > > listen to? > > It'd take more code (ie, an additional scan of the array) to predetermine > that. I figured the space-per-item in the WaitEventSet wasn't enough to > worry about ... do you think differently? I'm not sure. We do create an epoll handler with enough space, and that has some overhead. Don't know whether that's worthwhile to care about. > > I kind of would like, in master, take a chance of replace all the work > > done in signal handlers, by just a SetLatch(), and do it outside of > > signal handlers instead. Forking from signal handlers is just plain > > weird. > > Yeah, maybe it's time. But in v11, and not for back-patch. Agreed. - Andres
Commits
-
Cope with glibc too old to have epoll_create1().
- 53b157846024 9.6.3 landed
- 82ebbeb0abfe 10.0 landed
-
Make latch.c more paranoid about child-process cases.
- fa31b6f4e969 10.0 landed
- 866452cd8b52 9.6.3 landed
-
Allow multiple bgworkers to be launched per postmaster iteration.
- aa1351f1eec4 10.0 landed
- e880df25ec35 9.6.3 landed
-
Revert "Use pselect(2) not select(2), if available, to wait in postmaster's loop."
- e615605239f6 9.6.3 landed
- 64925603c972 10.0 landed
-
Use pselect(2) not select(2), if available, to wait in postmaster's loop.
- b9515b628797 9.6.3 landed
- 81069a9efc5a 10.0 landed
-
Run the postmaster's signal handlers without SA_RESTART.
- 8939020853e6 10.0 landed
- dfa4baf91cee 9.6.3 landed
-
Fix postmaster's handling of fork failure for a bgworker process.
- dba1f310a564 9.5.7 landed
- 63f64d2824b2 9.6.3 landed
- 4fe04244b584 10.0 landed
- 436b560b86ca 9.4.12 landed
-
Partially revert commit 536d47bd9d5fce8d91929bee3128fa1d08dbcc57.
- 5041cdf2b792 10.0 landed
-
Avoid depending on non-POSIX behavior of fcntl(2).
- 3e51725b3854 10.0 landed
- f07f6b62c9a7 9.6.3 landed
- ce521e50eb56 9.4.12 landed
- ad8fb69cccf4 9.2.21 landed
- 9f8be7542156 9.5.7 landed
- 899960b9fec2 9.3.17 landed
-
Remove long-obsolete catering for platforms without F_SETFD/FD_CLOEXEC.
- 536d47bd9d5f 10.0 landed