aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2020-07-20 16:03:38 -0700
committerPeter Geoghegan <pg@bowt.ie>2020-07-20 16:03:38 -0700
commit6ca7cd89a2d1998b16e8168dda62d43a9e0fdaff (patch)
tree07c4d5a67fe43446af44061293a865a4770aff07 /src
parent0fa0b487b5d75d2b8576dec86a317212542642b8 (diff)
downloadpostgresql-6ca7cd89a2d1998b16e8168dda62d43a9e0fdaff.tar.gz
postgresql-6ca7cd89a2d1998b16e8168dda62d43a9e0fdaff.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/buffer/bufmgr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 83d91b14fb1..9b9303ff650 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -3743,7 +3743,7 @@ LockBuffer(Buffer buffer, int mode)
{
BufferDesc *buf;
- Assert(BufferIsValid(buffer));
+ Assert(BufferIsPinned(buffer));
if (BufferIsLocal(buffer))
return; /* local buffers need no lock */
@@ -3769,7 +3769,7 @@ ConditionalLockBuffer(Buffer buffer)
{
BufferDesc *buf;
- Assert(BufferIsValid(buffer));
+ Assert(BufferIsPinned(buffer));
if (BufferIsLocal(buffer))
return true; /* act as though we got it */
@@ -3801,7 +3801,7 @@ LockBufferForCleanup(Buffer buffer)
BufferDesc *bufHdr;
char *new_status = NULL;
- Assert(BufferIsValid(buffer));
+ Assert(BufferIsPinned(buffer));
Assert(PinCountWaitBuf == NULL);
if (BufferIsLocal(buffer))