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-2024, 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 
19 
21 
22 extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
24  RepOriginId nodeid);
26  TimestampTz *ts, RepOriginId *nodeid);
28  RepOriginId *nodeid);
29 
30 extern Size CommitTsShmemSize(void);
31 extern void CommitTsShmemInit(void);
32 extern void BootStrapCommitTs(void);
33 extern void StartupCommitTs(void);
34 extern void CommitTsParameterChange(bool newvalue, bool oldvalue);
35 extern void CompleteCommitTsInitialization(void);
36 extern void CheckPointCommitTs(void);
37 extern void ExtendCommitTs(TransactionId newestXact);
38 extern void TruncateCommitTs(TransactionId oldestXact);
39 extern void SetCommitTsLimit(TransactionId oldestXact,
40  TransactionId newestXact);
41 extern void AdvanceOldestCommitTsXid(TransactionId oldestXact);
42 
43 extern int committssyncfiletag(const FileTag *ftag, char *path);
44 
45 /* XLOG stuff */
46 #define COMMIT_TS_ZEROPAGE 0x00
47 #define COMMIT_TS_TRUNCATE 0x10
48 
49 typedef struct xl_commit_ts_set
50 {
54  /* subxact Xids follow */
56 
57 #define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \
58  sizeof(TransactionId))
59 
60 typedef struct xl_commit_ts_truncate
61 {
65 
66 #define SizeOfCommitTsTruncate (offsetof(xl_commit_ts_truncate, oldestXid) + \
67  sizeof(TransactionId))
68 
69 extern void commit_ts_redo(XLogReaderState *record);
70 extern void commit_ts_desc(StringInfo buf, XLogReaderState *record);
71 extern const char *commit_ts_identify(uint8 info);
72 
73 #endif /* COMMIT_TS_H */
#define PGDLLIMPORT
Definition: c.h:1274
uint8_t uint8
Definition: c.h:483
int64_t int64
Definition: c.h:482
uint32 TransactionId
Definition: c.h:606
size_t Size
Definition: c.h:559
void StartupCommitTs(void)
Definition: commit_ts.c:632
TransactionId GetLatestCommitTsData(TimestampTz *ts, RepOriginId *nodeid)
Definition: commit_ts.c:360
void CommitTsParameterChange(bool newvalue, bool oldvalue)
Definition: commit_ts.c:664
struct xl_commit_ts_truncate xl_commit_ts_truncate
const char * commit_ts_identify(uint8 info)
Definition: committsdesc.c:43
Size CommitTsShmemSize(void)
Definition: commit_ts.c:519
void AdvanceOldestCommitTsXid(TransactionId oldestXact)
Definition: commit_ts.c:936
int committssyncfiletag(const FileTag *ftag, char *path)
Definition: commit_ts.c:1063
void CompleteCommitTsInitialization(void)
Definition: commit_ts.c:642
struct xl_commit_ts_set xl_commit_ts_set
void TruncateCommitTs(TransactionId oldestXact)
Definition: commit_ts.c:883
void commit_ts_redo(XLogReaderState *record)
Definition: commit_ts.c:1016
bool TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts, RepOriginId *nodeid)
Definition: commit_ts.c:274
void BootStrapCommitTs(void)
Definition: commit_ts.c:596
void commit_ts_desc(StringInfo buf, XLogReaderState *record)
Definition: committsdesc.c:21
void CommitTsShmemInit(void)
Definition: commit_ts.c:530
void SetCommitTsLimit(TransactionId oldestXact, TransactionId newestXact)
Definition: commit_ts.c:909
void ExtendCommitTs(TransactionId newestXact)
Definition: commit_ts.c:842
PGDLLIMPORT bool track_commit_timestamp
Definition: commit_ts.c:109
void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids, TransactionId *subxids, TimestampTz timestamp, RepOriginId nodeid)
Definition: commit_ts.c:141
void CheckPointCommitTs(void)
Definition: commit_ts.c:820
int64 TimestampTz
Definition: timestamp.h:39
static char * buf
Definition: pg_test_fsync.c:72
int64 timestamp
Definition: sync.h:51
TransactionId mainxid
Definition: commit_ts.h:53
RepOriginId nodeid
Definition: commit_ts.h:52
TimestampTz timestamp
Definition: commit_ts.h:51
TransactionId oldestXid
Definition: commit_ts.h:63
uint16 RepOriginId
Definition: xlogdefs.h:65