diff options
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 1058bd2d312..d2b3105e028 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.390 2009/08/24 02:18:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.391 2009/08/31 02:23:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -895,8 +895,9 @@ vac_update_datfrozenxid(void) /* * If we were able to advance datfrozenxid, mark the flat-file copy of * pg_database for update at commit, and see if we can truncate pg_clog. + * Also force update if the shared XID-wrap-limit info is stale. */ - if (dirty) + if (dirty || !TransactionIdLimitIsValid()) { database_file_update_needed(); vac_truncate_clog(newFrozenXid); @@ -916,7 +917,7 @@ vac_update_datfrozenxid(void) * * This routine is shared by full and lazy VACUUM. Note that it's * only invoked when we've managed to change our DB's datfrozenxid - * entry. + * entry, or we found that the shared XID-wrap-limit info is stale. */ static void vac_truncate_clog(TransactionId frozenXID) @@ -925,11 +926,11 @@ vac_truncate_clog(TransactionId frozenXID) Relation relation; HeapScanDesc scan; HeapTuple tuple; - NameData oldest_datname; + Oid oldest_datoid; bool frozenAlreadyWrapped = false; - /* init oldest_datname to sync with my frozenXID */ - namestrcpy(&oldest_datname, get_database_name(MyDatabaseId)); + /* init oldest_datoid to sync with my frozenXID */ + oldest_datoid = MyDatabaseId; /* * Scan pg_database to compute the minimum datfrozenxid @@ -958,7 +959,7 @@ vac_truncate_clog(TransactionId frozenXID) else if (TransactionIdPrecedes(dbform->datfrozenxid, frozenXID)) { frozenXID = dbform->datfrozenxid; - namecpy(&oldest_datname, &dbform->datname); + oldest_datoid = HeapTupleGetOid(tuple); } } @@ -987,7 +988,7 @@ vac_truncate_clog(TransactionId frozenXID) * Update the wrap limit for GetNewTransactionId. Note: this function * will also signal the postmaster for an(other) autovac cycle if needed. */ - SetTransactionIdLimit(frozenXID, &oldest_datname); + SetTransactionIdLimit(frozenXID, oldest_datoid); } |