Hi,

GIN asks a manual VACUUM to empty the pending list.  Autovacuum instead
stops after processing the part of the list that existed when cleanup
started.  This prevents concurrent insertions from extending cleanup
indefinitely.  It is safe because those insertions cannot contain TIDs
that this VACUUM needs to remove.

Parallel autovacuum workers are regular background workers, so
AmAutoVacuumWorkerProcess() returns false for them.  A GIN index handled
by such a worker is therefore treated as if it were processed by a
manual VACUUM, and its pending-list cleanup is not bounded.

The attached patch adds is_autovacuum to IndexVacuumInfo and passes the
leader's state to parallel workers.  GIN uses that state when deciding
whether the pending list must be emptied.  Manual VACUUM behavior is
unchanged.

Any thoughts?

---
Best regards,
Jingtang Zhang

Attachment: v1-0001-Fix-GIN-pending-list-cleanup-in-parallel-autovacuum.patch
Description: Binary data

Reply via email to