4 * PostgreSQL commit timestamp manager
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/commit_ts.h
14 #include "access/xlog.h"
15 #include "datatype/timestamp.h"
16 #include "replication/origin.h"
17 #include "storage/sync.h"
20 extern PGDLLIMPORT
bool track_commit_timestamp
;
22 extern void TransactionTreeSetCommitTsData(TransactionId xid
, int nsubxids
,
23 TransactionId
*subxids
, TimestampTz timestamp
,
25 extern bool TransactionIdGetCommitTsData(TransactionId xid
,
26 TimestampTz
*ts
, RepOriginId
*nodeid
);
27 extern TransactionId
GetLatestCommitTsData(TimestampTz
*ts
,
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
);
43 extern int committssyncfiletag(const FileTag
*ftag
, char *path
);
46 #define COMMIT_TS_ZEROPAGE 0x00
47 #define COMMIT_TS_TRUNCATE 0x10
49 typedef struct xl_commit_ts_set
51 TimestampTz timestamp
;
53 TransactionId mainxid
;
54 /* subxact Xids follow */
57 #define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \
58 sizeof(TransactionId))
60 typedef struct xl_commit_ts_truncate
63 TransactionId oldestXid
;
64 } xl_commit_ts_truncate
;
66 #define SizeOfCommitTsTruncate (offsetof(xl_commit_ts_truncate, oldestXid) + \
67 sizeof(TransactionId))
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
);
73 #endif /* COMMIT_TS_H */