PostgreSQL Source Code  git master
clog.h
Go to the documentation of this file.
1 /*
2  * clog.h
3  *
4  * PostgreSQL transaction-commit-log manager
5  *
6  * Portions Copyright (c) 1996-2024, 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 "storage/sync.h"
16 #include "lib/stringinfo.h"
17 
18 /*
19  * Possible transaction statuses --- note that all-zeroes is the initial
20  * state.
21  *
22  * A "subcommitted" transaction is a committed subtransaction whose parent
23  * hasn't committed or aborted yet.
24  */
25 typedef int XidStatus;
26 
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
31 
32 typedef struct xl_clog_truncate
33 {
34  int64 pageno;
38 
39 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
40  TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
42 
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);
51 
52 extern int clogsyncfiletag(const FileTag *ftag, char *path);
53 
54 /* XLOG stuff */
55 #define CLOG_ZEROPAGE 0x00
56 #define CLOG_TRUNCATE 0x10
57 
58 extern void clog_redo(XLogReaderState *record);
59 extern void clog_desc(StringInfo buf, XLogReaderState *record);
60 extern const char *clog_identify(uint8 info);
61 
62 #endif /* CLOG_H */
unsigned char uint8
Definition: c.h:490
uint32 TransactionId
Definition: c.h:631
size_t Size
Definition: c.h:584
const char * clog_identify(uint8 info)
Definition: clogdesc.c:44
XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn)
Definition: clog.c:735
void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn)
Definition: clog.c:183
int XidStatus
Definition: clog.h:25
void CLOGShmemInit(void)
Definition: clog.c:787
void ExtendCLOG(TransactionId newestXact)
Definition: clog.c:959
void clog_redo(XLogReaderState *record)
Definition: clog.c:1107
struct xl_clog_truncate xl_clog_truncate
void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid)
Definition: clog.c:1000
Size CLOGShmemSize(void)
Definition: clog.c:781
int clogsyncfiletag(const FileTag *ftag, char *path)
Definition: clog.c:1149
void BootStrapCLOG(void)
Definition: clog.c:833
void StartupCLOG(void)
Definition: clog.c:877
void clog_desc(StringInfo buf, XLogReaderState *record)
Definition: clogdesc.c:21
void CheckPointCLOG(void)
Definition: clog.c:937
void TrimCLOG(void)
Definition: clog.c:892
static char * buf
Definition: pg_test_fsync.c:72
unsigned int Oid
Definition: postgres_ext.h:31
Definition: sync.h:51
int64 pageno
Definition: clog.h:34
Oid oldestXactDb
Definition: clog.h:36
TransactionId oldestXact
Definition: clog.h:35
uint64 XLogRecPtr
Definition: xlogdefs.h:21