Latch-ifying the syslogger process
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Date: 2012-05-12T19:36:33Z
Lists: pgsql-hackers
Attachments
- syslogger-latch-1.patch (text/x-patch) patch
I noticed a large oversight in our efforts to reduce the server's idle wakeup frequency: if you've got logging_collector turned on, the syslogger process will wake up once a second, whether it has anything to do or not. But the only reasons it has for waking up are signals, data arrival, and time-based logfile rotation, and it is easy to calculate the time until the next logfile rotation event. So this seems really easy to latch-ify, and I would like to apply the attached patch if there are not objections. I do not however have the ability to test the Windows side of it, so it'd be nice if someone would check that that still works (particularly, that it shuts down cleanly). While testing this I discovered a pre-existing bug in the Unix implementation of WaitLatchOrSocket: EOF on the socket is reported as POLLHUP not POLLIN (at least on my Linux box), which results in WaitLatchOrSocket going into an infinite loop, because poll() returns immediately but the result bitmask never becomes nonzero. So at least the first hunk of this patch had better get applied and back-patched in any case. regards, tom lane