Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6ca7cd8

Browse files
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.
1 parent 0fa0b48 commit 6ca7cd8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,7 @@ LockBuffer(Buffer buffer, int mode)
37433743
{
37443744
BufferDesc *buf;
37453745

3746-
Assert(BufferIsValid(buffer));
3746+
Assert(BufferIsPinned(buffer));
37473747
if (BufferIsLocal(buffer))
37483748
return; /* local buffers need no lock */
37493749

@@ -3769,7 +3769,7 @@ ConditionalLockBuffer(Buffer buffer)
37693769
{
37703770
BufferDesc *buf;
37713771

3772-
Assert(BufferIsValid(buffer));
3772+
Assert(BufferIsPinned(buffer));
37733773
if (BufferIsLocal(buffer))
37743774
return true; /* act as though we got it */
37753775

@@ -3801,7 +3801,7 @@ LockBufferForCleanup(Buffer buffer)
38013801
BufferDesc *bufHdr;
38023802
char *new_status = NULL;
38033803

3804-
Assert(BufferIsValid(buffer));
3804+
Assert(BufferIsPinned(buffer));
38053805
Assert(PinCountWaitBuf == NULL);
38063806

38073807
if (BufferIsLocal(buffer))

0 commit comments

Comments
 (0)