agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't fully empty GIN pending list in parallel autovacuum worker
Date: Thu, 24 Sep 2026 17:33:12 +0000
Message-ID: <E1x9nJo-0000000161R-3ws6@gemulon.postgresql.org> (raw)

Don't fully empty GIN pending list in parallel autovacuum workers.

Autovacuum doesn't necessarily fully empty the GIN pending list. It
stops at the tail as of the start of cleanup, so that it doesn't keep
chasing pages appended by concurrent inserters. GIN decided this with
AmAutoVacuumWorkerProcess(), which returns false in parallel vacuum
workers launched by an autovacuum worker, so those workers tried to
fully empty the list as a manual VACUUM does.

Fix this by adding an is_autovacuum field to IndexVacuumInfo, set from
the shared parallel vacuum state in parallel workers, and using it in
GIN instead of checking the process type.

Oversight in commit 1ff3180ca01.

Reported-by: Jingtang Zhang <mrdrivingduck@gmail.com>
Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAPsk3_DiF2i1o=JRXRk1YPVMv1VzJaCAbfiEqgwCva4=ZewVAw@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/access/gin/ginvacuum.c    | 12 ++++++------
src/backend/access/heap/vacuumlazy.c  |  2 ++
src/backend/catalog/index.c           |  1 +
src/backend/commands/analyze.c        |  1 +
src/backend/commands/vacuumparallel.c |  1 +
src/include/access/genam.h            |  1 +
src/include/miscadmin.h               |  1 +
7 files changed, 13 insertions(+), 6 deletions(-)



view thread (2+ messages)

Message-ID: <E1x9nJo-0000000161R-3ws6@gemulon.postgresql.org>
Permalink:  ../E1x9nJo-0000000161R-3ws6@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x9nJo-0000000161R-3ws6@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Don't fully empty GIN pending list in parallel autovacuum worker
  In-Reply-To: <E1x9nJo-0000000161R-3ws6@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox