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-2020, 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  int pageno;
38 
39 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
40  TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
42 
43 extern Size CLOGShmemBuffers(void);
44 extern Size CLOGShmemSize(void);
45 extern void CLOGShmemInit(void);
46 extern void BootStrapCLOG(void);
47 extern void StartupCLOG(void);
48 extern void TrimCLOG(void);
49 extern void ShutdownCLOG(void);
50 extern void CheckPointCLOG(void);
51 extern void ExtendCLOG(TransactionId newestXact);
52 extern void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid);
53 
54 extern int clogsyncfiletag(const FileTag *ftag, char *path);
55 
56 /* XLOG stuff */
57 #define CLOG_ZEROPAGE 0x00
58 #define CLOG_TRUNCATE 0x10
59 
60 extern void clog_redo(XLogReaderState *record);
61 extern void clog_desc(StringInfo buf, XLogReaderState *record);
62 extern const char *clog_identify(uint8 info);
63 
64 #endif /* CLOG_H */
void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn)
Definition: clog.c:164
void TrimCLOG(void)
Definition: clog.c:768
void StartupCLOG(void)
Definition: clog.c:749
uint32 TransactionId
Definition: c.h:520
unsigned char uint8
Definition: c.h:372
void BootStrapCLOG(void)
Definition: clog.c:706
int XidStatus
Definition: clog.h:25
void clog_redo(XLogReaderState *record)
Definition: clog.c:975
unsigned int Oid
Definition: postgres_ext.h:31
void ShutdownCLOG(void)
const char * clog_identify(uint8 info)
Definition: clogdesc.c:44
static char * buf
Definition: pg_test_fsync.c:67
XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn)
Definition: clog.c:634
int pageno
Definition: clog.h:34
void clog_desc(StringInfo buf, XLogReaderState *record)
Definition: clogdesc.c:21
int clogsyncfiletag(const FileTag *ftag, char *path)
Definition: clog.c:1021
void CheckPointCLOG(void)
Definition: clog.c:817
TransactionId oldestXact
Definition: clog.h:35
Size CLOGShmemSize(void)
Definition: clog.c:685
uint64 XLogRecPtr
Definition: xlogdefs.h:21
size_t Size
Definition: c.h:473
void TruncateCLOG(TransactionId oldestXact, Oid oldestxid_datoid)
Definition: clog.c:878
void ExtendCLOG(TransactionId newestXact)
Definition: clog.c:839
Oid oldestXactDb
Definition: clog.h:36
void CLOGShmemInit(void)
Definition: clog.c:691
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:227
struct xl_clog_truncate xl_clog_truncate
Definition: sync.h:50
Size CLOGShmemBuffers(void)
Definition: clog.c:676