On Tue, 28 Jun 2016 11:06:24 +0200
Gilles Darold <gilles.dar...@dalibo.com> wrote:
> Le 07/04/2016 08:30, Karl O. Pinc a écrit :
> > "src/backend/postmaster/syslogger.c expects to see fopen() fail
> > with
> ENFILE and EMFILE. What will you do if you get these?"
> - Nothing, if the problem occurs during the log rotate call, then
> log rotation file is disabled so logfile_writename() will not be
> called. Case where the problem occurs between the rotation call and
> the logfile_writename() call is possible but I don't think that it
> will be useful to try again. In this last case log filename will be
> updated during next rotation.
The case I'm interested in is when the rotation call succeeds but
you get ENFILE or EMFILE in logfile_writename() and current_logfiles
is not updated.
This looks like an ugly problem that only happens
sporadically under load. If I've set log
rotation to, say, 1 week, and I'm post-processing my logs based
on the current_logfiles content, and the logs rotate but
current_logfiles is not updated, then I lose a week of log
I'm experimenting with some code that retries writing current_logfiles,
if it failed due to ENFILE or EMFILE, the next time a log message
is written. If that's too often it'd be easy enough to add
a backoff counter that retries progressively less frequently
based on a "clock tick" per log message write.
However, per my last email, it'll be Tuesday before I really get
back to this. Let me know if, instead, you want to jump in
and write the code, have a better idea, think this is a really
stupid approach, or have other reasons why I should abandon
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Sent via pgsql-hackers mailing list (firstname.lastname@example.org)
To make changes to your subscription: