pgsql: Expand assertion check for query ID reporting in executor

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Expand assertion check for query ID reporting in executor
Date: 2024-09-30 23:57:05
Message-ID: E1svQGG-001dxP-LV@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Expand assertion check for query ID reporting in executor

As formulated, the assertion added in the executor by 24f520594809 to
check that a query ID is set had two problems:
- track_activities may be disabled while compute_query_id is enabled,
causing the query ID to not be reported to pg_stat_activity.
- debug_query_string may not be set in some context. The only path
where this would matter is visibly autovacuum, should parallel workers
be enabled there at some point. This is not the case currently.

There was no test showing the interactions between the query ID and
track_activities, so let's add one based on a scan of pg_stat_activity.
This assertion is still an experimentation at this stage, but let's see
if this shows more paths where query IDs are not properly set while they
should.

Discussion: https://postgr.es/m/Zvn5616oYXmpXyHI@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5deb56387e3a1d08e1e62bed031258db267a0ab5

Modified Files
--------------
src/backend/executor/execMain.c | 18 +++++++++++++++---
src/test/regress/expected/guc.out | 21 +++++++++++++++++++++
src/test/regress/sql/guc.sql | 12 ++++++++++++
3 files changed, 48 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-10-01 03:00:15 pgsql: Doc: replace unnecessary non-breaking space with ordinal space.
Previous Message Daniel Gustafsson 2024-09-30 22:02:32 pgsql: Add missing command for pg_maintain in comment