mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
There are three main changes here: 1. No longer cause a start failure in a standby if the feature is disabled in postgresql.conf but enabled in the master. This reverts one part of commit 4f3924d9cd43; what we keep is the ability of the standby to activate/deactivate the module (which includes creating and removing segments as appropriate) during replay of such actions in the master. 2. Replay WAL records affecting commitTS even if the feature is disabled. This means the standby will always have the same state as the master after replay. 3. Have COMMIT PREPARE record the transaction commit time as well. We were previously only applying it in the normal transaction commit path. Author: Petr Jelínek Discussion: http://www.postgresql.org/message-id/CAHGQGwHereDzzzmfxEBYcVQu3oZv6vZcgu1TPeERWbDc+gQ06g@mail.gmail.com Discussion: http://www.postgresql.org/message-id/CAHGQGwFuzfO4JscM9LCAmCDCxp_MfLvN4QdB+xWsS-FijbjTYQ@mail.gmail.com Additionally, I cleaned up nearby code related to replication origins, which I found a bit hard to follow, and fixed a couple of typos. Backpatch to 9.5, where this code was introduced. Per bug reports from Fujii Masao and subsequent discussion.
72 lines
2.1 KiB
C
72 lines
2.1 KiB
C
/*
|
|
* commit_ts.h
|
|
*
|
|
* PostgreSQL commit timestamp manager
|
|
*
|
|
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/access/commit_ts.h
|
|
*/
|
|
#ifndef COMMIT_TS_H
|
|
#define COMMIT_TS_H
|
|
|
|
#include "access/xlog.h"
|
|
#include "datatype/timestamp.h"
|
|
#include "replication/origin.h"
|
|
#include "utils/guc.h"
|
|
|
|
|
|
extern PGDLLIMPORT bool track_commit_timestamp;
|
|
|
|
extern bool check_track_commit_timestamp(bool *newval, void **extra,
|
|
GucSource source);
|
|
|
|
extern void TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
|
|
TransactionId *subxids, TimestampTz timestamp,
|
|
RepOriginId nodeid,
|
|
bool replaying_xlog, bool write_xlog);
|
|
extern bool TransactionIdGetCommitTsData(TransactionId xid,
|
|
TimestampTz *ts, RepOriginId *nodeid);
|
|
extern TransactionId GetLatestCommitTsData(TimestampTz *ts,
|
|
RepOriginId *nodeid);
|
|
|
|
extern Size CommitTsShmemBuffers(void);
|
|
extern Size CommitTsShmemSize(void);
|
|
extern void CommitTsShmemInit(void);
|
|
extern void BootStrapCommitTs(void);
|
|
extern void StartupCommitTs(void);
|
|
extern void ActivateCommitTs(void);
|
|
extern void DeactivateCommitTs(bool do_wal);
|
|
extern void CompleteCommitTsInitialization(void);
|
|
extern void ShutdownCommitTs(void);
|
|
extern void CheckPointCommitTs(void);
|
|
extern void ExtendCommitTs(TransactionId newestXact);
|
|
extern void TruncateCommitTs(TransactionId oldestXact, bool do_wal);
|
|
extern void SetCommitTsLimit(TransactionId oldestXact,
|
|
TransactionId newestXact);
|
|
extern void AdvanceOldestCommitTs(TransactionId oldestXact);
|
|
|
|
/* XLOG stuff */
|
|
#define COMMIT_TS_ZEROPAGE 0x00
|
|
#define COMMIT_TS_TRUNCATE 0x10
|
|
#define COMMIT_TS_SETTS 0x20
|
|
|
|
typedef struct xl_commit_ts_set
|
|
{
|
|
TimestampTz timestamp;
|
|
RepOriginId nodeid;
|
|
TransactionId mainxid;
|
|
/* subxact Xids follow */
|
|
} xl_commit_ts_set;
|
|
|
|
#define SizeOfCommitTsSet (offsetof(xl_commit_ts_set, mainxid) + \
|
|
sizeof(TransactionId))
|
|
|
|
|
|
extern void commit_ts_redo(XLogReaderState *record);
|
|
extern void commit_ts_desc(StringInfo buf, XLogReaderState *record);
|
|
extern const char *commit_ts_identify(uint8 info);
|
|
|
|
#endif /* COMMIT_TS_H */
|