Improve performance of subsystems on top of SLRU
[pgsql.git] / src / include / access / clog.h
blob8e62917e498a402c40c32bc7a6c6aabe5a1801a8
1 /*
2 * clog.h
4 * PostgreSQL transaction-commit-log manager
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/clog.h
11 #ifndef CLOG_H
12 #define CLOG_H
14 #include "access/xlogreader.h"
15 #include "storage/sync.h"
16 #include "lib/stringinfo.h"
19 * Possible transaction statuses --- note that all-zeroes is the initial
20 * state.
22 * A "subcommitted" transaction is a committed subtransaction whose parent
23 * hasn't committed or aborted yet.
25 typedef int XidStatus;
27 #define TRANSACTION_STATUS_IN_PROGRESS 0x00
28 #define TRANSACTION_STATUS_COMMITTED 0x01
29 #define TRANSACTION_STATUS_ABORTED 0x02
30 #define TRANSACTION_STATUS_SUB_COMMITTED 0x03
32 typedef struct xl_clog_truncate
34 int64 pageno;
35 TransactionId oldestXact;
36 Oid oldestXactDb;
37 } xl_clog_truncate;
39 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
40 TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
41 extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn);
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 CheckPointCLOG(void);
49 extern void ExtendCLOG(TransactionId newestXact);
50 extern void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid);
52 extern int clogsyncfiletag(const FileTag *ftag, char *path);
54 /* XLOG stuff */
55 #define CLOG_ZEROPAGE 0x00
56 #define CLOG_TRUNCATE 0x10
58 extern void clog_redo(XLogReaderState *record);
59 extern void clog_desc(StringInfo buf, XLogReaderState *record);
60 extern const char *clog_identify(uint8 info);
62 #endif /* CLOG_H */