From: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
---|---|
To: | Gilles Darold <gilles(dot)darold(at)dalibo(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Christoph Berg <myon(at)debian(dot)org> |
Subject: | Re: Patch to implement pg_current_logfile() function |
Date: | 2016-10-30 07:20:47 |
Message-ID: | 20161030022047.5c336d72@slate.meme.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 28 Jun 2016 11:06:24 +0200
Gilles Darold <gilles(dot)darold(at)dalibo(dot)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
post-processing.
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
this plan.
Regards,
Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2016-10-30 07:36:55 | sequential scan result order vs performance |
Previous Message | Karl O. Pinc | 2016-10-30 07:04:59 | Re: Patch to implement pg_current_logfile() function |