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

Commit77cf6a7

Browse files
committed
Add some asserts based on LWLockHeldByMe() for replication slot statistics
Two assertions checking that ReplicationSlotAllocationLock is acquiredare added to pgstat_create_replslot() and pgstat_drop_replslot(),corresponding to the routines in charge of the creation and the drop ofreplication slot statistics. The code previously relied on thisassumption and documented it in comments, but did not enforce thispolicy at runtime.Reviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/Ze_p-hmD_yFeVYXg@paquier.xyz
1 parent32dd2c1 commit77cf6a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/utils/activity/pgstat_replslot.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ pgstat_create_replslot(ReplicationSlot *slot)
113113
PgStat_EntryRef*entry_ref;
114114
PgStatShared_ReplSlot*shstatent;
115115

116+
Assert(LWLockHeldByMeInMode(ReplicationSlotAllocationLock,LW_EXCLUSIVE));
117+
116118
entry_ref=pgstat_get_entry_ref_locked(PGSTAT_KIND_REPLSLOT,InvalidOid,
117119
ReplicationSlotIndex(slot), false);
118120
shstatent= (PgStatShared_ReplSlot*)entry_ref->shared_stats;
@@ -153,6 +155,8 @@ pgstat_acquire_replslot(ReplicationSlot *slot)
153155
void
154156
pgstat_drop_replslot(ReplicationSlot*slot)
155157
{
158+
Assert(LWLockHeldByMeInMode(ReplicationSlotAllocationLock,LW_EXCLUSIVE));
159+
156160
pgstat_drop_entry(PGSTAT_KIND_REPLSLOT,InvalidOid,
157161
ReplicationSlotIndex(slot));
158162
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp