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

Commit74a7306

Browse files
committed
Improve notation of BuiltinTrancheNames
Use C99 designated initializer syntax for array elements, instead ofwriting the position in a comment. This is less verbose and much morereadable. Akin tocc15059.One disadvantage is that the BuiltinTrancheNames array now has a hole of51 NULLs -- previously, the array elements were shifted 51 elements downward to avoid this. This can be fixed by merging theIndividualLWLockNames array into BuiltinTrancheNames, which would occupythose 51 pointers, but because it requires some arguably ugly Mesonhackery, it's left for later.Discussion:https://postgr.es/m/202401231025.gbv4nnte5fmm@alvherre.pgsql
1 parent94edfe2 commit74a7306

File tree

1 file changed

+33
-64
lines changed

1 file changed

+33
-64
lines changed

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 33 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -132,72 +132,41 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
132132
externconstchar*constIndividualLWLockNames[];/* in lwlocknames.c */
133133

134134
staticconstchar*constBuiltinTrancheNames[]= {
135-
/* LWTRANCHE_XACT_BUFFER: */
136-
"XactBuffer",
137-
/* LWTRANCHE_COMMITTS_BUFFER: */
138-
"CommitTsBuffer",
139-
/* LWTRANCHE_SUBTRANS_BUFFER: */
140-
"SubtransBuffer",
141-
/* LWTRANCHE_MULTIXACTOFFSET_BUFFER: */
142-
"MultiXactOffsetBuffer",
143-
/* LWTRANCHE_MULTIXACTMEMBER_BUFFER: */
144-
"MultiXactMemberBuffer",
145-
/* LWTRANCHE_NOTIFY_BUFFER: */
146-
"NotifyBuffer",
147-
/* LWTRANCHE_SERIAL_BUFFER: */
148-
"SerialBuffer",
149-
/* LWTRANCHE_WAL_INSERT: */
150-
"WALInsert",
151-
/* LWTRANCHE_BUFFER_CONTENT: */
152-
"BufferContent",
153-
/* LWTRANCHE_REPLICATION_ORIGIN_STATE: */
154-
"ReplicationOriginState",
155-
/* LWTRANCHE_REPLICATION_SLOT_IO: */
156-
"ReplicationSlotIO",
157-
/* LWTRANCHE_LOCK_FASTPATH: */
158-
"LockFastPath",
159-
/* LWTRANCHE_BUFFER_MAPPING: */
160-
"BufferMapping",
161-
/* LWTRANCHE_LOCK_MANAGER: */
162-
"LockManager",
163-
/* LWTRANCHE_PREDICATE_LOCK_MANAGER: */
164-
"PredicateLockManager",
165-
/* LWTRANCHE_PARALLEL_HASH_JOIN: */
166-
"ParallelHashJoin",
167-
/* LWTRANCHE_PARALLEL_QUERY_DSA: */
168-
"ParallelQueryDSA",
169-
/* LWTRANCHE_PER_SESSION_DSA: */
170-
"PerSessionDSA",
171-
/* LWTRANCHE_PER_SESSION_RECORD_TYPE: */
172-
"PerSessionRecordType",
173-
/* LWTRANCHE_PER_SESSION_RECORD_TYPMOD: */
174-
"PerSessionRecordTypmod",
175-
/* LWTRANCHE_SHARED_TUPLESTORE: */
176-
"SharedTupleStore",
177-
/* LWTRANCHE_SHARED_TIDBITMAP: */
178-
"SharedTidBitmap",
179-
/* LWTRANCHE_PARALLEL_APPEND: */
180-
"ParallelAppend",
181-
/* LWTRANCHE_PER_XACT_PREDICATE_LIST: */
182-
"PerXactPredicateList",
183-
/* LWTRANCHE_PGSTATS_DSA: */
184-
"PgStatsDSA",
185-
/* LWTRANCHE_PGSTATS_HASH: */
186-
"PgStatsHash",
187-
/* LWTRANCHE_PGSTATS_DATA: */
188-
"PgStatsData",
189-
/* LWTRANCHE_LAUNCHER_DSA: */
190-
"LogicalRepLauncherDSA",
191-
/* LWTRANCHE_LAUNCHER_HASH: */
192-
"LogicalRepLauncherHash",
193-
/* LWTRANCHE_DSM_REGISTRY_DSA: */
194-
"DSMRegistryDSA",
195-
/* LWTRANCHE_DSM_REGISTRY_HASH: */
196-
"DSMRegistryHash",
135+
[LWTRANCHE_XACT_BUFFER]="XactBuffer",
136+
[LWTRANCHE_COMMITTS_BUFFER]="CommitTsBuffer",
137+
[LWTRANCHE_SUBTRANS_BUFFER]="SubtransBuffer",
138+
[LWTRANCHE_MULTIXACTOFFSET_BUFFER]="MultiXactOffsetBuffer",
139+
[LWTRANCHE_MULTIXACTMEMBER_BUFFER]="MultiXactMemberBuffer",
140+
[LWTRANCHE_NOTIFY_BUFFER]="NotifyBuffer",
141+
[LWTRANCHE_SERIAL_BUFFER]="SerialBuffer",
142+
[LWTRANCHE_WAL_INSERT]="WALInsert",
143+
[LWTRANCHE_BUFFER_CONTENT]="BufferContent",
144+
[LWTRANCHE_REPLICATION_ORIGIN_STATE]="ReplicationOriginState",
145+
[LWTRANCHE_REPLICATION_SLOT_IO]="ReplicationSlotIO",
146+
[LWTRANCHE_LOCK_FASTPATH]="LockFastPath",
147+
[LWTRANCHE_BUFFER_MAPPING]="BufferMapping",
148+
[LWTRANCHE_LOCK_MANAGER]="LockManager",
149+
[LWTRANCHE_PREDICATE_LOCK_MANAGER]="PredicateLockManager",
150+
[LWTRANCHE_PARALLEL_HASH_JOIN]="ParallelHashJoin",
151+
[LWTRANCHE_PARALLEL_QUERY_DSA]="ParallelQueryDSA",
152+
[LWTRANCHE_PER_SESSION_DSA]="PerSessionDSA",
153+
[LWTRANCHE_PER_SESSION_RECORD_TYPE]="PerSessionRecordType",
154+
[LWTRANCHE_PER_SESSION_RECORD_TYPMOD]="PerSessionRecordTypmod",
155+
[LWTRANCHE_SHARED_TUPLESTORE]="SharedTupleStore",
156+
[LWTRANCHE_SHARED_TIDBITMAP]="SharedTidBitmap",
157+
[LWTRANCHE_PARALLEL_APPEND]="ParallelAppend",
158+
[LWTRANCHE_PER_XACT_PREDICATE_LIST]="PerXactPredicateList",
159+
[LWTRANCHE_PGSTATS_DSA]="PgStatsDSA",
160+
[LWTRANCHE_PGSTATS_HASH]="PgStatsHash",
161+
[LWTRANCHE_PGSTATS_DATA]="PgStatsData",
162+
[LWTRANCHE_LAUNCHER_DSA]="LogicalRepLauncherDSA",
163+
[LWTRANCHE_LAUNCHER_HASH]="LogicalRepLauncherHash",
164+
[LWTRANCHE_DSM_REGISTRY_DSA]="DSMRegistryDSA",
165+
[LWTRANCHE_DSM_REGISTRY_HASH]="DSMRegistryHash",
197166
};
198167

199168
StaticAssertDecl(lengthof(BuiltinTrancheNames)==
200-
LWTRANCHE_FIRST_USER_DEFINED-NUM_INDIVIDUAL_LWLOCKS,
169+
LWTRANCHE_FIRST_USER_DEFINED,
201170
"missing entries in BuiltinTrancheNames[]");
202171

203172
/*
@@ -775,7 +744,7 @@ GetLWTrancheName(uint16 trancheId)
775744

776745
/* Built-in tranche? */
777746
if (trancheId<LWTRANCHE_FIRST_USER_DEFINED)
778-
returnBuiltinTrancheNames[trancheId-NUM_INDIVIDUAL_LWLOCKS];
747+
returnBuiltinTrancheNames[trancheId];
779748

780749
/*
781750
* It's an extension tranche, so look in LWLockTrancheNames[]. However,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp