Content-Length: 300987 | pFad | http://github.com/postgrespro/postgres/commit/72d41d4c5b26c97b5362ce6eea6158e65a2dd2fc

E6 Create lwlocks tranche for replication slots · postgrespro/postgres@72d41d4 · GitHub
Skip to content

Commit 72d41d4

Browse files
ildusAlexander Korotkov
authored andcommitted
Create lwlocks tranche for replication slots
1 parent 89753d8 commit 72d41d4

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
return size;
122125
}
123126

@@ -139,17 +142,22 @@ ReplicationSlotsShmemInit(void)
139142
if (!found)
140143
{
141144
int i;
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/72d41d4c5b26c97b5362ce6eea6158e65a2dd2fc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy