Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3ec8576

Browse files
committed
Revert "Skip redundant anti-wraparound vacuums"
This reverts commit2aa6e33, that added a fast path to skipanti-wraparound and non-aggressive autovacuum jobs (these have no senseas anti-wraparound implies aggressive). With a cluster using a highamount of relations with a portion of them being heavily updated, thiscould cause autovacuum to lock down, with autovacuum workers attemptingrepeatedly those jobs on the same relations for the same database, thatjust kept being skipped. This lock down can be solved with a manualVACUUM FREEZE.Justin King has reported one environment where the issue happened, andJulien Rouhaud and I have been able to reproduce it in a secondenvironment. With a very aggressive autovacuum_freeze_max_age,triggering those jobs with pgbench is a matter of minutes, and hittingthe lock down is a lot harder (my local tests failed to do that).Note that anti-wraparound and non-aggressive jobs can only be triggeredon a subset of shared catalogs:- pg_auth_members- pg_authid- pg_database- pg_replication_origin- pg_shseclabel- pg_subscription- pg_tablespaceWhile the lock down was possible down to v12, the root cause of thosejobs is a much older issue, which needs more analysis.Bonus thanks to Andres Freund for the discussion.Reported-by: Justin KingDiscussion:https://postgr.es/m/CAE39h22zPLrkH17GrkDgAYL3kbjvySYD1io+rtnAUFnaJJVS4g@mail.gmail.comBackpatch-through: 12
1 parent97cda93 commit3ec8576

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,6 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
255255
if (params->options&VACOPT_DISABLE_PAGE_SKIPPING)
256256
aggressive= true;
257257

258-
/*
259-
* Normally the relfrozenxid for an anti-wraparound vacuum will be old
260-
* enough to force an aggressive vacuum. However, a concurrent vacuum
261-
* might have already done this work that the relfrozenxid in relcache has
262-
* been updated. If that happens this vacuum is redundant, so skip it.
263-
*/
264-
if (params->is_wraparound&& !aggressive)
265-
{
266-
ereport(DEBUG1,
267-
(errmsg("skipping redundant vacuum to prevent wraparound of table \"%s.%s.%s\"",
268-
get_database_name(MyDatabaseId),
269-
get_namespace_name(RelationGetNamespace(onerel)),
270-
RelationGetRelationName(onerel))));
271-
pgstat_progress_end_command();
272-
return;
273-
}
274-
275258
vacrelstats= (LVRelStats*)palloc0(sizeof(LVRelStats));
276259

277260
vacrelstats->old_rel_pages=onerel->rd_rel->relpages;
@@ -400,9 +383,10 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params,
400383
initStringInfo(&buf);
401384
if (params->is_wraparound)
402385
{
403-
/* an anti-wraparound vacuum has to be aggressive */
404-
Assert(aggressive);
405-
msgfmt=_("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
386+
if (aggressive)
387+
msgfmt=_("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
388+
else
389+
msgfmt=_("automatic vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
406390
}
407391
else
408392
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp