Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e5e856

Browse files
committed
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.
1 parent f204274 commit 2e5e856

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/backend/commands/vacuum.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.338 2006/08/18 16:09:08 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.339 2006/09/17 22:16:22 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -460,6 +460,8 @@ vacuum(VacuumStmt *vacstmt, List *relids)
460460
{
461461
/* Make sure cost accounting is turned off after error */
462462
VacuumCostActive = false;
463+
/* And reset buffer replacement strategy, too */
464+
StrategyHintVacuum(false);
463465
PG_RE_THROW();
464466
}
465467
PG_END_TRY();
@@ -1173,8 +1175,6 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind)
11731175
* Now release the session-level lock on the master table.
11741176
*/
11751177
UnlockRelationIdForSession(&onerelid, lmode);
1176-
1177-
return;
11781178
}
11791179

11801180

src/backend/storage/buffer/bufmgr.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.209 2006/07/23 03:07:58 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.210 2006/09/17 22:16:22 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1171,9 +1171,6 @@ AtEOXact_Buffers(bool isCommit)
11711171
#endif
11721172

11731173
AtEOXact_LocalBuffers(isCommit);
1174-
1175-
/* Make sure we reset the strategy hint in case VACUUM errored out */
1176-
StrategyHintVacuum(false);
11771174
}
11781175

11791176
/*

0 commit comments

Comments
 (0)