]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Need to reset local buffer pin counts, not only shared buffer pins,
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 18 Mar 2005 16:16:20 +0000 (16:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 18 Mar 2005 16:16:20 +0000 (16:16 +0000)
before we attempt any file deletions in ShutdownPostgres.  Per Tatsuo.

src/backend/storage/buffer/localbuf.c
src/backend/utils/init/postinit.c
src/include/storage/bufmgr.h

index d8737427029c182813de66d230f368439114294c..16767b12df383d9048e313e3c52704617b408bbe 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.62 2005/01/10 20:02:21 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.62.4.1 2005/03/18 16:16:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -241,3 +241,17 @@ AtEOXact_LocalBuffers(bool isCommit)
        }
 #endif
 }
+
+/*
+ * AtProcExit_LocalBuffers - ensure we have dropped pins during backend exit.
+ *
+ * This is just like AtProcExit_Buffers, but for local buffers.  We have
+ * to drop pins to ensure that any attempt to drop temp files doesn't
+ * fail in DropRelFileNodeBuffers.
+ */
+void
+AtProcExit_LocalBuffers(void)
+{
+       /* just zero the refcounts ... */
+       MemSet(LocalRefCount, 0, NLocBuffer * sizeof(*LocalRefCount));
+}
index 16d54ca0ba4ea8d16c52b366193663824aba4ee8..286e7d32f192d9e9bc535a839ab4695759d88157 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.139.4.1 2005/03/18 05:24:24 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.139.4.2 2005/03/18 16:16:20 tgl Exp $
  *
  *
  *-------------------------------------------------------------------------
@@ -478,6 +478,7 @@ ShutdownPostgres(int code, Datum arg)
         */
        LWLockReleaseAll();
        AtProcExit_Buffers();
+       AtProcExit_LocalBuffers();
 
        /*
         * In case a transaction is open, delete any files it created.  This
index 4ac499cf35046fae6f46b1c5f52fad9bd4c4c8fb..34582828d5073a1c6d4c6f58661dfba5eddb1a84 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.89 2004/12/31 22:03:42 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.89.4.1 2005/03/18 16:16:20 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -153,5 +153,6 @@ extern void BufmgrCommit(void);
 extern int     BufferSync(int percent, int maxpages);
 
 extern void InitLocalBuffer(void);
+extern void AtProcExit_LocalBuffers(void);
 
 #endif