Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8ed4cc

Browse files
committed
Calculate # of semaphores correctly with --disable-spinlocks.
The old formula didn't take into account that each WAL sender process needsa spinlock. We had also already exceeded the fixed number of spinlocksreserved for misc purposes (10). Bump that to 30.Backpatch to 9.0, where WAL senders were introduced. If I counted correctly,9.0 had exactly 10 predefined spinlocks, and 9.1 exceeded that, but bump thelimit in 9.0 too because 10 is uncomfortably close to the edge.
1 parentf7b0006 commitb8ed4cc

File tree

1 file changed

+11
-3
lines changed
  • src/backend/storage/lmgr

1 file changed

+11
-3
lines changed

‎src/backend/storage/lmgr/spin.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include"postgres.h"
2424

2525
#include"miscadmin.h"
26+
#include"replication/walsender.h"
2627
#include"storage/lwlock.h"
2728
#include"storage/spin.h"
2829

@@ -50,14 +51,21 @@ SpinlockSemas(void)
5051
int
5152
SpinlockSemas(void)
5253
{
54+
intnsemas;
55+
5356
/*
5457
* It would be cleaner to distribute this logic into the affected modules,
5558
* similar to the way shmem space estimation is handled.
5659
*
57-
* For now, though,we just need a fewspinlocks(10 should be plenty)
58-
*plus one for each LWLock and one for each buffer header.
60+
* For now, though,there are few enough users ofspinlocksthat we just
61+
*keep the knowledge here.
5962
*/
60-
returnNumLWLocks()+NBuffers+10;
63+
nsemas=NumLWLocks();/* one for each lwlock */
64+
nsemas+=NBuffers;/* one for each buffer header */
65+
nsemas+=max_wal_senders;/* one for each wal sender process */
66+
nsemas+=30;/* plus a bunch for other small-scale use */
67+
68+
returnnsemas;
6169
}
6270

6371
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp