isolationtester: add session name to application name - Mailing list pgsql-hackers

From Andres Freund
Subject isolationtester: add session name to application name
Date
Msg-id 20211211012052.2blmzcmxnxqawd2z@alap3.anarazel.de
Whole thread Raw
Responses Re: isolationtester: add session name to application name  (Andrew Dunstan <andrew@dunslane.net>)
Re: isolationtester: add session name to application name  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hi,

When writing / debugging an isolation test it's sometimes useful to see which
session holds what lock etc. I find it kind of painful to map pg_stat_activity
/ pg_locks / log output to the isolationtester spec. Sometimes its easy enough
to infer identity based on a statement, but far from all the time.

I found it very helpful to have each session's setup step do something like
  SET application_name = 'isolation/prune-recently-dead/vac';

These days isolationtester.c already prefixes log output with the session
name. How about doing the same for application_name? It's a *tad* more
complicated than I'd like because isolationtester.c currently doesn't know the
name of the test its executing.

The attached patch executes
  SELECT set_config('application_name', current_setting('application_name') || '/' || $1, false);
when establishing connections to deal with that.

As attached this appends "control connection" for the control connection, but
perhaps we should just not append anything for that?

Greetings,

Andres Freund

Attachment

pgsql-hackers by date:

Previous
From: Paul Jungwirth
Date:
Subject: range_agg with multirange inputs
Next
From: Tomas Vondra
Date:
Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path