1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Add debug check function LWLockHeldByMeInMode()

Tests whether my process holds a lock in given mode.
Add initial usage in MarkBufferDirty().

Thomas Munro
This commit is contained in:
Simon Riggs
2016-09-05 10:38:08 +01:00
parent ec03f4121c
commit 016abf1fb8
3 changed files with 23 additions and 5 deletions

View File

@ -1460,8 +1460,8 @@ MarkBufferDirty(Buffer buffer)
bufHdr = GetBufferDescriptor(buffer - 1);
Assert(BufferIsPinned(buffer));
/* unfortunately we can't check if the lock is held exclusively */
Assert(LWLockHeldByMe(BufferDescriptorGetContentLock(bufHdr)));
Assert(LWLockHeldByMeInMode(BufferDescriptorGetContentLock(bufHdr),
LW_EXCLUSIVE));
old_buf_state = pg_atomic_read_u32(&bufHdr->state);
for (;;)