1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

BRIN autosummarization may need a snapshot

It's possible to define BRIN indexes on functions that require a
snapshot to run, but the autosummarization feature introduced by commit
7526e10224 fails to provide one.  This causes autovacuum to leave a
BRIN placeholder tuple behind after a failed work-item execution, making
such indexes less efficient.  Repair by obtaining a snapshot prior to
running the task, and add a test to verify this behavior.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: Giovanni Fabris <giovanni.fabris@icon.it>
Reported-by: Arthur Nascimento <tureba@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511031106.h4fwyuyui6fz@alvherre.pgsql
This commit is contained in:
Álvaro Herrera
2025-11-04 13:23:26 +01:00
parent c09a06918d
commit a95e3d84c0
2 changed files with 44 additions and 4 deletions

View File

@@ -2556,7 +2556,9 @@ deleted:
workitem->avw_active = true;
LWLockRelease(AutovacuumLock);
PushActiveSnapshot(GetTransactionSnapshot());
perform_work_item(workitem);
PopActiveSnapshot();
/*
* Check for config changes before acquiring lock for further jobs.