]> git.ipfire.org Git - thirdparty/postgresql.git/commit
lwlock: Invert meaning of LW_FLAG_RELEASE_OK
authorAndres Freund <andres@anarazel.de>
Wed, 14 Jan 2026 00:38:29 +0000 (19:38 -0500)
committerAndres Freund <andres@anarazel.de>
Wed, 14 Jan 2026 00:38:29 +0000 (19:38 -0500)
commit9a385f61666c426f595a953499d5dc9c6e142c9a
tree1c48eb7228675f5614c2755b1bbce6d298afbf36
parente217dc7484e5e46f4b9bcef1e1bb03acc4a1834a
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
src/backend/storage/lmgr/lwlock.c