MCPcopy Create free account
hub / github.com/apache/cloudberry / ConditionalLockBuffer

Function ConditionalLockBuffer

src/backend/storage/buffer/bufmgr.c:4315–4327  ·  view source on GitHub ↗

* Acquire the content_lock for the buffer, but only if we don't have to wait. * * This assumes the caller wants BUFFER_LOCK_EXCLUSIVE mode. */

Source from the content-addressed store, hash-verified

4313 * This assumes the caller wants BUFFER_LOCK_EXCLUSIVE mode.
4314 */
4315bool
4316ConditionalLockBuffer(Buffer buffer)
4317{
4318 BufferDesc *buf;
4319
4320 Assert(BufferIsPinned(buffer));
4321 if (BufferIsLocal(buffer))
4322 return true; /* act as though we got it */
4323
4324 buf = GetBufferDescriptor(buffer - 1);
4325
4326 return ConditionalAcquireContentLock(buf, LW_EXCLUSIVE);
4327}
4328
4329/*
4330 * LockBufferForCleanup - lock a buffer in preparation for deleting items

Callers 10

BloomNewBufferFunction · 0.85
SpGistNewBufferFunction · 0.85
SpGistUpdateMetaPageFunction · 0.85
SpGistGetBufferFunction · 0.85
spgdoinsertFunction · 0.85
GinNewBufferFunction · 0.85
gistNewBufferFunction · 0.85
_bt_conditionallockbufFunction · 0.85

Calls 1

Tested by

no test coverage detected