summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorSimon Riggs2011-02-16 19:29:37 +0000
committerSimon Riggs2011-02-16 19:29:37 +0000
commitbca8b7f16a3e720794cb0afbdb3733be4f8d9c2c (patch)
tree4d2e650f058ffa99af77f9068bf64a223de17246 /src/include
parent65076269ea54a8cd6e39f066a208c7d13aceac0a (diff)
Hot Standby feedback for avoidance of cleanup conflicts on standby.
Standby optionally sends back information about oldestXmin of queries which is then checked and applied to the WALSender's proc->xmin. GetOldestXmin() is modified slightly to agree with GetSnapshotData(), so that all backends on primary include WALSender within their snapshots. Note this does nothing to change the snapshot xmin on either master or standby. Feedback piggybacks on the standby reply message. vacuum_defer_cleanup_age is no longer used on standby, though parameter still exists on primary, since some use cases still exist. Simon Riggs, review comments from Fujii Masao, Heikki Linnakangas, Robert Haas
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/xlog.h1
-rw-r--r--src/include/replication/walprotocol.h9
-rw-r--r--src/include/replication/walreceiver.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 7cd07a25d22..7e9bad6e3a4 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -289,6 +289,7 @@ extern void xlog_desc(StringInfo buf, uint8 xl_info, char *rec);
extern void issue_xlog_fsync(int fd, uint32 log, uint32 seg);
extern bool RecoveryInProgress(void);
+extern bool HotStandbyActive(void);
extern bool XLogInsertAllowed(void);
extern void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream);
extern XLogRecPtr GetXLogReplayRecPtr(void);
diff --git a/src/include/replication/walprotocol.h b/src/include/replication/walprotocol.h
index 32c49620c1d..da94b6b2f30 100644
--- a/src/include/replication/walprotocol.h
+++ b/src/include/replication/walprotocol.h
@@ -56,6 +56,15 @@ typedef struct
XLogRecPtr flush;
XLogRecPtr apply;
+ /*
+ * The current xmin and epoch from the standby, for Hot Standby feedback.
+ * This may be invalid if the standby-side does not support feedback,
+ * or Hot Standby is not yet available.
+ */
+ TransactionId xmin;
+ uint32 epoch;
+
+
/* Sender's system clock at the time of transmission */
TimestampTz sendTime;
} StandbyReplyMessage;
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index aa5bfb7aea1..9137b861c7d 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -18,6 +18,7 @@
extern bool am_walreceiver;
extern int wal_receiver_status_interval;
+extern bool hot_standby_feedback;
/*
* MAXCONNINFO: maximum size of a connection string.