Re: Augmenting the deadlock message with application_name

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Karoline Pauls <code(at)karolinepauls(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Augmenting the deadlock message with application_name
Date: 2024-05-10 21:09:57
Message-ID: Zj6NJY-xN4fWpE_w@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 10, 2024 at 08:10:58PM +0000, Karoline Pauls wrote:
> On Friday, 10 May 2024 at 20:17, Bruce Momjian <bruce(at)momjian(dot)us>
> wrote:
> >
> > log_line_prefix supports application name --- why would you not use
> > that?
> >
>
> log_line_prefix is effective in the server log. This change is mostly
> about improving the message sent back to the client. While the server
> log is also changed to reflect the client message, it doesn't need to
> be.

I was hoping client_min_messages would show the application name, but it
doesn't but your bigger point is below.

> Additionally, with `%a` added to log_line_prefix, the server log
> would only contain the application name of the client affected by the
> deadlock, not the application names of all other clients involved in
> it.

Yeah, getting the application names of the pids reported in the log
requires looking backward in the logs to find out what the most recent
log line was for the pids involved.

Frankly, I think it would be more useful to show the session_id in the
deadlock so you could then use that to look back to any details you want
in the logs, not only the application name.

> Anyway, the server log is not the important part here. The crucial
> UX feature is the client getting application names back, so browsing
> through server logs can be avoided.

Well, we don't want to report too much information because it gets
confusing.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-05-10 21:21:01 Re: First draft of PG 17 release notes
Previous Message Tom Lane 2024-05-10 21:01:27 Re: Augmenting the deadlock message with application_name