Re: Augmenting the deadlock message with application_name - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Augmenting the deadlock message with application_name
Date
Msg-id Zj6NJY-xN4fWpE_w@momjian.us
Whole thread Raw
In response to Re: Augmenting the deadlock message with application_name  (Karoline Pauls <code@karolinepauls.com>)
List 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@momjian.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@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Augmenting the deadlock message with application_name
Next
From: Bruce Momjian
Date:
Subject: Re: First draft of PG 17 release notes