Fixing syslogger rotation logic for first-time case

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Fixing syslogger rotation logic for first-time case
Date: 2012-07-31 16:23:40
Message-ID: 11933.1343751820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We've had a couple of complaints recently from people who were unhappy
because the syslogger's log_truncate_on_rotation logic does not fire
during the first log rotation after it's forked off from the postmaster.
The key reason for that was that to know whether to truncate or not,
the code has to know if the rotation actually changed to a new file
name, and it did not have that information inherited from the
postmaster. The attached patch deals with that problem by passing down
the pg_time_t that the log file name is computed from, and then
reconstructing the file name. This is kind of the hard way in Unix-oid
platforms: we could just let the malloc'd file name hang around through
the fork. But on Windows it would be necessary to include the file name
in the BackendParameters struct that's built on every child process
launch, and that seemed pretty costly, considering the overwhelming
majority of postmaster children don't need it. So I did it like this.

Any objections?

regards, tom lane

Attachment Content-Type Size
truncate-first-time.patch text/x-patch 7.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-07-31 16:50:00 Re: several problems in pg_receivexlog
Previous Message Alvaro Herrera 2012-07-31 15:09:02 Re: several problems in pg_receivexlog