Fw: Re: get current log file

From: Armor <yupengstone(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fw: Re: get current log file
Date: 2016-02-24 01:30:54
Message-ID: tencent_6FA3B29D6659783909B6AEB3@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry, forgot forwarding the mail to the mail list.
Please put some comments.

------------------
Jerry Yu
https://github.com/scarbrofair

------------------ Original ------------------
From: "Armor";<yupengstone(at)qq(dot)com>;
Date: Tue, Feb 2, 2016 09:22 PM
To: "Alvaro Herrera"<alvherre(at)2ndquadrant(dot)com>;

Subject: Re: [HACKERS] get current log file

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2016-02-24 01:43:14 Re: Add generate_series(date,date) and generate_series(date,date,integer)
Previous Message Tomas Vondra 2016-02-24 01:12:33 improving GROUP BY estimation