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 */
24typedef 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
31typedef struct xl_clog_truncate
32{
33 int pageno;
34 TransactionId oldestXact;
35 Oid oldestXactDb;
36} xl_clog_truncate;
37
38extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
39 TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
40extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn);
41
42extern Size CLOGShmemBuffers(void);
43extern Size CLOGShmemSize(void);
44extern void CLOGShmemInit(void);
45extern void BootStrapCLOG(void);
46extern void StartupCLOG(void);
47extern void TrimCLOG(void);
48extern void ShutdownCLOG(void);
49extern void CheckPointCLOG(void);
50extern void ExtendCLOG(TransactionId newestXact);
51extern void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid);
52
53/* XLOG stuff */
54#define CLOG_ZEROPAGE 0x00
55#define CLOG_TRUNCATE 0x10
56
57extern void clog_redo(XLogReaderState *record);
58extern void clog_desc(StringInfo buf, XLogReaderState *record);
59extern const char *clog_identify(uint8 info);
60
61#endif /* CLOG_H */
62