]> granicus.if.org Git - postgresql/commit
Fix syslogger so that log_truncate_on_rotation works in the first rotation.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jul 2012 18:36:58 +0000 (14:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Jul 2012 18:36:58 +0000 (14:36 -0400)
commit63aba79c7f1f06422b22e2b44fdcb563bbc3f7a5
tree9f112aa45922c39e4fafc165453b299cb34867f6
parent65f33352494cccf70ab512c5c6d1637b31a13364
Fix syslogger so that log_truncate_on_rotation works in the first rotation.

In the original coding of the log rotation stuff, we did not bother to make
the truncation logic work for the very first rotation after postmaster
start (or after a syslogger crash and restart).  It just always appended
in that case.  It did not seem terribly important at the time, but we've
recently had two separate complaints from people who expected it to work
unsurprisingly.  (Both users tend to restart the postmaster about as often
as a log rotation is configured to happen, which is maybe not typical use,
but still...)  Since the initial log file is opened in the postmaster,
fixing this requires passing down some more state to the syslogger child
process.

It's always been like this, so back-patch to all supported branches.
src/backend/postmaster/postmaster.c
src/backend/postmaster/syslogger.c