pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rafael Martinez <r.m.guerrero@usit.uio.no>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #7890: wrong behaviour using pg_rotate_logfile() with parameter log_truncate_on_rotation = on
Date: Tue, 19 Feb 2013 11:58:39 +0100
Message-ID: <51235ADF.3090109@usit.uio.no> (raw)
In-Reply-To: <23409.1361269278@sss.pgh.pa.us>
References: <E1U7PZN-0000zg-NC@wrigleys.postgresql.org>
	<22797.1361267670@sss.pgh.pa.us>
	<512350D9.5010609@usit.uio.no>
	<23409.1361269278@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/19/2013 11:21 AM, Tom Lane wrote:
> Rafael Martinez <r.m.guerrero@usit.uio.no> writes:
>> If the behavior we are talking about is intentional, why do be
>> have pg_rotate_logfile() if we can not manually override with
>> this function log_rotation_age and log_rotation_size?
> 
> It works fine as long as the filename pattern is such that a new
> file would be selected.
> 
> If we didn't have this filter, then a rotation operation would wipe
> out *current* log entries, even those that were made a millisecond
> ago. That can't possibly be a good idea.  Any rotation scheme ought
> to provide for recent entries to survive at least until you've
> rotated through whichever other log files you have.
> 
> regards, tom lane

Well, postgreSQL is versatile enough to allow you to decide many
aspects of log rotation. It should be the user who decide what will
happen with log data after and during a rotation.

I agree that using a filename pattern such that a new file would be
selected is a god idea, but it is not the only way of doing this and
it should not be the only way.

What if the user wants to use the same log file name all the time, not
archive old data and not to have a log file that grows indefinitely?
This should be a valid option because it is a valid and used scenario
when administrating databases.

What if we want/need to truncate the log file before postgres has to
change the file name according to the log_filename definition?

If the alternative to not lose some log entries while we are rotating
the log file, it is to stop postgres, truncate the log file manually
and start postgres again, I prefer to lose some log entries.

This should not be a problem as long as this is documented and the
user decides to do it this way. And you still have the option of not
losing any entries and archive the old file if you want. But one thing
should not prevent the other.

regards,
- -- 
 Rafael Martinez Guerrero
 Center for Information Technology
 University of Oslo, Norway

 PGP Public Key: http://folk.uio.no/rafael/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAlEjWt4ACgkQBhuKQurGihTIpQCeJcOmKfnFDMqYllW2YUsywKVl
BxgAoIF+R14GNlvNLNSgxR0lUDDQN23M
=zrAw
-----END PGP SIGNATURE-----


-- 
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 (11+ messages)  latest in thread

Message-ID: <51235ADF.3090109@usit.uio.no>
Permalink:  ../51235ADF.3090109@usit.uio.no/
Also on:    postgresql.org/message-id/51235ADF.3090109@usit.uio.no

 · 

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: r.m.guerrero@usit.uio.no
  Subject: Re: BUG #7890: wrong behaviour using pg_rotate_logfile() with parameter log_truncate_on_rotation = on
  In-Reply-To: <51235ADF.3090109@usit.uio.no>
  References: <E1U7PZN-0000zg-NC@wrigleys.postgresql.org> <22797.1361267670@sss.pgh.pa.us> <512350D9.5010609@usit.uio.no> <23409.1361269278@sss.pgh.pa.us> <51235ADF.3090109@usit.uio.no>

* 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