Make sure that open hash table scans are cleaned up when bgwriter tries to
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Sep 2007 17:15:33 +0000 (17:15 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Sep 2007 17:15:33 +0000 (17:15 +0000)
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.

src/backend/postmaster/autovacuum.c
src/backend/postmaster/bgwriter.c
src/backend/postmaster/walwriter.c

index 7b6da97b57bf5a9f46536b62700ae6c936b08ae9..2a6e654269eafb054e7d19422fcaea78d736c6d3 100644 (file)
@@ -55,7 +55,7 @@
  *
  *
  * 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();
                AtEOXact_Files();
+               AtEOXact_HashTables(false);
 
                /*
                 * Now return to normal top-level context and clear ErrorContext for
index d8c7c3aa13b4f46c35eb5a0da8cec704cc7c1e38..81f48c01fbfc42f7ef53d0c1abf10a95c3a8e72a 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * 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 */
                AtEOXact_Buffers(false);
                AtEOXact_Files();
+               AtEOXact_HashTables(false);
 
                /* Warn any waiting backends that the checkpoint failed. */
                if (ckpt_active)
index b4d594661a2d7819a9b81fcecdeb96a35ddc069b..d5736b7e694df7ecf6f10afa6b803701029bc30e 100644 (file)
@@ -34,7 +34,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
 #include "miscadmin.h"
 #include "postmaster/walwriter.h"
 #include "storage/bufmgr.h"
+#include "storage/fd.h"
 #include "storage/ipc.h"
 #include "storage/lwlock.h"
 #include "storage/pmsignal.h"
 #include "storage/smgr.h"
 #include "utils/guc.h"
+#include "utils/hsearch.h"
 #include "utils/memutils.h"
 #include "utils/resowner.h"
 
@@ -179,6 +181,8 @@ WalWriterMain(void)
                                                         false, true);
                /* we needn't bother with the other ResourceOwnerRelease phases */
                AtEOXact_Buffers(false);
+               AtEOXact_Files();
+               AtEOXact_HashTables(false);
 
                /*
                 * Now return to normal top-level context and clear ErrorContext for