PostgreSQL Source Code  git master
commit_ts.h
Go to the documentation of this file.
1 /*
2  * commit_ts.h
3  *
4  * PostgreSQL commit timestamp 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/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 "storage/sync.h"
18 #include "utils/guc.h"
19 
20 
22 
23 extern bool check_track_commit_timestamp(bool *newval, void **extra,
24  GucSource source);
25 
26 extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
28  RepOriginId nodeid, bool write_xlog);
30  TimestampTz *ts, RepOriginId *nodeid);
32  RepOriginId *nodeid);
33 
34 extern Size CommitTsShmemBuffers(void);
35 extern Size CommitTsShmemSize(void);
36 extern void CommitTsShmemInit(void);
37 extern void BootStrapCommitTs(void);
38 extern void StartupCommitTs(void);
39 extern void CommitTsParameterChange(bool newvalue, bool oldvalue);
40 extern void CompleteCommitTsInitialization(void);
41 extern void ShutdownCommitTs(void);
42 extern void CheckPointCommitTs(void);
43 extern void ExtendCommitTs(TransactionId newestXact);
44 extern void TruncateCommitTs(TransactionId oldestXact);
45 extern void SetCommitTsLimit(TransactionId oldestXact,
46  TransactionId newestXact);
47 extern void AdvanceOldestCommitTsXid(TransactionId oldestXact);
48 
49 extern int committssyncfiletag(const FileTag *ftag, char *path);
50 
51 /* XLOG stuff */
52 #define COMMIT_TS_ZEROPAGE 0x00
53 #define COMMIT_TS_TRUNCATE 0x10
54 #define COMMIT_TS_SETTS 0x20
55 
56 typedef struct xl_commit_ts_set
57 {
61  /* subxact Xids follow */
63 
64 #define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \
65  sizeof(TransactionId))
66 
67 typedef struct xl_commit_ts_truncate
68 {
69  int pageno;
72 
73 #define SizeOfCommitTsTruncate (offsetof(xl_commit_ts_truncate, oldestXid) + \
74  sizeof(TransactionId))
75 
76 extern void commit_ts_redo(XLogReaderState *record);
77 extern void commit_ts_desc(StringInfo buf, XLogReaderState *record);
78 extern const char *commit_ts_identify(uint8 info);
79 
80 #endif /* COMMIT_TS_H */
void CompleteCommitTsInitialization(void)
Definition: commit_ts.c:631
uint32 TransactionId
Definition: c.h:520
int64 timestamp
int64 TimestampTz
Definition: timestamp.h:39
unsigned char uint8
Definition: c.h:372
void commit_ts_desc(StringInfo buf, XLogReaderState *record)
Definition: committsdesc.c:22
void ShutdownCommitTs(void)
uint16 RepOriginId
Definition: xlogdefs.h:58
void BootStrapCommitTs(void)
Definition: commit_ts.c:585
struct xl_commit_ts_set xl_commit_ts_set
void AdvanceOldestCommitTsXid(TransactionId oldestXact)
Definition: commit_ts.c:919
TimestampTz timestamp
Definition: commit_ts.h:58
#define PGDLLIMPORT
Definition: c.h:1257
GucSource
Definition: guc.h:105
void commit_ts_redo(XLogReaderState *record)
Definition: commit_ts.c:1007
void CheckPointCommitTs(void)
Definition: commit_ts.c:806
static char * buf
Definition: pg_test_fsync.c:67
void CommitTsShmemInit(void)
Definition: commit_ts.c:551
TransactionId oldestXid
Definition: commit_ts.h:70
void CommitTsParameterChange(bool newvalue, bool oldvalue)
Definition: commit_ts.c:653
void ExtendCommitTs(TransactionId newestXact)
Definition: commit_ts.c:828
TransactionId GetLatestCommitTsData(TimestampTz *ts, RepOriginId *nodeid)
Definition: commit_ts.c:368
int committssyncfiletag(const FileTag *ftag, char *path)
Definition: commit_ts.c:1074
void TruncateCommitTs(TransactionId oldestXact)
Definition: commit_ts.c:866
TransactionId mainxid
Definition: commit_ts.h:60
Size CommitTsShmemSize(void)
Definition: commit_ts.c:540
size_t Size
Definition: c.h:473
#define newval
struct xl_commit_ts_truncate xl_commit_ts_truncate
PGDLLIMPORT bool track_commit_timestamp
Definition: commit_ts.c:103
bool check_track_commit_timestamp(bool *newval, void **extra, GucSource source)
RepOriginId nodeid
Definition: commit_ts.h:59
void StartupCommitTs(void)
Definition: commit_ts.c:621
bool TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts, RepOriginId *nodeid)
Definition: commit_ts.c:282
Definition: sync.h:50
const char * commit_ts_identify(uint8 info)
Definition: committsdesc.c:69
void SetCommitTsLimit(TransactionId oldestXact, TransactionId newestXact)
Definition: commit_ts.c:892
Size CommitTsShmemBuffers(void)
Definition: commit_ts.c:531
void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, TransactionId *subxids, TimestampTz timestamp, RepOriginId nodeid, bool write_xlog)
Definition: commit_ts.c:145