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 cc15059634
.
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 */
|
extern const char *const IndividualLWLockNames[]; /* in lwlocknames.c */
|
||||||
|
|
||||||
static const char *const BuiltinTrancheNames[] = {
|
static const char *const BuiltinTrancheNames[] = {
|
||||||
/* LWTRANCHE_XACT_BUFFER: */
|
[LWTRANCHE_XACT_BUFFER] = "XactBuffer",
|
||||||
"XactBuffer",
|
[LWTRANCHE_COMMITTS_BUFFER] = "CommitTsBuffer",
|
||||||
/* LWTRANCHE_COMMITTS_BUFFER: */
|
[LWTRANCHE_SUBTRANS_BUFFER] = "SubtransBuffer",
|
||||||
"CommitTsBuffer",
|
[LWTRANCHE_MULTIXACTOFFSET_BUFFER] = "MultiXactOffsetBuffer",
|
||||||
/* LWTRANCHE_SUBTRANS_BUFFER: */
|
[LWTRANCHE_MULTIXACTMEMBER_BUFFER] = "MultiXactMemberBuffer",
|
||||||
"SubtransBuffer",
|
[LWTRANCHE_NOTIFY_BUFFER] = "NotifyBuffer",
|
||||||
/* LWTRANCHE_MULTIXACTOFFSET_BUFFER: */
|
[LWTRANCHE_SERIAL_BUFFER] = "SerialBuffer",
|
||||||
"MultiXactOffsetBuffer",
|
[LWTRANCHE_WAL_INSERT] = "WALInsert",
|
||||||
/* LWTRANCHE_MULTIXACTMEMBER_BUFFER: */
|
[LWTRANCHE_BUFFER_CONTENT] = "BufferContent",
|
||||||
"MultiXactMemberBuffer",
|
[LWTRANCHE_REPLICATION_ORIGIN_STATE] = "ReplicationOriginState",
|
||||||
/* LWTRANCHE_NOTIFY_BUFFER: */
|
[LWTRANCHE_REPLICATION_SLOT_IO] = "ReplicationSlotIO",
|
||||||
"NotifyBuffer",
|
[LWTRANCHE_LOCK_FASTPATH] = "LockFastPath",
|
||||||
/* LWTRANCHE_SERIAL_BUFFER: */
|
[LWTRANCHE_BUFFER_MAPPING] = "BufferMapping",
|
||||||
"SerialBuffer",
|
[LWTRANCHE_LOCK_MANAGER] = "LockManager",
|
||||||
/* LWTRANCHE_WAL_INSERT: */
|
[LWTRANCHE_PREDICATE_LOCK_MANAGER] = "PredicateLockManager",
|
||||||
"WALInsert",
|
[LWTRANCHE_PARALLEL_HASH_JOIN] = "ParallelHashJoin",
|
||||||
/* LWTRANCHE_BUFFER_CONTENT: */
|
[LWTRANCHE_PARALLEL_QUERY_DSA] = "ParallelQueryDSA",
|
||||||
"BufferContent",
|
[LWTRANCHE_PER_SESSION_DSA] = "PerSessionDSA",
|
||||||
/* LWTRANCHE_REPLICATION_ORIGIN_STATE: */
|
[LWTRANCHE_PER_SESSION_RECORD_TYPE] = "PerSessionRecordType",
|
||||||
"ReplicationOriginState",
|
[LWTRANCHE_PER_SESSION_RECORD_TYPMOD] = "PerSessionRecordTypmod",
|
||||||
/* LWTRANCHE_REPLICATION_SLOT_IO: */
|
[LWTRANCHE_SHARED_TUPLESTORE] = "SharedTupleStore",
|
||||||
"ReplicationSlotIO",
|
[LWTRANCHE_SHARED_TIDBITMAP] = "SharedTidBitmap",
|
||||||
/* LWTRANCHE_LOCK_FASTPATH: */
|
[LWTRANCHE_PARALLEL_APPEND] = "ParallelAppend",
|
||||||
"LockFastPath",
|
[LWTRANCHE_PER_XACT_PREDICATE_LIST] = "PerXactPredicateList",
|
||||||
/* LWTRANCHE_BUFFER_MAPPING: */
|
[LWTRANCHE_PGSTATS_DSA] = "PgStatsDSA",
|
||||||
"BufferMapping",
|
[LWTRANCHE_PGSTATS_HASH] = "PgStatsHash",
|
||||||
/* LWTRANCHE_LOCK_MANAGER: */
|
[LWTRANCHE_PGSTATS_DATA] = "PgStatsData",
|
||||||
"LockManager",
|
[LWTRANCHE_LAUNCHER_DSA] = "LogicalRepLauncherDSA",
|
||||||
/* LWTRANCHE_PREDICATE_LOCK_MANAGER: */
|
[LWTRANCHE_LAUNCHER_HASH] = "LogicalRepLauncherHash",
|
||||||
"PredicateLockManager",
|
[LWTRANCHE_DSM_REGISTRY_DSA] = "DSMRegistryDSA",
|
||||||
/* LWTRANCHE_PARALLEL_HASH_JOIN: */
|
[LWTRANCHE_DSM_REGISTRY_HASH] = "DSMRegistryHash",
|
||||||
"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) ==
|
StaticAssertDecl(lengthof(BuiltinTrancheNames) ==
|
||||||
LWTRANCHE_FIRST_USER_DEFINED - NUM_INDIVIDUAL_LWLOCKS,
|
LWTRANCHE_FIRST_USER_DEFINED,
|
||||||
"missing entries in BuiltinTrancheNames[]");
|
"missing entries in BuiltinTrancheNames[]");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -775,7 +744,7 @@ GetLWTrancheName(uint16 trancheId)
|
||||||
|
|
||||||
/* Built-in tranche? */
|
/* Built-in tranche? */
|
||||||
if (trancheId < LWTRANCHE_FIRST_USER_DEFINED)
|
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,
|
* It's an extension tranche, so look in LWLockTrancheNames[]. However,
|
||||||
|
|
Loading…
Reference in a new issue