Re: log_truncate_on_rotation=on is not truncating

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: log_truncate_on_rotation=on is not truncating
Дата
Msg-id 767.1342414417@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: log_truncate_on_rotation=on is not truncating  (Viswanatham Kiran Kumar <viswanatham.kirankumar@huawei.com>)
Ответы Re: log_truncate_on_rotation=on is not truncating  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
[ just got around to looking at this bug report, sorry for the delay ]

Viswanatham Kiran Kumar <viswanatham.kirankumar@huawei.com> writes:
> Hi Chan,
>     I think this is configuration issue.

>     This issue is happening because log files will always append when
> server is restarted. What I can see from your configuration,
> log_rotation_age=1d (1 day) which is greater than daily schedule
> shutdown/restart time. So this is the reason why log files are growing.

Yeah, I think that's part of it, but it does still seem like a bug.
The relevant bit of the code is

    /*
     * The requirements here are to choose the next time > now that is a
     * "multiple" of the log rotation interval.  "Multiple" can be interpreted
     * fairly loosely.  In this version we align to log_timezone rather than
     * GMT.
     */
    rotinterval = Log_RotationAge * SECS_PER_MINUTE;    /* convert to seconds */
    now = (pg_time_t) time(NULL);
    tm = pg_localtime(&now, log_timezone);
    now += tm->tm_gmtoff;
    now -= now % rotinterval;
    now += rotinterval;
    now -= tm->tm_gmtoff;
    next_rotation_time = now;

Looking at this, it seems like it will choose a next_rotation_time that
is more than rotinterval beyond "now" if you have a log_timezone for
which advancing by gmtoff moves past the next natural rotinterval
multiple.  So if the server gets shut down before that time elapses,
it never will think it should rotate the logfile.

Chan, could you say exactly what log_timezone setting is in use on the
servers that are acting funny?

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #6733: All Tables Empty After pg_upgrade (PG 9.2.0 beta 2)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: log_truncate_on_rotation=on is not truncating