Re: Fix for timestamp lag issue from emit_log_hook when GUC log_line_prefix has '%m'

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Kambam Vinay <vinaykambam(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix for timestamp lag issue from emit_log_hook when GUC log_line_prefix has '%m'
Date: 2024-03-18 05:12:57
Message-ID: ZffNWb5Zm8WZwMLY@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 17, 2024 at 07:35:57PM +0530, Kambam Vinay wrote:
> Thanks Michael for the review. Agree with your comment on the patch.
> updated the patch with recommended change.

That should be fine. I would suggest to document why the reset is
done at this location, aka this is to ensure that the same formatted
timestamp is used across the board, for all log destinations as well
as hook callers that rely on log_line_prefix.

While reviewing, I have noticed that a comment was not correct: JSON
logs also use the formatted timestamp via get_formatted_log_time().

I may be able to get this one committed just before the feature freeze
of v17, as timestamp consistency for hooks that call
log_status_format() is narrow. For now, I have added an entry in the
CF app to keep track of it:
https://commitfest.postgresql.org/48/4901/
--
Michael

Attachment Content-Type Size
v2-0001-set-saved_timeval_set-to-false-before-executing-e.patch text/x-diff 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-03-18 05:13:51 Re: Add new error_action COPY ON_ERROR "log"
Previous Message Amit Kapila 2024-03-18 05:05:05 Re: speed up a logical replica setup