From 20f0f103cc2259f2cf8df15d0066c43abe71b64b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 17 Sep 2006 22:16:22 +0000 Subject: [PATCH] Marginal cleanup in arrangements for ensuring StrategyHintVacuum is cleared after an error during VACUUM. We have a PG_TRY block anyway around the only call sites, so just reset it in the CATCH clause instead of having AtEOXact_Buffers blindly do it during xact end. I think the old code was actively wrong for the case of a failure during ANALYZE inside a subtransaction --- the flag wouldn't get cleared until main transaction end. Probably not worth back-patching though. --- src/backend/commands/vacuum.c | 4 ++-- src/backend/storage/buffer/bufmgr.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index e7d66ab1f5..f0265dfd92 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -460,6 +460,8 @@ vacuum(VacuumStmt *vacstmt, List *relids) { /* Make sure cost accounting is turned off after error */ VacuumCostActive = false; + /* And reset buffer replacement strategy, too */ + StrategyHintVacuum(false); PG_RE_THROW(); } PG_END_TRY(); @@ -1173,8 +1175,6 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) * Now release the session-level lock on the master table. */ UnlockRelationIdForSession(&onerelid, lmode); - - return; } diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index d15684f579..ada516d505 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1171,9 +1171,6 @@ AtEOXact_Buffers(bool isCommit) #endif AtEOXact_LocalBuffers(isCommit); - - /* Make sure we reset the strategy hint in case VACUUM errored out */ - StrategyHintVacuum(false); } /* -- 2.39.5