mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 00:02:00 -04:00
Improve notation of BuiltinTrancheNames
Use C99 designated initializer syntax for array elements, instead of writing the position in a comment. This is less verbose and much more readable. Akin to cc150596341e. One disadvantage is that the BuiltinTrancheNames array now has a hole of 51 NULLs -- previously, the array elements were shifted 51 elements downward to avoid this. This can be fixed by merging the IndividualLWLockNames array into BuiltinTrancheNames, which would occupy those 51 pointers, but because it requires some arguably ugly Meson hackery, it's left for later. Discussion: https://postgr.es/m/202401231025.gbv4nnte5fmm@alvherre.pgsql
This commit is contained in:
parent
94edfe250c
commit
74a7306310
@ -132,72 +132,41 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
|
||||
extern const char *const IndividualLWLockNames[]; /* in lwlocknames.c */
|
||||
|
||||
static const char *const BuiltinTrancheNames[] = {
|
||||
/* LWTRANCHE_XACT_BUFFER: */
|
||||
"XactBuffer",
|
||||
/* LWTRANCHE_COMMITTS_BUFFER: */
|
||||
"CommitTsBuffer",
|
||||
/* LWTRANCHE_SUBTRANS_BUFFER: */
|
||||
"SubtransBuffer",
|
||||
/* LWTRANCHE_MULTIXACTOFFSET_BUFFER: */
|
||||
"MultiXactOffsetBuffer",
|
||||
/* LWTRANCHE_MULTIXACTMEMBER_BUFFER: */
|
||||
"MultiXactMemberBuffer",
|
||||
/* LWTRANCHE_NOTIFY_BUFFER: */
|
||||
"NotifyBuffer",
|
||||
/* LWTRANCHE_SERIAL_BUFFER: */
|
||||
"SerialBuffer",
|
||||
/* LWTRANCHE_WAL_INSERT: */
|
||||
"WALInsert",
|
||||
/* LWTRANCHE_BUFFER_CONTENT: */
|
||||
"BufferContent",
|
||||
/* LWTRANCHE_REPLICATION_ORIGIN_STATE: */
|
||||
"ReplicationOriginState",
|
||||
/* LWTRANCHE_REPLICATION_SLOT_IO: */
|
||||
"ReplicationSlotIO",
|
||||
/* LWTRANCHE_LOCK_FASTPATH: */
|
||||
"LockFastPath",
|
||||
/* LWTRANCHE_BUFFER_MAPPING: */
|
||||
"BufferMapping",
|
||||
/* LWTRANCHE_LOCK_MANAGER: */
|
||||
"LockManager",
|
||||
/* LWTRANCHE_PREDICATE_LOCK_MANAGER: */
|
||||
"PredicateLockManager",
|
||||
/* LWTRANCHE_PARALLEL_HASH_JOIN: */
|
||||
"ParallelHashJoin",
|
||||
/* LWTRANCHE_PARALLEL_QUERY_DSA: */
|
||||
"ParallelQueryDSA",
|
||||
/* LWTRANCHE_PER_SESSION_DSA: */
|
||||
"PerSessionDSA",
|
||||
/* LWTRANCHE_PER_SESSION_RECORD_TYPE: */
|
||||
"PerSessionRecordType",
|
||||
/* LWTRANCHE_PER_SESSION_RECORD_TYPMOD: */
|
||||
"PerSessionRecordTypmod",
|
||||
/* LWTRANCHE_SHARED_TUPLESTORE: */
|
||||
"SharedTupleStore",
|
||||
/* LWTRANCHE_SHARED_TIDBITMAP: */
|
||||
"SharedTidBitmap",
|
||||
/* LWTRANCHE_PARALLEL_APPEND: */
|
||||
"ParallelAppend",
|
||||
/* LWTRANCHE_PER_XACT_PREDICATE_LIST: */
|
||||
"PerXactPredicateList",
|
||||
/* LWTRANCHE_PGSTATS_DSA: */
|
||||
"PgStatsDSA",
|
||||
/* LWTRANCHE_PGSTATS_HASH: */
|
||||
"PgStatsHash",
|
||||
/* LWTRANCHE_PGSTATS_DATA: */
|
||||
"PgStatsData",
|
||||
/* LWTRANCHE_LAUNCHER_DSA: */
|
||||
"LogicalRepLauncherDSA",
|
||||
/* LWTRANCHE_LAUNCHER_HASH: */
|
||||
"LogicalRepLauncherHash",
|
||||
/* LWTRANCHE_DSM_REGISTRY_DSA: */
|
||||
"DSMRegistryDSA",
|
||||
/* LWTRANCHE_DSM_REGISTRY_HASH: */
|
||||
"DSMRegistryHash",
|
||||
[LWTRANCHE_XACT_BUFFER] = "XactBuffer",
|
||||
[LWTRANCHE_COMMITTS_BUFFER] = "CommitTsBuffer",
|
||||
[LWTRANCHE_SUBTRANS_BUFFER] = "SubtransBuffer",
|
||||
[LWTRANCHE_MULTIXACTOFFSET_BUFFER] = "MultiXactOffsetBuffer",
|
||||
[LWTRANCHE_MULTIXACTMEMBER_BUFFER] = "MultiXactMemberBuffer",
|
||||
[LWTRANCHE_NOTIFY_BUFFER] = "NotifyBuffer",
|
||||
[LWTRANCHE_SERIAL_BUFFER] = "SerialBuffer",
|
||||
[LWTRANCHE_WAL_INSERT] = "WALInsert",
|
||||
[LWTRANCHE_BUFFER_CONTENT] = "BufferContent",
|
||||
[LWTRANCHE_REPLICATION_ORIGIN_STATE] = "ReplicationOriginState",
|
||||
[LWTRANCHE_REPLICATION_SLOT_IO] = "ReplicationSlotIO",
|
||||
[LWTRANCHE_LOCK_FASTPATH] = "LockFastPath",
|
||||
[LWTRANCHE_BUFFER_MAPPING] = "BufferMapping",
|
||||
[LWTRANCHE_LOCK_MANAGER] = "LockManager",
|
||||
[LWTRANCHE_PREDICATE_LOCK_MANAGER] = "PredicateLockManager",
|
||||
[LWTRANCHE_PARALLEL_HASH_JOIN] = "ParallelHashJoin",
|
||||
[LWTRANCHE_PARALLEL_QUERY_DSA] = "ParallelQueryDSA",
|
||||
[LWTRANCHE_PER_SESSION_DSA] = "PerSessionDSA",
|
||||
[LWTRANCHE_PER_SESSION_RECORD_TYPE] = "PerSessionRecordType",
|
||||
[LWTRANCHE_PER_SESSION_RECORD_TYPMOD] = "PerSessionRecordTypmod",
|
||||
[LWTRANCHE_SHARED_TUPLESTORE] = "SharedTupleStore",
|
||||
[LWTRANCHE_SHARED_TIDBITMAP] = "SharedTidBitmap",
|
||||
[LWTRANCHE_PARALLEL_APPEND] = "ParallelAppend",
|
||||
[LWTRANCHE_PER_XACT_PREDICATE_LIST] = "PerXactPredicateList",
|
||||
[LWTRANCHE_PGSTATS_DSA] = "PgStatsDSA",
|
||||
[LWTRANCHE_PGSTATS_HASH] = "PgStatsHash",
|
||||
[LWTRANCHE_PGSTATS_DATA] = "PgStatsData",
|
||||
[LWTRANCHE_LAUNCHER_DSA] = "LogicalRepLauncherDSA",
|
||||
[LWTRANCHE_LAUNCHER_HASH] = "LogicalRepLauncherHash",
|
||||
[LWTRANCHE_DSM_REGISTRY_DSA] = "DSMRegistryDSA",
|
||||
[LWTRANCHE_DSM_REGISTRY_HASH] = "DSMRegistryHash",
|
||||
};
|
||||
|
||||
StaticAssertDecl(lengthof(BuiltinTrancheNames) ==
|
||||
LWTRANCHE_FIRST_USER_DEFINED - NUM_INDIVIDUAL_LWLOCKS,
|
||||
LWTRANCHE_FIRST_USER_DEFINED,
|
||||
"missing entries in BuiltinTrancheNames[]");
|
||||
|
||||
/*
|
||||
@ -775,7 +744,7 @@ GetLWTrancheName(uint16 trancheId)
|
||||
|
||||
/* Built-in tranche? */
|
||||
if (trancheId < LWTRANCHE_FIRST_USER_DEFINED)
|
||||
return BuiltinTrancheNames[trancheId - NUM_INDIVIDUAL_LWLOCKS];
|
||||
return BuiltinTrancheNames[trancheId];
|
||||
|
||||
/*
|
||||
* It's an extension tranche, so look in LWLockTrancheNames[]. However,
|
||||
|
Loading…
x
Reference in New Issue
Block a user