1 | /* |
2 | * commit_ts.h |
3 | * |
4 | * PostgreSQL commit timestamp 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/commit_ts.h |
10 | */ |
11 | #ifndef COMMIT_TS_H |
12 | #define COMMIT_TS_H |
13 | |
14 | #include "access/xlog.h" |
15 | #include "datatype/timestamp.h" |
16 | #include "replication/origin.h" |
17 | #include "utils/guc.h" |
18 | |
19 | |
20 | extern PGDLLIMPORT bool track_commit_timestamp; |
21 | |
22 | extern bool check_track_commit_timestamp(bool *newval, void **, |
23 | GucSource source); |
24 | |
25 | extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, |
26 | TransactionId *subxids, TimestampTz timestamp, |
27 | RepOriginId nodeid, bool write_xlog); |
28 | extern bool TransactionIdGetCommitTsData(TransactionId xid, |
29 | TimestampTz *ts, RepOriginId *nodeid); |
30 | extern TransactionId GetLatestCommitTsData(TimestampTz *ts, |
31 | RepOriginId *nodeid); |
32 | |
33 | extern Size CommitTsShmemBuffers(void); |
34 | extern Size CommitTsShmemSize(void); |
35 | extern void CommitTsShmemInit(void); |
36 | extern void BootStrapCommitTs(void); |
37 | extern void StartupCommitTs(void); |
38 | extern void CommitTsParameterChange(bool xlrecvalue, bool pgcontrolvalue); |
39 | extern void CompleteCommitTsInitialization(void); |
40 | extern void ShutdownCommitTs(void); |
41 | extern void CheckPointCommitTs(void); |
42 | extern void ExtendCommitTs(TransactionId newestXact); |
43 | extern void TruncateCommitTs(TransactionId oldestXact); |
44 | extern void SetCommitTsLimit(TransactionId oldestXact, |
45 | TransactionId newestXact); |
46 | extern void AdvanceOldestCommitTsXid(TransactionId oldestXact); |
47 | |
48 | /* XLOG stuff */ |
49 | #define COMMIT_TS_ZEROPAGE 0x00 |
50 | #define COMMIT_TS_TRUNCATE 0x10 |
51 | #define COMMIT_TS_SETTS 0x20 |
52 | |
53 | typedef struct xl_commit_ts_set |
54 | { |
55 | TimestampTz timestamp; |
56 | RepOriginId nodeid; |
57 | TransactionId mainxid; |
58 | /* subxact Xids follow */ |
59 | } xl_commit_ts_set; |
60 | |
61 | #define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \ |
62 | sizeof(TransactionId)) |
63 | |
64 | typedef struct xl_commit_ts_truncate |
65 | { |
66 | int pageno; |
67 | TransactionId oldestXid; |
68 | } xl_commit_ts_truncate; |
69 | |
70 | #define SizeOfCommitTsTruncate (offsetof(xl_commit_ts_truncate, oldestXid) + \ |
71 | sizeof(TransactionId)) |
72 | |
73 | extern void commit_ts_redo(XLogReaderState *record); |
74 | extern void commit_ts_desc(StringInfo buf, XLogReaderState *record); |
75 | extern const char *commit_ts_identify(uint8 info); |
76 | |
77 | #endif /* COMMIT_TS_H */ |
78 | |