Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit afb66ad

Browse files
committed
Need to release buffer pins before attempting to drop files during
backend exit. Per report from Bruce.
1 parent 7a969ca commit afb66ad

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/backend/utils/init/postinit.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.141 2005/02/26 18:43:33 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.142 2005/03/18 05:24:13 tgl Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -507,13 +507,14 @@ ShutdownPostgres(int code, Datum arg)
507507
* since that just raises the odds of failure --- but there's some
508508
* stuff we need to do.
509509
*
510-
* Release any LW locks and buffer context locks we might be holding.
511-
* This is a kluge to improve the odds that we won't get into a
512-
* self-made stuck-lock scenario while trying to shut down.
510+
* Release any LW locks, buffer content locks, and buffer pins we might be
511+
* holding. This is a kluge to improve the odds that we won't get into a
512+
* self-made stuck-lock scenario while trying to shut down. We *must*
513+
* release buffer pins to make it safe to do file deletion, since we
514+
* might have some pins on pages of the target files.
513515
*/
514516
LWLockReleaseAll();
515-
AbortBufferIO();
516-
UnlockBuffers();
517+
AtProcExit_Buffers();
517518

518519
/*
519520
* In case a transaction is open, delete any files it created. This

0 commit comments

Comments
 (0)