lwlock: Invert meaning of LW_FLAG_RELEASE_OK
Andres Freund <andres@anarazel.de>
lwlock: Invert meaning of LW_FLAG_RELEASE_OK Previously, a flag was set to indicate that a lock release should wake up waiters. Since waking waiters is the default behavior in the majority of cases, this logic has been inverted. The new LW_FLAG_WAKE_IN_PROGRESS flag is now set iff wakeups are explicitly inhibited. The motivation for this change is that in an upcoming commit, content locks will be implemented independently of lwlocks, with the lock state stored as part of BufferDesc.state. As all of a buffer's flags are cleared when the buffer is invalidated, without this change we would have to re-add the RELEASE_OK flag after clearing the flags; otherwise, the next lock release would not wake waiters. It seems good to keep the implementation of lwlocks and buffer content locks as similar as reasonably possible. Reviewed-by: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/lmgr/lwlock.c | modified | +20 −22 |
Discussion
- Buffer locking is special (hints, checksums, AIO writes) 120 messages · 2025-08-22 → 2026-04-03