1 | /* |
2 | * clog.h |
3 | * |
4 | * PostgreSQL transaction-commit-log manager |
5 | * |
6 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
7 | * Portions Copyright (c) 1994, Regents of the University of California |
8 | * |
9 | * src/include/access/clog.h |
10 | */ |
11 | #ifndef CLOG_H |
12 | #define CLOG_H |
13 | |
14 | #include "access/xlogreader.h" |
15 | #include "lib/stringinfo.h" |
16 | |
17 | /* |
18 | * Possible transaction statuses --- note that all-zeroes is the initial |
19 | * state. |
20 | * |
21 | * A "subcommitted" transaction is a committed subtransaction whose parent |
22 | * hasn't committed or aborted yet. |
23 | */ |
24 | typedef int XidStatus; |
25 | |
26 | #define TRANSACTION_STATUS_IN_PROGRESS 0x00 |
27 | #define TRANSACTION_STATUS_COMMITTED 0x01 |
28 | #define TRANSACTION_STATUS_ABORTED 0x02 |
29 | #define TRANSACTION_STATUS_SUB_COMMITTED 0x03 |
30 | |
31 | typedef struct xl_clog_truncate |
32 | { |
33 | int pageno; |
34 | TransactionId oldestXact; |
35 | Oid oldestXactDb; |
36 | } xl_clog_truncate; |
37 | |
38 | extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, |
39 | TransactionId *subxids, XidStatus status, XLogRecPtr lsn); |
40 | extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn); |
41 | |
42 | extern Size CLOGShmemBuffers(void); |
43 | extern Size CLOGShmemSize(void); |
44 | extern void CLOGShmemInit(void); |
45 | extern void BootStrapCLOG(void); |
46 | extern void StartupCLOG(void); |
47 | extern void TrimCLOG(void); |
48 | extern void ShutdownCLOG(void); |
49 | extern void CheckPointCLOG(void); |
50 | extern void ExtendCLOG(TransactionId newestXact); |
51 | extern void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid); |
52 | |
53 | /* XLOG stuff */ |
54 | #define CLOG_ZEROPAGE 0x00 |
55 | #define CLOG_TRUNCATE 0x10 |
56 | |
57 | extern void clog_redo(XLogReaderState *record); |
58 | extern void clog_desc(StringInfo buf, XLogReaderState *record); |
59 | extern const char *clog_identify(uint8 info); |
60 | |
61 | #endif /* CLOG_H */ |
62 | |