summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlexander Korotkov2024-04-06 21:31:43 +0000
committerAlexander Korotkov2024-04-06 21:49:53 +0000
commit25f42429e2ff2acca35c9154fc2e36b75c79227a (patch)
treea007e1ef361c34cef94c12d8e49bb2e3a2966928 /src/include
parent1577081e9614345534a018e788a2c0bab4da4dc5 (diff)
Use an LWLock instead of a spinlock in waitlsn.c
This should prevent busy-waiting when number of waiting processes is high. Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql Author: Alvaro Herrera
Diffstat (limited to 'src/include')
-rw-r--r--src/include/commands/waitlsn.h5
-rw-r--r--src/include/storage/lwlocklist.h1
2 files changed, 2 insertions, 4 deletions
diff --git a/src/include/commands/waitlsn.h b/src/include/commands/waitlsn.h
index 0d80248682c..b3d9eed64d8 100644
--- a/src/include/commands/waitlsn.h
+++ b/src/include/commands/waitlsn.h
@@ -55,13 +55,10 @@ typedef struct WaitLSNState
/*
* A pairing heap of waiting processes order by LSN values (least LSN is
- * on top).
+ * on top). Protected by WaitLSNLock.
*/
pairingheap waitersHeap;
- /* A mutex protecting the pairing heap above */
- slock_t waitersHeapMutex;
-
/* An array with per-process information, indexed by the process number */
WaitLSNProcInfo procInfos[FLEXIBLE_ARRAY_MEMBER];
} WaitLSNState;
diff --git a/src/include/storage/lwlocklist.h b/src/include/storage/lwlocklist.h
index 85f6568b9e4..c2bab5a794e 100644
--- a/src/include/storage/lwlocklist.h
+++ b/src/include/storage/lwlocklist.h
@@ -83,3 +83,4 @@ PG_LWLOCK(49, WALSummarizer)
PG_LWLOCK(50, DSMRegistry)
PG_LWLOCK(51, InjectionPoint)
PG_LWLOCK(52, SerialControl)
+PG_LWLOCK(53, WaitLSN)