pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Tsunezumi <tsunezumi@efficlabo.com>
Cc: Kevin Grittner <kgrittn@mail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #7814: Rotation of the log is not carried out.
Date: Tue, 22 Jan 2013 18:32:43 -0500
Message-ID: <29401.1358897563@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMkU=1zJN6-PrqSjmEbzL+S+zFWJg-iE-ZBnKDuND++r+ymnXA@mail.gmail.com>
References: <20130118202656.F1C6.65ED1D25@efficlabo.com>
	<CAMkU=1wxFnXARQg+CBpPm9JWRiWKcYS7aTBU2MGux90BGWzGzg@mail.gmail.com>
	<20130122214232.B4DA.65ED1D25@efficlabo.com>
	<CAMkU=1zJN6-PrqSjmEbzL+S+zFWJg-iE-ZBnKDuND++r+ymnXA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Jeff Janes <jeff.janes@gmail.com> writes:
> For what it is worth, I can reproduce this on Windows 7, using the
> 9.2.2 and 9.1.7 windows 64 installers from EDB (i.e.
> http://www.enterprisedb.com/postgresql-922-installers-win64?ls=Crossover&type=Crossover),
> with completely default installation (EDB changes the default to be
> logging_collector=on), and using the below to blow up the log files
> with error messages:

> perl -le 'print "FOO$_;" foreach 1..1e7' | psql

> 9.1.7 rotates the log files in $DATA/pg_log, while 9.2.2 does not
> rotate based on size.

[ scratches head for awhile... ]  Hm, what you are testing is the
default rotation parameters, right?  log_rotation_age = 1 day,
log_rotation_size = 10MB?  So you didn't wait to see what would happen
at a rotation-age boundary.  If so, does "pg_ctl reload" kick it into
rotating once the file is too big?  (Or you could reduce
log_rotation_age to a small value, but that would make it hard to
tell which condition triggered rotation.)

Here's what I think is probably happening: on Windows, the syslogger
process actually contains two threads, one of which handles data
transfer while the other worries about things like log rotation.
In prior versions, the control thread woke up once a second, so it
would notice within one second if the data transfer thread had filled
the current file to more than log_rotation_size.  In 9.2, we got rid
of those "unnecessary" wakeups, which means log rotation won't occur
until there's some other event that kicks the control thread into
activity.

There's no bug on non-Windows because we don't use two threads on other
platforms; data transfer is done by the main thread so it's already
awake upon any write to the log file, and it won't miss the rotation
condition.  (Size-based rotations were therefore always more precise on
non-Windows machines...)

So what we need on Windows is for the data transfer thread to notice
when "Log_RotationSize > 0 && ftell(syslogFile) >= Log_RotationSize",
and then either signal the control thread to wake up, or do the
rotation itself.  Probably the former is less risk.

I'm not coding this fix though, since I'm not in a position to test it.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (12+ messages)  latest in thread

Message-ID: <29401.1358897563@sss.pgh.pa.us>
Permalink:  ../29401.1358897563@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29401.1358897563@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeff.janes@gmail.com, tsunezumi@efficlabo.com, kgrittn@mail.com
  Subject: Re: BUG #7814: Rotation of the log is not carried out.
  In-Reply-To: <29401.1358897563@sss.pgh.pa.us>
  References: <20130118202656.F1C6.65ED1D25@efficlabo.com> <CAMkU=1wxFnXARQg+CBpPm9JWRiWKcYS7aTBU2MGux90BGWzGzg@mail.gmail.com> <20130122214232.B4DA.65ED1D25@efficlabo.com> <CAMkU=1zJN6-PrqSjmEbzL+S+zFWJg-iE-ZBnKDuND++r+ymnXA@mail.gmail.com> <29401.1358897563@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox