Commit 6ca7cd89 authored by Peter Geoghegan's avatar Peter Geoghegan

Assert that buffer is pinned in LockBuffer().

Strengthen the LockBuffer() assertion that verifies BufferIsValid() by
making it verify BufferIsPinned() instead.  Do the same in nearby
related functions.

There is probably not much chance that anybody will try to lock a buffer
that is not already pinned, but we might as well make sure of that.
parent 0fa0b487
...@@ -3743,7 +3743,7 @@ LockBuffer(Buffer buffer, int mode) ...@@ -3743,7 +3743,7 @@ LockBuffer(Buffer buffer, int mode)
{ {
BufferDesc *buf; BufferDesc *buf;
Assert(BufferIsValid(buffer)); Assert(BufferIsPinned(buffer));
if (BufferIsLocal(buffer)) if (BufferIsLocal(buffer))
return; /* local buffers need no lock */ return; /* local buffers need no lock */
...@@ -3769,7 +3769,7 @@ ConditionalLockBuffer(Buffer buffer) ...@@ -3769,7 +3769,7 @@ ConditionalLockBuffer(Buffer buffer)
{ {
BufferDesc *buf; BufferDesc *buf;
Assert(BufferIsValid(buffer)); Assert(BufferIsPinned(buffer));
if (BufferIsLocal(buffer)) if (BufferIsLocal(buffer))
return true; /* act as though we got it */ return true; /* act as though we got it */
...@@ -3801,7 +3801,7 @@ LockBufferForCleanup(Buffer buffer) ...@@ -3801,7 +3801,7 @@ LockBufferForCleanup(Buffer buffer)
BufferDesc *bufHdr; BufferDesc *bufHdr;
char *new_status = NULL; char *new_status = NULL;
Assert(BufferIsValid(buffer)); Assert(BufferIsPinned(buffer));
Assert(PinCountWaitBuf == NULL); Assert(PinCountWaitBuf == NULL);
if (BufferIsLocal(buffer)) if (BufferIsLocal(buffer))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment