pgsql: Avoid dangling shared memory pointers in parallel vacuum.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid dangling shared memory pointers in parallel vacuum.
Date: 2026-10-15 21:09:36
Message-ID: E1xHShk-00000001mcm-3Vgt@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid dangling shared memory pointers in parallel vacuum.

When a parallel vacuum failed, the leader's VacuumSharedCostBalance
and VacuumActiveNWorkers kept pointing into the parallel vacuum's DSM
segment, which is gone after the abort, until the next vacuum in the
same process reset them. Nothing in the current code reads them in the
meantime, but it's better not to leave them dangling. Reset them at
the end of vacuum(), as we already do at its start.

No backpatch, as this doesn't fix any live problem.

Author: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALj2ACW3OY7Ex-2-aits7yhRciH20r12DHcCNf+exuweR1FcMw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e0b995e5b23116450646fd1004db4bdcdbe213e4

Modified Files
--------------
src/backend/commands/vacuum.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-10-15 23:09:28 pgsql: Report pages read from WAL buffers in pg_stat_io.hits
Previous Message Tom Lane 2026-10-15 18:45:37 pgsql: Install infrastructure to manage psql's hidden query labels bett