bool result;
PrivateRefCountEntry *ref;
+ Assert(!BufferIsLocal(b));
+
ref = GetPrivateRefCountEntry(b, true);
if (ref == NULL)
PrivateRefCountEntry *ref;
Buffer b = BufferDescriptorGetBuffer(buf);
+ Assert(!BufferIsLocal(b));
+
/* not moving as we're likely deleting it soon anyway */
ref = GetPrivateRefCountEntry(b, false);
Assert(ref != NULL);
LW_EXCLUSIVE);
}
+void
+BufferCheckOneLocalPin(Buffer buffer)
+{
+ if (BufferIsLocal(buffer))
+ {
+ /* There should be exactly one pin */
+ if (LocalRefCount[-buffer - 1] != 1)
+ elog(ERROR, "incorrect local pin count: %d",
+ LocalRefCount[-buffer - 1]);
+ }
+ else
+ {
+ /* There should be exactly one local pin */
+ if (GetPrivateRefCount(buffer) != 1)
+ elog(ERROR, "incorrect local pin count: %d",
+ GetPrivateRefCount(buffer));
+ }
+}
+
/*
* LockBufferForCleanup - lock a buffer in preparation for deleting items
*
Assert(BufferIsPinned(buffer));
Assert(PinCountWaitBuf == NULL);
+ BufferCheckOneLocalPin(buffer);
+
+ /* Nobody else to wait for */
if (BufferIsLocal(buffer))
- {
- /* There should be exactly one pin */
- if (LocalRefCount[-buffer - 1] != 1)
- elog(ERROR, "incorrect local pin count: %d",
- LocalRefCount[-buffer - 1]);
- /* Nobody else to wait for */
return;
- }
-
- /* There should be exactly one local pin */
- if (GetPrivateRefCount(buffer) != 1)
- elog(ERROR, "incorrect local pin count: %d",
- GetPrivateRefCount(buffer));
bufHdr = GetBufferDescriptor(buffer - 1);
SpinDelayStatus delayStatus;
uint32 old_buf_state;
+ Assert(!BufferIsLocal(BufferDescriptorGetBuffer(desc)));
+
init_local_spin_delay(&delayStatus);
while (true)