PostgreSQL Source Code: src/backend/access/transam/subtrans.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
30
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54#define SUBTRANS_XACTS_PER_PAGE (BLCKSZ / sizeof(TransactionId))
55
56
57
58
59
60static inline int64
62{
64}
65
66#define TransactionIdToEntry(xid) ((xid) % (TransactionId) SUBTRANS_XACTS_PER_PAGE)
67
68
69
70
71
73
74#define SubTransCtl (&SubTransCtlData)
75
76
79
80
81
82
83
84void
86{
89 int slotno;
92
95
98
101 ptr += entryno;
102
103
104
105
106
107
108 if (*ptr != parent)
109 {
111 *ptr = parent;
112 SubTransCtl->shared->page_dirty[slotno] = true;
113 }
114
116}
117
118
119
120
123{
126 int slotno;
129
130
132
133
136
137
138
141 ptr += entryno;
142
143 parent = *ptr;
144
146
147 return parent;
148}
149
150
151
152
153
154
155
156
157
158
159
160
161
164{
166 previousXid = xid;
167
168
170
172 {
173 previousXid = parentXid;
175 break;
177
178
179
180
181
182
184 elog(ERROR, "pg_subtrans contains invalid entry: xid %u points to parent xid %u",
185 previousXid, parentXid);
186 }
187
189
190 return previousXid;
191}
192
193
194
195
196
197
198
199
200static int
202{
203
206
208}
209
210
211
212
215{
217}
218
219void
221{
222
224 {
225 char buf[32];
226
230
231
232
233
234
235
236
240 }
242
248}
249
250
251
252
253bool
255{
257}
258
259
260
261
262
263
264
265
266
267
268
269void
271{
272 int slotno;
274
276
277
279
280
283
285}
286
287
288
289
290
291
292
293
294
295static int
297{
299}
300
301
302
303
304
305
306
307
308void
310{
314 LWLock *prevlock = NULL;
316
317
318
319
320
321
322
326
327 for (;;)
328 {
330 if (prevlock != lock)
331 {
332 if (prevlock)
335 prevlock = lock;
336 }
337
339 if (startPage == endPage)
340 break;
341
342 startPage++;
343
345 startPage = 0;
346 }
347
349}
350
351
352
353
354void
356{
357
358
359
360
361
362
363
364 TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_START(true);
366 TRACE_POSTGRESQL_SUBTRANS_CHECKPOINT_DONE(true);
367}
368
369
370
371
372
373
374
375
376
377
378void
380{
383
384
385
386
387
390 return;
391
393
396
397
399
401}
402
403
404
405
406
407
408
409
410void
412{
413 int64 cutoffPage;
414
415
416
417
418
419
420
421
422
425
427}
428
429
430
431
432
433
434static bool
436{
439
444
447}
int subtransaction_buffers
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
Assert(PointerIsAligned(start, uint64))
if(TABLE==NULL||TABLE_index==NULL)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
@ LWTRANCHE_SUBTRANS_BUFFER
@ LWTRANCHE_SUBTRANS_SLRU
static rewind_source * source
void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, const char *subdir, int buffer_tranche_id, int bank_tranche_id, SyncRequestHandler sync_handler, bool long_segment_names)
int SimpleLruReadPage_ReadOnly(SlruCtl ctl, int64 pageno, TransactionId xid)
void SimpleLruWritePage(SlruCtl ctl, int slotno)
void SimpleLruWriteAll(SlruCtl ctl, bool allow_redirtied)
int SimpleLruAutotuneBuffers(int divisor, int max)
int SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok, TransactionId xid)
int SimpleLruZeroPage(SlruCtl ctl, int64 pageno)
void SimpleLruTruncate(SlruCtl ctl, int64 cutoffPage)
Size SimpleLruShmemSize(int nslots, int nlsns)
bool check_slru_buffers(const char *name, int *newval)
static LWLock * SimpleLruGetBankLock(SlruCtl ctl, int64 pageno)
#define SlruPagePrecedesUnitTests(ctl, per_page)
#define SLRU_MAX_ALLOWED_BUFFERS
TransactionId TransactionXmin
FullTransactionId nextXid
bool check_subtrans_buffers(int *newval, void **extra, GucSource source)
void SUBTRANSShmemInit(void)
void SubTransSetParent(TransactionId xid, TransactionId parent)
TransactionId SubTransGetTopmostTransaction(TransactionId xid)
#define SUBTRANS_XACTS_PER_PAGE
#define TransactionIdToEntry(xid)
static SlruCtlData SubTransCtlData
void ExtendSUBTRANS(TransactionId newestXact)
void StartupSUBTRANS(TransactionId oldestActiveXID)
void CheckPointSUBTRANS(void)
Size SUBTRANSShmemSize(void)
static int SUBTRANSShmemBuffers(void)
TransactionId SubTransGetParent(TransactionId xid)
static bool SubTransPagePrecedes(int64 page1, int64 page2)
static int64 TransactionIdToPage(TransactionId xid)
static int ZeroSUBTRANSPage(int64 pageno)
void BootStrapSUBTRANS(void)
void TruncateSUBTRANS(TransactionId oldestXact)
bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
bool TransactionIdFollows(TransactionId id1, TransactionId id2)
bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2)
#define TransactionIdRetreat(dest)
#define InvalidTransactionId
#define TransactionIdEquals(id1, id2)
#define XidFromFullTransactionId(x)
#define FirstNormalTransactionId
#define TransactionIdIsValid(xid)
#define TransactionIdIsNormal(xid)
TransamVariablesData * TransamVariables