]> granicus.if.org Git - postgresql/blob - src/include/access/clog.h
7a8918e0fc56975043faa65b0a5ef28a39d37ccf
[postgresql] / src / include / access / clog.h
1 /*
2  * clog.h
3  *
4  * PostgreSQL transaction-commit-log manager
5  *
6  * Portions Copyright (c) 1996-2011, 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/xlog.h"
15
16 /*
17  * Possible transaction statuses --- note that all-zeroes is the initial
18  * state.
19  *
20  * A "subcommitted" transaction is a committed subtransaction whose parent
21  * hasn't committed or aborted yet.
22  */
23 typedef int XidStatus;
24
25 #define TRANSACTION_STATUS_IN_PROGRESS          0x00
26 #define TRANSACTION_STATUS_COMMITTED            0x01
27 #define TRANSACTION_STATUS_ABORTED                      0x02
28 #define TRANSACTION_STATUS_SUB_COMMITTED        0x03
29
30
31 /* Number of SLRU buffers to use for clog */
32 #define NUM_CLOG_BUFFERS        8
33
34
35 extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
36                                    TransactionId *subxids, XidStatus status, XLogRecPtr lsn);
37 extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn);
38
39 extern Size CLOGShmemSize(void);
40 extern void CLOGShmemInit(void);
41 extern void BootStrapCLOG(void);
42 extern void StartupCLOG(void);
43 extern void ShutdownCLOG(void);
44 extern void CheckPointCLOG(void);
45 extern void ExtendCLOG(TransactionId newestXact);
46 extern void TruncateCLOG(TransactionId oldestXact);
47
48 /* XLOG stuff */
49 #define CLOG_ZEROPAGE           0x00
50 #define CLOG_TRUNCATE           0x10
51
52 extern void clog_redo(XLogRecPtr lsn, XLogRecord *record);
53 extern void clog_desc(StringInfo buf, uint8 xl_info, char *rec);
54
55 #endif   /* CLOG_H */