Latch-ifying the syslogger process

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Latch-ifying the syslogger process
Date: 2012-05-12 19:36:33
Message-ID: 11274.1336851393@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
syslogger-latch-1.patch text/x-patch 8.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2012-05-12 20:00:33 Re: Latch-ifying the syslogger process
Previous Message Simon Riggs 2012-05-12 17:30:40 Re: Re: [COMMITTERS] pgsql: Ensure age() returns a stable value rather than the latest value