mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Ensure all replication message info is available and correct via WalRcv
This commit is contained in:
parent
be690e291d
commit
87d8bd7c9f
@ -218,7 +218,7 @@ WalReceiverMain(void)
|
||||
startpoint = walrcv->receiveStart;
|
||||
|
||||
/* Initialise to a sanish value */
|
||||
walrcv->lastMsgSendTime = walrcv->lastMsgReceiptTime = GetCurrentTimestamp();
|
||||
walrcv->lastMsgSendTime = walrcv->lastMsgReceiptTime = walrcv->latestWalEndTime = GetCurrentTimestamp();
|
||||
|
||||
SpinLockRelease(&walrcv->mutex);
|
||||
|
||||
@ -749,6 +749,9 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
|
||||
|
||||
/* Update shared-memory status */
|
||||
SpinLockAcquire(&walrcv->mutex);
|
||||
if (XLByteLT(walrcv->latestWalEnd, walEnd))
|
||||
walrcv->latestWalEndTime = sendTime;
|
||||
walrcv->latestWalEnd = walEnd;
|
||||
walrcv->lastMsgSendTime = sendTime;
|
||||
walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
|
||||
SpinLockRelease(&walrcv->mutex);
|
||||
|
@ -260,7 +260,7 @@ GetReplicationApplyDelay(void)
|
||||
|
||||
replayPtr = GetXLogReplayRecPtr(NULL);
|
||||
|
||||
if (XLByteLE(receivePtr, replayPtr))
|
||||
if (XLByteEQ(receivePtr, replayPtr))
|
||||
return 0;
|
||||
|
||||
TimestampDifference(GetCurrentChunkReplayStartTime(),
|
||||
|
@ -83,6 +83,12 @@ typedef struct
|
||||
TimestampTz lastMsgSendTime;
|
||||
TimestampTz lastMsgReceiptTime;
|
||||
|
||||
/*
|
||||
* Latest reported end of WAL on the sender
|
||||
*/
|
||||
XLogRecPtr latestWalEnd;
|
||||
TimestampTz latestWalEndTime;
|
||||
|
||||
/*
|
||||
* connection string; is used for walreceiver to connect with the primary.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user