From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Set query ID in parallel workers for vacuum, BRIN and btree |
Date: | 2024-09-29 23:43:44 |
Message-ID: | E1sv3Zn-001Uk7-IM@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Set query ID in parallel workers for vacuum, BRIN and btree
All these code paths use their own entry point when starting parallel
workers, but failed to set a query ID, even if they set a text query.
Hence, this data would be missed in pg_stat_activity for the worker
processes. The main entry point for parallel query processing,
ParallelQueryMain(), is already doing that by saving its query ID in a
dummy PlannedStmt, but not the others. The code is changed so as the
query ID of these queries is set in their shared state, and reported
back once the parallel workers start.
Some tests are added to show how the failures can happen for btree and
BRIN with a parallel build enforced, which are able to trigger a failure
in an assertion added by 24f520594809 in the recovery TAP test
027_stream_regress.pl where pg_stat_statements is always loaded. In
this case, the executor path was taken because the index expression
needs to be flattened when building its IndexInfo.
Alexander Lakhin has noticed the problem in btree, and I have noticed
that the issue was more spread. This is arguably a bug, but nobody has
complained about that until now, so no backpatch is done out of caution.
If folks would like to see a backpatch, well, let me know.
Reported-by: Alexander Lakhin
Reviewed-by: Sami Imseih
Discussion: https://postgr.es/m/cf3547c1-498a-6a61-7b01-819f902a251f@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6fd5071909a2886c499871e61127f815fd9bb6a2
Modified Files
--------------
src/backend/access/brin/brin.c | 7 +++++++
src/backend/access/nbtree/nbtsort.c | 7 +++++++
src/backend/commands/vacuumparallel.c | 11 ++++++++---
src/test/regress/expected/brin.out | 10 ++++++++++
src/test/regress/expected/btree_index.out | 10 ++++++++++
src/test/regress/sql/brin.sql | 11 +++++++++++
src/test/regress/sql/btree_index.sql | 11 +++++++++++
7 files changed, 64 insertions(+), 3 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2024-09-30 02:18:13 | pgsql: reindexdb: Skip reindexing temporary tables and indexes. |
Previous Message | Noah Misch | 2024-09-29 22:56:26 | pgsql: Remove NULL dereference from RenameRelationInternal(). |