aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-03-31 08:27:47 +0900
committerMichael Paquier <michael@paquier.xyz>2020-03-31 08:27:47 +0900
commitdd9ac7d5d80608a640bb82cffb6a805ce84cf112 (patch)
tree9d0347bb79f0bb077414f392ad968db9b81ca441 /src
parent7c2dbc691c3e19b7d33c78f6c8aacc6e0cab510b (diff)
downloadpostgresql-dd9ac7d5d80608a640bb82cffb6a805ce84cf112.tar.gz
postgresql-dd9ac7d5d80608a640bb82cffb6a805ce84cf112.zip
Revert "Skip redundant anti-wraparound vacuums"
This reverts commit 2aa6e33, that added a fast path to skip anti-wraparound and non-aggressive autovacuum jobs (these have no sense as anti-wraparound implies aggressive). With a cluster using a high amount of relations with a portion of them being heavily updated, this could cause autovacuum to lock down, with autovacuum workers attempting repeatedly those jobs on the same relations for the same database, that just kept being skipped. This lock down can be solved with a manual VACUUM FREEZE. Justin King has reported one environment where the issue happened, and Julien Rouhaud and I have been able to reproduce it in a second environment. With a very aggressive autovacuum_freeze_max_age, triggering those jobs with pgbench is a matter of minutes, and hitting the lock down is a lot harder (my local tests failed to do that). Note that anti-wraparound and non-aggressive jobs can only be triggered on a subset of shared catalogs: - pg_auth_members - pg_authid - pg_database - pg_replication_origin - pg_shseclabel - pg_subscription - pg_tablespace While the lock down was possible down to v12, the root cause of those jobs is a much older issue, which needs more analysis. Bonus thanks to Andres Freund for the discussion. Reported-by: Justin King Discussion: https://postgr.es/m/CAE39h22zPLrkH17GrkDgAYL3kbjvySYD1io+rtnAUFnaJJVS4g@mail.gmail.com Backpatch-through: 12
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/heap/vacuumlazy.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index edda82abd01..af322c1f15c 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -462,23 +462,6 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
if (params->options & VACOPT_DISABLE_PAGE_SKIPPING)
aggressive = true;
- /*
- * Normally the relfrozenxid for an anti-wraparound vacuum will be old
- * enough to force an aggressive vacuum. However, a concurrent vacuum
- * might have already done this work that the relfrozenxid in relcache has
- * been updated. If that happens this vacuum is redundant, so skip it.
- */
- if (params->is_wraparound && !aggressive)
- {
- ereport(DEBUG1,
- (errmsg("skipping redundant vacuum to prevent wraparound of table \"%s.%s.%s\"",
- get_database_name(MyDatabaseId),
- get_namespace_name(RelationGetNamespace(onerel)),
- RelationGetRelationName(onerel))));
- pgstat_progress_end_command();
- return;
- }
-
vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats));
vacrelstats->relnamespace = get_namespace_name(RelationGetNamespace(onerel));
@@ -639,9 +622,10 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
initStringInfo(&buf);
if (params->is_wraparound)
{
- /* an anti-wraparound vacuum has to be aggressive */
- Assert(aggressive);
- msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
+ if (aggressive)
+ msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
+ else
+ msgfmt = _("automatic vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
}
else
{