1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Repair potential deadlock created by recent changes to recycle btree

index pages: when _bt_getbuf asks the FSM for a free index page, it is
possible (and, in some cases, even moderately likely) that the answer
will be the same page that _bt_split is trying to split.  _bt_getbuf
already knew that the returned page might not be free, but it wasn't
prepared for the possibility that even trying to lock the page could
be problematic.  Fix by doing a conditional rather than unconditional
grab of the page lock.
This commit is contained in:
Tom Lane
2003-08-10 19:48:08 +00:00
parent 18c10877a9
commit ffafacc1f6
3 changed files with 67 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: bufmgr.h,v 1.69 2003/08/04 02:40:14 momjian Exp $
* $Id: bufmgr.h,v 1.70 2003/08/10 19:48:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -180,6 +180,7 @@ extern void SetBufferCommitInfoNeedsSave(Buffer buffer);
extern void UnlockBuffers(void);
extern void LockBuffer(Buffer buffer, int mode);
extern bool ConditionalLockBuffer(Buffer buffer);
extern void LockBufferForCleanup(Buffer buffer);
extern void AbortBufferIO(void);