Skip to content

Commit a29f6c0

Browse files
committed
Make the found-a-buffer-when-we-were-expecting-to-extend-the-rel path
actually work. It had been throwing an Assert as of my recent changes to bufmgr.c, but was not really right even before that AFAICT.
1 parent 109d50d commit a29f6c0

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.114 2001/06/29 21:08:24 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.115 2001/07/02 18:47:18 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -198,13 +198,22 @@ ReadBufferInternal(Relation reln, BlockNumber blockNum,
198198
/* if it's already in the buffer pool, we're done */
199199
if (found)
200200
{
201-
/*
202-
* Could have found && isExtend if a buffer was already created for
203-
* the next page position, but then smgrextend failed to write
204-
* the page. Must fall through and try to extend file again.
205-
*/
201+
/* That is, we're done if we expected to be able to find it ... */
206202
if (!isExtend)
207203
return BufferDescriptorGetBuffer(bufHdr);
204+
/*
205+
* If we found a buffer when we were expecting to extend the relation,
206+
* the implication is that a buffer was already created for the next
207+
* page position, but then smgrextend failed to write the page.
208+
* We'd better try the smgrextend again. But since BufferAlloc
209+
* won't have done StartBufferIO, we must do that first.
210+
*/
211+
if (!isLocalBuf)
212+
{
213+
SpinAcquire(BufMgrLock);
214+
StartBufferIO(bufHdr, false);
215+
SpinRelease(BufMgrLock);
216+
}
208217
}
209218

210219
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy