Fix BitmapHeapScan non-parallel-aware EXPLAIN ANALYZE
Allocates shared bitmap table scan instrumentation for all parallel
scans. Previously, the instrumentation was only allocated for
parallel-aware scans, other bitmap heap scans in the parallel query had
no shared instrumentation and EXPLAIN didn't report exact/lossy pages.
This affected cases like scans on the outside of a parallel join or
queries run with debug_parallel_query=regress.
Fixed by allocating a separate DSM chunk for shared instrumentation and
doing so regardless of parallel-awareness. The instrumentation is
allocated in its own DSM chunk, separate from ParallelBitmapHeapState.
Report an initial patch by me. The approach with a separate DSM was
proposed and implemented by Melanie.
Not backpatched. The issue affects Postgres 18 (since 5a1e6df3b84c), but
having multiple DSM chunks is possible only since dd78e69cfc33. If we
decide to fix this in backbranches too, it will need to be done in a
less invasive way.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9c18b47e61071cf1395620f182b07a7ab9aac263
Modified Files
--------------
src/backend/commands/explain.c | 2 +-
src/backend/executor/execParallel.c | 9 +++
src/backend/executor/nodeBitmapHeapscan.c | 111 ++++++++++++++++++------------
src/include/executor/nodeBitmapHeapscan.h | 6 ++
4 files changed, 83 insertions(+), 45 deletions(-)