diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-03-14 17:25:59 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-03-14 17:25:59 +0000 |
commit | adc4e1e6353bfda442c23a32f172eb42c649c495 (patch) | |
tree | 35a32e1811f1207ccd98a4e7db2c17d6b8d9b0de /src/backend/postmaster/autovacuum.c | |
parent | be5d6df346241a82e38b50447f8a337fa7b9700c (diff) |
Fix vacuum so that autovacuum is really not cancelled when doing an emergency
job (i.e. to prevent Xid wraparound problems.) Bug reported by ITAGAKI
Takahiro in 20080314103837.63D3.52131E4D@oss.ntt.co.jp, though I didn't use his
patch.
Diffstat (limited to 'src/backend/postmaster/autovacuum.c')
-rw-r--r-- | src/backend/postmaster/autovacuum.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 9175f65a523..ca0bdde7364 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -55,7 +55,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.72 2008/02/20 14:01:45 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.73 2008/03/14 17:25:58 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -285,6 +285,7 @@ static void relation_needs_vacanalyze(Oid relid, Form_pg_autovacuum avForm, static void autovacuum_do_vac_analyze(Oid relid, bool dovacuum, bool doanalyze, int freeze_min_age, + bool for_wraparound, BufferAccessStrategy bstrategy); static HeapTuple get_pg_autovacuum_tuple_relid(Relation avRel, Oid relid); static PgStat_StatTabEntry *get_pgstat_tabentry_relid(Oid relid, bool isshared, @@ -2095,14 +2096,6 @@ do_autovacuum(void) /* clean up memory before each iteration */ MemoryContextResetAndDeleteChildren(PortalContext); - /* set the "vacuum for wraparound" flag in PGPROC */ - if (tab->at_wraparound) - { - LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); - MyProc->vacuumFlags |= PROC_VACUUM_FOR_WRAPAROUND; - LWLockRelease(ProcArrayLock); - } - /* * Save the relation name for a possible error message, to avoid a * catalog lookup in case of an error. Note: they must live in a @@ -2126,6 +2119,7 @@ do_autovacuum(void) tab->at_dovacuum, tab->at_doanalyze, tab->at_freeze_min_age, + tab->at_wraparound, bstrategy); /* @@ -2604,7 +2598,7 @@ relation_needs_vacanalyze(Oid relid, */ static void autovacuum_do_vac_analyze(Oid relid, bool dovacuum, bool doanalyze, - int freeze_min_age, + int freeze_min_age, bool for_wraparound, BufferAccessStrategy bstrategy) { VacuumStmt vacstmt; @@ -2631,7 +2625,7 @@ autovacuum_do_vac_analyze(Oid relid, bool dovacuum, bool doanalyze, /* Let pgstat know what we're doing */ autovac_report_activity(&vacstmt, relid); - vacuum(&vacstmt, list_make1_oid(relid), bstrategy, true); + vacuum(&vacstmt, list_make1_oid(relid), bstrategy, for_wraparound, true); MemoryContextSwitchTo(old_cxt); } |