agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Don't fully empty GIN pending list in parallel autovacuum worker
2+ messages / 1 participants
[nested] [flat]

* pgsql: Don't fully empty GIN pending list in parallel autovacuum worker
@ 2026-09-24 17:33  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-09-24 17:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8be38b238a61d58b6c0f21d4c1d8e9c1d26d8b58

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Don't fully empty GIN pending list in parallel autovacuum worker
@ 2026-09-24 17:33  Masahiko Sawada <msawada@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Masahiko Sawada @ 2026-09-24 17:33 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-24 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 17:33 pgsql: Don't fully empty GIN pending list in parallel autovacuum worker Masahiko Sawada <msawada@postgresql.org>
2026-09-24 17:33 pgsql: Don't fully empty GIN pending list in parallel autovacuum worker Masahiko Sawada <msawada@postgresql.org>

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