Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U7kuL-0005ZI-BO for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Feb 2013 10:58:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U7kuK-0003Zh-1k for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Feb 2013 10:58:44 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U7kuJ-0003Zb-3q for pgsql-bugs@postgresql.org; Tue, 19 Feb 2013 10:58:43 +0000 Received: from mail-out4.uio.no ([2001:700:100:10::15]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U7kuH-0007YA-Be for pgsql-bugs@postgresql.org; Tue, 19 Feb 2013 10:58:42 +0000 Received: from mail-mx4.uio.no ([129.240.10.45]) by mail-out4.uio.no with esmtp (Exim 4.80.1) (envelope-from ) id 1U7kuG-0004ns-7I for pgsql-bugs@postgresql.org; Tue, 19 Feb 2013 11:58:40 +0100 Received: from bbking.uio.no ([129.240.6.205]) by mail-mx4.uio.no with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) user rafael (Exim 4.80) (envelope-from ) id 1U7kuF-0007wM-PC for pgsql-bugs@postgresql.org; Tue, 19 Feb 2013 11:58:40 +0100 Message-ID: <51235ADF.3090109@usit.uio.no> Date: Tue, 19 Feb 2013 11:58:39 +0100 From: Rafael Martinez Organization: University of Oslo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130108 Thunderbird/10.0.12 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #7890: wrong behaviour using pg_rotate_logfile() with parameter log_truncate_on_rotation = on References: <22797.1361267670@sss.pgh.pa.us> <512350D9.5010609@usit.uio.no> <23409.1361269278@sss.pgh.pa.us> In-Reply-To: <23409.1361269278@sss.pgh.pa.us> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-UiO-Ratelimit-Test: rcpts/h 4 msgs/h 2 sum rcpts/h 4 sum msgs/h 2 total rcpts 666 max rcpts/h 23 ratelimit 0 X-UiO-Spam-info: not spam, SpamAssassin (score=-8.6, required=5.0, autolearn=disabled, RP_MATCHES_RCVD=-0.55, UIO_MAIL_IS_INTERNAL=-5, UIO_PGP_SIGNED=-3, uiobl=NO, uiouri=NO) X-UiO-Scanned: 36C6C08E6725682C1727E539AFD0F5FAFA13336E X-UiO-SPAM-Test: remote_host: 129.240.6.205 spam_score: -85 maxlevel 80 minaction 2 bait 0 mail/h: 2 total 710 max/h 23 blacklist 0 greylist 0 ratelimit 0 X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/19/2013 11:21 AM, Tom Lane wrote: > Rafael Martinez 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