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

Commit72d41d4

Browse files
ildusAlexander Korotkov
authored and
Alexander Korotkov
committed
Create lwlocks tranche for replication slots
1 parent89753d8 commit72d41d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/replication/slot.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ ReplicationSlotsShmemSize(void)
118118
size=add_size(size,
119119
mul_size(max_replication_slots,sizeof(ReplicationSlot)));
120120

121+
/* Replication Slots LWLock structures */
122+
size=add_size(size,LWLockTrancheShmemSize(max_replication_slots));
123+
121124
returnsize;
122125
}
123126

@@ -139,17 +142,22 @@ ReplicationSlotsShmemInit(void)
139142
if (!found)
140143
{
141144
inti;
145+
LWLockPadded*locks;
142146

143147
/* First time through, so initialize */
144148
MemSet(ReplicationSlotCtl,0,ReplicationSlotsShmemSize());
145149

150+
/* Create lwlocks tranche for replication slots */
151+
LWLockCreateTranche("ReplicationSlotLocks",max_replication_slots,
152+
&locks);
153+
146154
for (i=0;i<max_replication_slots;i++)
147155
{
148156
ReplicationSlot*slot=&ReplicationSlotCtl->replication_slots[i];
149157

150158
/* everything else is zeroed by the memset above */
151159
SpinLockInit(&slot->mutex);
152-
slot->io_in_progress_lock=LWLockAssign();
160+
slot->io_in_progress_lock=&locks[i].lock;
153161
}
154162
}
155163
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp