Parallel vacuum: avoid dangling shared memory pointers

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Parallel vacuum: avoid dangling shared memory pointers
Date: 2026-10-14 03:30:00
Message-ID: CALj2ACW3OY7Ex-2-aits7yhRciH20r12DHcCNf+exuweR1FcMw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that two of the parallel vacuum's shared memory pointers
(VacuumSharedCostBalance and VacuumActiveNWorkers) are not reset on
the error path, leaving them dangling, that is, pointing to a shared
memory segment that is already gone, until the next vacuum runs in the
backend or autovacuum worker. This doesn't cause any issue today, but
IMHO it is good practice to avoid dangling pointers.

Please find the attached patch that sets them to NULL on the error
path (the normal path resets them in
parallel_vacuum_process_all_indexes()).

Thoughts?

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v1-0001-Avoid-dangling-shared-memory-pointers-in-parallel.patch application/x-patch 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Sho Ito 2026-10-14 03:32:06 Re: PG19: flat-copied RelOptInfos share extension_state with the original rel
Previous Message Richard Guo 2026-10-14 03:19:07 Re: Wrong results from an antijoin