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:55 +0000 (17:15 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Sep 2007 17:15:55 +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 121d40b0acff31ec6b861e0b107a041338dd3f79..97a0509175f965e40f09c466dd2cee2be5b7e562 100644 (file)
@@ -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 c919870a569811d70b4443b7d4d6a2ba57eb09fd..d8ecd8569c72ffd13b5613b970ea2e9a8dbc2bc3 100644 (file)
@@ -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 c4fbd6ffb345fc83876b13f08c0d957b1ae945a5..000597ed72765bdf00a736aff0229c945f193690 100644 (file)
 #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