mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Send new protocol keepalive messages to standby servers.
Allows streaming replication users to calculate transfer latency and apply delay via internal functions. No external functions yet.
This commit is contained in:
@@ -16,6 +16,20 @@
|
||||
#include "datatype/timestamp.h"
|
||||
|
||||
|
||||
/*
|
||||
* All messages from WalSender must contain these fields to allow us to
|
||||
* correctly calculate the replication delay.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* Current end of WAL on the sender */
|
||||
XLogRecPtr walEnd;
|
||||
|
||||
/* Sender's system clock at the time of transmission */
|
||||
TimestampTz sendTime;
|
||||
} WalSndrMessage;
|
||||
|
||||
|
||||
/*
|
||||
* Header for a WAL data message (message type 'w'). This is wrapped within
|
||||
* a CopyData message at the FE/BE protocol level.
|
||||
@@ -39,6 +53,14 @@ typedef struct
|
||||
TimestampTz sendTime;
|
||||
} WalDataMessageHeader;
|
||||
|
||||
/*
|
||||
* Keepalive message from primary (message type 'k'). (lowercase k)
|
||||
* This is wrapped within a CopyData message at the FE/BE protocol level.
|
||||
*
|
||||
* Note that the data length is not specified here.
|
||||
*/
|
||||
typedef WalSndrMessage PrimaryKeepaliveMessage;
|
||||
|
||||
/*
|
||||
* Reply message from standby (message type 'r'). This is wrapped within
|
||||
* a CopyData message at the FE/BE protocol level.
|
||||
|
@@ -78,6 +78,12 @@ typedef struct
|
||||
*/
|
||||
XLogRecPtr latestChunkStart;
|
||||
|
||||
/*
|
||||
* Time of send and receive of any message received.
|
||||
*/
|
||||
TimestampTz lastMsgSendTime;
|
||||
TimestampTz lastMsgReceiptTime;
|
||||
|
||||
/*
|
||||
* connection string; is used for walreceiver to connect with the primary.
|
||||
*/
|
||||
@@ -112,5 +118,7 @@ extern void ShutdownWalRcv(void);
|
||||
extern bool WalRcvInProgress(void);
|
||||
extern void RequestXLogStreaming(XLogRecPtr recptr, const char *conninfo);
|
||||
extern XLogRecPtr GetWalRcvWriteRecPtr(XLogRecPtr *latestChunkStart);
|
||||
extern int GetReplicationApplyDelay(void);
|
||||
extern int GetReplicationTransferLatency(void);
|
||||
|
||||
#endif /* _WALRECEIVER_H */
|
||||
|
Reference in New Issue
Block a user