mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Collect built-in LWLock tranche names statically, not dynamically.
There is little point in using the LWLockRegisterTranche mechanism for built-in tranche names. It wastes cycles, it creates opportunities for bugs (since failing to register a tranche name is a very hard-to-detect problem), and the lack of any centralized list of names encourages sloppy nonconformity in name choices. Moreover, since we have a centralized list of the tranches anyway in enum BuiltinTrancheIds, we're certainly not buying any flexibility in return for these disadvantages. Hence, nuke all the backend-internal LWLockRegisterTranche calls, and instead provide a const array of the builtin tranche names. (I have in mind to change a bunch of these names shortly, but this patch is just about getting them into one place.) Discussion: https://postgr.es/m/9056.1589419765@sss.pgh.pa.us
This commit is contained in:
@@ -517,9 +517,6 @@ ReplicationOriginShmemInit(void)
|
||||
ConditionVariableInit(&replication_states[i].origin_cv);
|
||||
}
|
||||
}
|
||||
|
||||
LWLockRegisterTranche(replication_states_ctl->tranche_id,
|
||||
"replication_origin");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
|
@@ -140,9 +140,6 @@ ReplicationSlotsShmemInit(void)
|
||||
ShmemInitStruct("ReplicationSlot Ctl", ReplicationSlotsShmemSize(),
|
||||
&found);
|
||||
|
||||
LWLockRegisterTranche(LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS,
|
||||
"replication_slot_io");
|
||||
|
||||
if (!found)
|
||||
{
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user