Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Noah Misch <noah@leadboat.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Euler Taveira <euler.taveira@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2024-09-11T23:42:25Z
Lists: pgsql-hackers
On Wed, Sep 11, 2024 at 02:29:49PM -0700, Jacob Champion wrote: > On Mon, Sep 9, 2024 at 10:30 PM Michael Paquier <michael@paquier.xyz> wrote: >> No. My question was about splitting pgstat_bestart() and >> pgstat_bestart_pre_auth() in a cleaner way, because authenticated >> connections finish by calling both, meaning that we do twice the same >> setup for backend entries depending on the authentication path taken. >> That seems like a waste. > > I can try to separate them out. I'm a little wary of messing with the > CRITICAL_SECTION guarantees, though. I thought the idea was that you > filled in the entire struct to prevent tearing. (If I've misunderstood > that, please let me know :D) Hm, yeah. We surely should be careful about the consequences of that. Setting up twice the structure as the patch proposes is kind of a weird concept, but it feels to me that we should split that and set the fields in the pre-auth step and ignore the irrelevant ones, then complete the rest in a second step. We are going to do that anyway if we want to be able to have backend entries earlier in the authentication phase. >> Couldn't it be better to have a one-one mapping >> instead, adding twelve entries in wait_event_names.txt? > > (I have no strong opinions on this myself, but while the debate is > ongoing, I'll work on a version of the patch with more detailed wait > events. It's easy to collapse them again if that gets the most votes.) Thanks. Robert is arguing upthread about more granularity, which is also what I understand is the original intention of the wait events. Noah has a different view. Let's see where it goes but I've given my opinion. > I can test for specific contents of the entry, if you'd like. My > primary goal was to test that an entry shows up if that part of the > code hangs. I think a regression would otherwise go completely > unnoticed. Perhaps that would be useful, not sure. Based on my first impressions, I'd tend to say no to these extra test cycles, but I'm okay to be proved wrong, as well. -- Michael
Commits
-
Fix race condition in TAP test 007_pre_auth
- e2080261cc8c 18.0 landed
-
Split pgstat_bestart() into three different routines
- c76db55c9085 18.0 landed
-
backport: Extend background_psql() to be able to start asynchronously
- 6af51bf05a6a 13.21 landed
- 7c07ab62aeb7 14.18 landed
- c0bc11aebb01 15.13 landed
- 6ab58d506bba 16.9 landed
- 49b6f4a02b23 17.5 landed
-
backport: Improve handling of empty query results in BackgroundPsql
- 3c562b58c20e 13.21 landed
- 3170aece14b8 14.18 landed
- f4b08ccb4ec8 15.13 landed
- fbfd38662f72 16.9 landed
- 31a242e90c88 17.5 landed
-
Improve handling of empty query results in BackgroundPsql::query()
- 70291a3c66ec 18.0 landed
-
Extend Cluster.pm's background_psql() to be able to start asynchronously
- ba08edb06545 18.0 landed
-
dblink: Replace WAIT_EVENT_EXTENSION with custom wait events
- c789f0f6cc5d 17.0 cited