isolationtester: add session name to application name

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: isolationtester: add session name to application name
Date: 2021-12-11 01:20:52
Message-ID: 20211211012052.2blmzcmxnxqawd2z@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-isolationtester-append-session-name-to-application_n.patch text/x-diff 6.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-12-11 01:34:30 Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path
Previous Message Paul Jungwirth 2021-12-11 00:24:48 range_agg with multirange inputs