PostgreSQL Source Code: src/include/storage/proc.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _PROC_H_
15#define _PROC_H_
16
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39#define PGPROC_MAX_CACHED_SUBXIDS 64
40
42{
43
45
48
50{
52};
53
54
55
56
57#define PROC_IS_AUTOVACUUM 0x01
58#define PROC_IN_VACUUM 0x02
59#define PROC_IN_SAFE_IC 0x04
63#define PROC_VACUUM_FOR_WRAPAROUND 0x08
64#define PROC_IN_LOGICAL_DECODING 0x10
66#define PROC_AFFECTS_ALL_HORIZONS 0x20
67
68
69
70
71#define PROC_VACUUM_STATE_MASK \
72 (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND)
73
74
75
76
77
78#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC)
79
80
81
82
83
84
85
86
88
89
90
94
95
96
97#define FP_LOCK_GROUPS_PER_BACKEND_MAX 1024
98#define FP_LOCK_SLOTS_PER_GROUP 16
99#define FastPathLockSlotsPerBackend() \
100 (FP_LOCK_SLOTS_PER_GROUP * FastPathLockGroupsPerBackend)
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
130
132
134#define DELAY_CHKPT_START (1<<0)
135#define DELAY_CHKPT_COMPLETE (1<<1)
136
137typedef enum
138{
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
171
174
177{
180
183
185
187 TransactionId xid;
188
189
190
192 TransactionId xmin;
194
195
196
197 int pid;
198
199 int pgxactoff;
200
201
202
203
205
206
207
208 struct
211
212
214
218
220
221
224
226
227
230
231
236
245
253
254
256
257 uint8 statusFlags;
258
259
260
264
265
266
268 int syncRepState;
271
273
275
277
279
281
282
283
285
287
289
290
295
297 bool clogGroupMember;
301
307
308 LWLock fpInfoLock;
309 uint64 *fpLockBits;
311 bool fpVXIDLock;
316
317
318
322};
323
324
325
326
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
378
379
381
382
384{
385
387
388
390
391
392
393
394
396
397
399
403
405
407
409
411
413
415
418
419
421
424
425
427
430
434
435
436
437
438#define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)])
439#define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0])
440
441
443
444
445
446
447
448#define NUM_SPECIAL_WORKER_PROCS 2
449
450
451
452
453
456
457
458
459
460#define MAX_IO_WORKERS 32
461#define NUM_AUXILIARY_PROCS (6 + MAX_IO_WORKERS)
462
463
464
472
473#ifdef EXEC_BACKEND
476#endif
477
478
479
480
481
488
491
494
496 LockMethod lockMethodTable, bool dontWait);
505 int *lockHoldersNum);
506
509
511
514
515#endif
uint32 LocalTransactionId
#define NUM_LOCK_PARTITIONS
ProcWaitStatus JoinWaitQueue(LOCALLOCK *locallock, LockMethod lockMethodTable, bool dontWait)
void ProcSendSignal(ProcNumber procNumber)
PGDLLIMPORT int IdleInTransactionSessionTimeout
Size ProcGlobalShmemSize(void)
void ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus)
PGDLLIMPORT int IdleSessionTimeout
bool HaveNFreeProcs(int n, int *nfree)
void InitAuxiliaryProcess(void)
void GetLockHoldersAndWaiters(LOCALLOCK *locallock, StringInfo lock_holders_sbuf, StringInfo lock_waiters_sbuf, int *lockHoldersNum)
PGDLLIMPORT PROC_HDR * ProcGlobal
int GetStartupBufferPinWaitBufId(void)
ProcWaitStatus ProcSleep(LOCALLOCK *locallock)
PGDLLIMPORT PGPROC * MyProc
void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock)
#define PGPROC_MAX_CACHED_SUBXIDS
int ProcGlobalSemas(void)
void ProcReleaseLocks(bool isCommit)
void LockErrorCleanup(void)
bool BecomeLockGroupMember(PGPROC *leader, int pid)
PGDLLIMPORT int StatementTimeout
void BecomeLockGroupLeader(void)
PGDLLIMPORT int DeadlockTimeout
PGDLLIMPORT int LockTimeout
void CheckDeadLockAlert(void)
void InitProcessPhase2(void)
void InitProcGlobal(void)
PGDLLIMPORT bool log_lock_waits
@ PROC_WAIT_STATUS_WAITING
PGDLLIMPORT PGPROC * PreparedXactProcs
PGDLLIMPORT int TransactionTimeout
PGPROC * AuxiliaryPidGetProc(int pid)
struct XidCacheStatus XidCacheStatus
void SetStartupBufferPinWaitBufId(int bufid)
void ProcWaitForSignal(uint32 wait_event_info)
PGDLLIMPORT int FastPathLockGroupsPerBackend
NON_EXEC_STATIC PGPROC * AuxiliaryProcs
NON_EXEC_STATIC slock_t * ProcStructLock
bool procArrayGroupMember
XLogRecPtr clogGroupMemberLsn
pg_atomic_uint32 procArrayGroupNext
dlist_head lockGroupMembers
dlist_head * procgloballist
bool recoveryConflictPending
TransactionId clogGroupMemberXid
int64 clogGroupMemberPage
pg_atomic_uint64 waitStart
pg_atomic_uint32 clogGroupNext
XidStatus clogGroupMemberXidStatus
XidCacheStatus subxidStatus
LocalTransactionId fpLocalTransactionId
TransactionId procArrayGroupMemberXid
dlist_head myProcLocks[NUM_LOCK_PARTITIONS]
ProcWaitStatus waitStatus
XidCacheStatus * subxidStates
dlist_head autovacFreeProcs
ProcNumber checkpointerProc
int startupBufferPinWaitBufId
pg_atomic_uint32 clogGroupFirst
dlist_head walsenderFreeProcs
dlist_head bgworkerFreeProcs
pg_atomic_uint32 procArrayGroupFirst
TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS]