Re: get current log file

From: Armor <yupengstone(at)qq(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: get current log file
Date: 2016-02-02 13:22:40
Message-ID: tencent_6C2D08E454BD0B05260DD312@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As we known, the name of current log file depends on the number of seconds (for simple, later I will call it last_syslogger_file_time) since Epoch when create new log file. So, for this feature, the key is how syslogger process pass last_syslogger_file_time to backend processes.

To pass last_syslogger_file_time, we have 2 solutions: 1, add a global variable to record last_syslogger_file_time which shared by backends and syslogger, so backends can get last_syslogger_file_time very easily; 2 syslogger process send last_syslogger_file_time to pgstat process when last_syslogger_file_time changes, just as other auxiliary processes send stat message to pgstat process, and pgstat process will write last_syslogger_file_time into stat file so that backend can get last_syslogger_file_time via reading this stat file.

For these 2 solutions, we prefer to later, because we want to keep the global variables space much simpler.
On the other side, we need to add a new function named pg_stat_get_log_file_name() which will return the current log file name according to last_syslogger_file_time and log file name format.
If you have any question, please let me know.
------------------
Jerry Yu

------------------ Original ------------------
From: "Alvaro Herrera";<alvherre(at)2ndquadrant(dot)com>;
Date: Tue, Feb 2, 2016 06:30 PM
To: "Armor"<yupengstone(at)qq(dot)com>;
Cc: "pgsql-hackers"<pgsql-hackers(at)postgresql(dot)org>;
Subject: Re: [HACKERS] get current log file

Armor wrote:
> Hello,
>
>
> I find there is a new feature about getting current log file name on the TODO list (for detail please check http://www.postgresql.org/message-id/Pine.GSO.4.64.0811101325260.9276@westnet.com) On the other side, we finish a ticket to this requirement for our customer.
> If the PG community still need this feature, there will be a pleasure for us to make contribution.

Please propose a design and we'll discuss. There's clearly need for
this feature.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Service

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-02-02 13:49:51 Re: [PATCH] Refactoring of LWLock tranches
Previous Message Oleg Bartunov 2016-02-02 13:14:45 Re: [PATCH] Phrase search ported to 9.6