Content-Length: 282563 | pFad | http://github.com/postgrespro/postgres/commit/f21afe42146371ee15d4364c0e9e3d64ac317ddf

E2 Avoid wholesale autovacuuming when autovacuum is nominally off. · postgrespro/postgres@f21afe4 · GitHub
Skip to content

Commit f21afe4

Browse files
committed
Avoid wholesale autovacuuming when autovacuum is nominally off.
When autovacuum is nominally off, we will still launch autovac workers to vacuum tables that are at risk of XID wraparound. But after we'd done that, an autovac worker would proceed to autovacuum every table in the targeted database, if they meet the usual thresholds for autovacuuming. This is at best pretty unexpected; at worst it delays response to the wraparound threat. Fix it so that if autovacuum is nominally off, we *only* do forced vacuums and not any other work. Per gripe from Andrey Zhidenkov. This has been like this all along, so back-patch to all supported branches.
1 parent de88ec6 commit f21afe4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/backend/postmaster/autovacuum.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,14 +2656,21 @@ relation_needs_vacanalyze(Oid relid,
26562656
*wraparound = force_vacuum;
26572657

26582658
/* User disabled it in pg_class.reloptions? (But ignore if at risk) */
2659-
if (!force_vacuum && !av_enabled)
2659+
if (!av_enabled && !force_vacuum)
26602660
{
26612661
*doanalyze = false;
26622662
*dovacuum = false;
26632663
return;
26642664
}
26652665

2666-
if (PointerIsValid(tabentry))
2666+
/*
2667+
* If we found the table in the stats hash, and autovacuum is currently
2668+
* enabled, make a threshold-based decision whether to vacuum and/or
2669+
* analyze. If autovacuum is currently disabled, we must be here for
2670+
* anti-wraparound vacuuming only, so don't vacuum (or analyze) anything
2671+
* that's not being forced.
2672+
*/
2673+
if (PointerIsValid(tabentry) && AutoVacuumingActive())
26672674
{
26682675
reltuples = classForm->reltuples;
26692676
vactuples = tabentry->n_dead_tuples;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/f21afe42146371ee15d4364c0e9e3d64ac317ddf

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy