]> granicus.if.org Git - postgresql/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:09 +0000 (16:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 18 Mar 2005 16:16:09 +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 f52ed71cd8bb1c30b783ebf0a330936972547af6..eb6db2447a87b15d3a8ddb609f66b51edcb806ae 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.63 2005/03/04 20:21:06 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.64 2005/03/18 16:16:09 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -259,3 +259,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 901053f18392b067190a0fd65361f4b0396246cd..05f669c2ccdabaf70a4efdb80bab993063398289 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.142 2005/03/18 05:24:13 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.143 2005/03/18 16:16:09 tgl Exp $
  *
  *
  *-------------------------------------------------------------------------
@@ -515,6 +515,7 @@ ShutdownPostgres(int code, Datum arg)
         */
        LWLockReleaseAll();
        AtProcExit_Buffers();
+       AtProcExit_LocalBuffers();
 
        /*
         * In case a transaction is open, delete any files it created.  This
index 5fb706f59587384d0cdd3ca62ffde1d5be41cd38..9268335b02689c47aa6fa54061cb96249a6af49d 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.90 2005/03/04 20:21:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.91 2005/03/18 16:16:09 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -158,6 +158,7 @@ extern void BufferSync(void);
 extern void BgBufferSync(void);
 
 extern void InitLocalBuffer(void);
+extern void AtProcExit_LocalBuffers(void);
 
 /* in freelist.c */
 extern void StrategyHintVacuum(bool vacuum_active);