It occurred to me that if we elog(ERROR) during VACUUM, the vacuum
activity hint will not be reset. This will result in all subsequent I/O
by the current backend being treated by the bufmgr as though it resulted
from VACUUM. While elog(ERROR) during VACUUM is not a common occurrence,
I don't think it's wise to assume it is impossible.
Attached is a patch which resets the vacuum activity hint in
AbortTransaction().
Barring any objections, I intend to apply this to REL8_0_STABLE and HEAD
sometime on Monday.
-Neil
Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /Users/neilc/local/cvs/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.195
diff -c -r1.195 xact.c
*** src/backend/access/transam/xact.c 31 Dec 2004 21:59:29 -0000 1.195
--- src/backend/access/transam/xact.c 22 Jan 2005 12:07:16 -0000
***************
*** 32,37 ****
--- 32,38 ----
#include "executor/spi.h"
#include "libpq/be-fsstubs.h"
#include "miscadmin.h"
+ #include "storage/buf_internals.h"
#include "storage/fd.h"
#include "storage/proc.h"
#include "storage/sinval.h"
***************
*** 1606,1611 ****
--- 1607,1621 ----
*/
LWLockReleaseAll();
+ /*
+ * Reset the VACUUM activity hint. If we did elog(ERROR) during
+ * VACUUM, this might still be set to true, so reset it here. For
+ * the sake of correctness, we make sure to reset the flag fairly
+ * early, before we've done any I/O that may be required for txn
+ * abort.
+ */
+ StrategyHintVacuum(false);
+
/* Clean up buffer I/O and buffer context locks, too */
AbortBufferIO();
UnlockBuffers();