pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix race in autovacuum freeze score calculations.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix race in autovacuum freeze score calculations.
@ 2026-11-19 15:21  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-11-19 15:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix race in autovacuum freeze score calculations.

We calculate the transaction ID and multixact ID component scores
by subtracting a table's relfrozenxid or relminmxid from a "recent"
ID that we read before scanning pg_class.  If something advances
relfrozenxid or relminmxid past the recent ID in the meantime
(e.g., a concurrent VACUUM), the subtraction wraps around and gives
the table a much higher score than it deserves.  The window is
small enough that this is probably rare in practice.  To fix, set
the affected component score to 0 in this case.

Oversight in commit d7965d65fc.

Author: Baji Shaik <baji.pgdev@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://postgr.es/m/CA%2Bfm-RPOMc-GHjpv4DpXO1eqMahCeZDpAgXWqVgnsB3s3arptA%40mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4226f1f01ad1a1bd6f017d181c085c788b2961a0

Modified Files
--------------
src/backend/postmaster/autovacuum.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)



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

* pgsql: Fix race in autovacuum freeze score calculations.
@ 2026-11-19 15:21  Nathan Bossart <nathan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Nathan Bossart @ 2026-11-19 15:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix race in autovacuum freeze score calculations.

We calculate the transaction ID and multixact ID component scores
by subtracting a table's relfrozenxid or relminmxid from a "recent"
ID that we read before scanning pg_class.  If something advances
relfrozenxid or relminmxid past the recent ID in the meantime
(e.g., a concurrent VACUUM), the subtraction wraps around and gives
the table a much higher score than it deserves.  The window is
small enough that this is probably rare in practice.  To fix, set
the affected component score to 0 in this case.

Oversight in commit d7965d65fc.

Author: Baji Shaik <baji.pgdev@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://postgr.es/m/CA%2Bfm-RPOMc-GHjpv4DpXO1eqMahCeZDpAgXWqVgnsB3s3arptA%40mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b1bc8f8ea5daf86cb5669d62f08c03d05caeb0de

Modified Files
--------------
src/backend/postmaster/autovacuum.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)



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


end of thread, other threads:[~2026-11-19 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 15:21 pgsql: Fix race in autovacuum freeze score calculations. Nathan Bossart <nathan@postgresql.org>
2026-11-19 15:21 pgsql: Fix race in autovacuum freeze score calculations. Nathan Bossart <nathan@postgresql.org>

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