diff options
author | Tom Lane | 2001-07-02 18:47:18 +0000 |
---|---|---|
committer | Tom Lane | 2001-07-02 18:47:18 +0000 |
commit | a29f6c095cf1d4e9a09df796c8df4b0f72fa1220 (patch) | |
tree | 171ca2881885ff5277392d1400f1feea13cbcabe | |
parent | 109d50dd35db93a9d6c50bcbe2481518c3789829 (diff) |
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.
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 85afa46ce3b..6090e729c04 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.114 2001/06/29 21:08:24 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.115 2001/07/02 18:47:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -198,13 +198,22 @@ ReadBufferInternal(Relation reln, BlockNumber blockNum, /* if it's already in the buffer pool, we're done */ if (found) { - /* - * Could have found && isExtend if a buffer was already created for - * the next page position, but then smgrextend failed to write - * the page. Must fall through and try to extend file again. - */ + /* That is, we're done if we expected to be able to find it ... */ if (!isExtend) return BufferDescriptorGetBuffer(bufHdr); + /* + * If we found a buffer when we were expecting to extend the relation, + * the implication is that a buffer was already created for the next + * page position, but then smgrextend failed to write the page. + * We'd better try the smgrextend again. But since BufferAlloc + * won't have done StartBufferIO, we must do that first. + */ + if (!isLocalBuf) + { + SpinAcquire(BufMgrLock); + StartBufferIO(bufHdr, false); + SpinRelease(BufMgrLock); + } } /* |