diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-07-26 12:06:04 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-07-26 12:06:04 +0900 |
commit | 66d86d4201b3a4b05c6d7d1bf827d4b17aa44a06 (patch) | |
tree | 4f0ed804218279e2d0a4be7d877e4eeb42f18ad3 /src/backend/utils/adt/json.c | |
parent | 62e9af4c63fbd36fb9af8450fb44bece76d7766f (diff) | |
download | postgresql-66d86d4201b3a4b05c6d7d1bf827d4b17aa44a06.tar.gz postgresql-66d86d4201b3a4b05c6d7d1bf827d4b17aa44a06.zip |
Document more assumptions of LWLock variable changes with WAL inserts
This commit adds a few comments about what LWLockWaitForVar() relies on
when a backend waits for a variable update on its LWLocks for WAL
insertions up to an expected LSN.
First, LWLockWaitForVar() does not include a memory barrier, relying on
a spinlock taken at the beginning of WaitXLogInsertionsToFinish(). This
was hidden behind two layers of routines in lwlock.c. This assumption
is now documented at the top of LWLockWaitForVar(), and detailed at bit
more within LWLockConflictsWithVar().
Second, document why WaitXLogInsertionsToFinish() does not include
memory barriers, relying on a spinlock at its top, which is, per Andres'
input, fine for two different reasons, both depending on the fact that
the caller of WaitXLogInsertionsToFinish() is waiting for a LSN up to a
certain value.
This area's documentation and assumptions could be improved more in the
future, but at least that's a beginning.
Author: Bharath Rupireddy, Andres Freund
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/CALj2ACVF+6jLvqKe6xhDzCCkr=rfd6upaGc3477Pji1Ke9G7Bg@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/json.c')
0 files changed, 0 insertions, 0 deletions