summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiko Sawada <msawada@postgresql.org>2025-08-28 17:06:42 -0700
committerMasahiko Sawada <msawada@postgresql.org>2025-08-28 17:06:42 -0700
commitfabd8b8e2a72bac9e5a361856a355bd5bb2e61b8 (patch)
tree4773a24c6affe21a0c0e548a60e24e921de75ace
parentb8a1bdc458e3e81898a1fe3d26188bc1dcbac965 (diff)
Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock where possible.HEADorigin/masterorigin/HEADmaster
Previously, we used LW_EXCLUSIVE in several places despite only reading WalSummarizerCtl fields. This patch reduces the lock level to LW_SHARED where we are only reading the shared fields. Backpatch to 17, where wal summarization was introduced. Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/CAD21AoDdKhf_9oriEYxY-JCdF+Oe_muhca3pcdkMEdBMzyHyKw@mail.gmail.com Backpatch-through: 17
-rw-r--r--src/backend/postmaster/walsummarizer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c
index 777c9a8d555..e1f142f20c7 100644
--- a/src/backend/postmaster/walsummarizer.c
+++ b/src/backend/postmaster/walsummarizer.c
@@ -644,7 +644,7 @@ WakeupWalSummarizer(void)
if (WalSummarizerCtl == NULL)
return;
- LWLockAcquire(WALSummarizerLock, LW_EXCLUSIVE);
+ LWLockAcquire(WALSummarizerLock, LW_SHARED);
pgprocno = WalSummarizerCtl->summarizer_pgprocno;
LWLockRelease(WALSummarizerLock);
@@ -685,7 +685,7 @@ WaitForWalSummarization(XLogRecPtr lsn)
/*
* If the LSN summarized on disk has reached the target value, stop.
*/
- LWLockAcquire(WALSummarizerLock, LW_EXCLUSIVE);
+ LWLockAcquire(WALSummarizerLock, LW_SHARED);
summarized_lsn = WalSummarizerCtl->summarized_lsn;
pending_lsn = WalSummarizerCtl->pending_lsn;
LWLockRelease(WALSummarizerLock);