Make sure that open hash table scans are cleaned up when bgwriter tries to

recover from elog(ERROR).  Problem was created by introduction of hash seq
search tracking awhile back, and affects all branches that have bgwriter;
in HEAD the disease has snuck into autovacuum and walwriter too.  (Not sure
that the latter two use hash_seq_search at the moment, but surely they might
someday.)  Per report from Sergey Koposov.
This commit is contained in:
Tom Lane 2007-09-11 17:15:33 +00:00
parent 5cf785a4de
commit f181f9e1e4
3 changed files with 9 additions and 3 deletions

View File

@ -55,7 +55,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.56 2007/08/02 23:39:44 adunstan Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.57 2007/09/11 17:15:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -472,6 +472,7 @@ AutoVacLauncherMain(int argc, char *argv[])
*/ */
LWLockReleaseAll(); LWLockReleaseAll();
AtEOXact_Files(); AtEOXact_Files();
AtEOXact_HashTables(false);
/* /*
* Now return to normal top-level context and clear ErrorContext for * Now return to normal top-level context and clear ErrorContext for

View File

@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.41 2007/07/03 14:51:24 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.42 2007/09/11 17:15:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -295,6 +295,7 @@ BackgroundWriterMain(void)
/* we needn't bother with the other ResourceOwnerRelease phases */ /* we needn't bother with the other ResourceOwnerRelease phases */
AtEOXact_Buffers(false); AtEOXact_Buffers(false);
AtEOXact_Files(); AtEOXact_Files();
AtEOXact_HashTables(false);
/* Warn any waiting backends that the checkpoint failed. */ /* Warn any waiting backends that the checkpoint failed. */
if (ckpt_active) if (ckpt_active)

View File

@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.1 2007/07/24 04:54:09 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.2 2007/09/11 17:15:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -50,11 +50,13 @@
#include "miscadmin.h" #include "miscadmin.h"
#include "postmaster/walwriter.h" #include "postmaster/walwriter.h"
#include "storage/bufmgr.h" #include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/ipc.h" #include "storage/ipc.h"
#include "storage/lwlock.h" #include "storage/lwlock.h"
#include "storage/pmsignal.h" #include "storage/pmsignal.h"
#include "storage/smgr.h" #include "storage/smgr.h"
#include "utils/guc.h" #include "utils/guc.h"
#include "utils/hsearch.h"
#include "utils/memutils.h" #include "utils/memutils.h"
#include "utils/resowner.h" #include "utils/resowner.h"
@ -179,6 +181,8 @@ WalWriterMain(void)
false, true); false, true);
/* we needn't bother with the other ResourceOwnerRelease phases */ /* we needn't bother with the other ResourceOwnerRelease phases */
AtEOXact_Buffers(false); AtEOXact_Buffers(false);
AtEOXact_Files();
AtEOXact_HashTables(false);
/* /*
* Now return to normal top-level context and clear ErrorContext for * Now return to normal top-level context and clear ErrorContext for