From: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: serverlog rotation/functions |
Date: | 2004-07-13 22:01:04 |
Message-ID: | 40F45BA0.8090208@pse-consulting.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Bruce Momjian wrote:
> How is this patch supposed to work? Do people need to modify
> postgresql.conf and then sighup the postmaster? It seems more logical
> for the super-user to call a server-side function.
I assume calling pg_logfile_rotate() to be the standard way. calling
pg_logfile_rotate will increment the internal logfile timestamp, so each
backend's next write to the logfile will lead to a reopen. On the other
hand, if nothing is to be logged, nothing happens in the backends.
> You have
> pg_logfile_rotate(), but that doesn't send a sighup to the postmaster so
> all the backends will reread the global log file name.
As long as there's no SIGHUP, the logfile name template will not change,
so each backend can calculate the logfile's name from the timestamp. In
case a SIGHUP *is* issued, the template might have changed, so despite
an unchanged timestamp the filename to create might be different.
Additionally, SIGHUP will force all backends to check for current
logfile name, and close/reopen if their internal timestamp isn't
up-to-date with the common timestamp.
>
> Also, what mechanism is there to prevent backends from reading the log
> filename _while_ it is being modified?
I don't understand your concern. There's no place where the name is
stored, only the GUC log_filename which is actually the template, and
the timestamp (probably accessed atomically by the processor).
>
> Also there are no documenttion changes.
Hm, seems I missed this in this posting; the previous had it. I'll
repost it.
>
> However, looking at the issue of backends all reloading their
> postgresql.conf files at different times and sending output to different
> files,
We might have a fraction of a second in practice, when a SIGHUP was
issued to reread postgresql.conf, with a log_filename change, and a
backend still writing its log to the "old" log because GUC reread is
deferred for queries that started before SIGHUP. I don't really see a
problem with that.
I wonder if it would be best to create a log process and have
> each backend connect to that. That way, all the logging happens in one
> process.
<sigh> All I wanted was displaying the serverlog </sigh>
While this might be ultimately the best solution (we even might find a
way to catch stderr without interrupting further stderr piping),
currently this doesn't seem to be the right moment. We'd have several
inter process issues (and more with win32), which probably need some
discussion.
OTOH, if the current implementation is replaced by a log process later,
the api interface probably would stay the same.
Regards,
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2004-07-13 22:03:04 | Re: Release planning (was: Re: Status report) |
Previous Message | Bruce Momjian | 2004-07-13 21:56:13 | Re: Release planning (was: Re: Status report) |
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Pflug | 2004-07-13 22:03:49 | Re: serverlog rotation/functions |
Previous Message | Bruce Momjian | 2004-07-13 21:44:19 | Re: [HACKERS] Is "trust" really a good default? |