mirror of
https://github.com/postgres/postgres.git
synced 2025-06-02 00:01:40 -04:00
Ensure all replication message info is available and correct via WalRcv
This commit is contained in:
parent
6f4b8a4f4f
commit
6a2cbe1235
@ -219,7 +219,7 @@ WalReceiverMain(void)
|
|||||||
startpoint = walrcv->receiveStart;
|
startpoint = walrcv->receiveStart;
|
||||||
|
|
||||||
/* Initialise to a sanish value */
|
/* Initialise to a sanish value */
|
||||||
walrcv->lastMsgSendTime = walrcv->lastMsgReceiptTime = GetCurrentTimestamp();
|
walrcv->lastMsgSendTime = walrcv->lastMsgReceiptTime = walrcv->latestWalEndTime = GetCurrentTimestamp();
|
||||||
|
|
||||||
SpinLockRelease(&walrcv->mutex);
|
SpinLockRelease(&walrcv->mutex);
|
||||||
|
|
||||||
@ -759,6 +759,9 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
|
|||||||
|
|
||||||
/* Update shared-memory status */
|
/* Update shared-memory status */
|
||||||
SpinLockAcquire(&walrcv->mutex);
|
SpinLockAcquire(&walrcv->mutex);
|
||||||
|
if (XLByteLT(walrcv->latestWalEnd, walEnd))
|
||||||
|
walrcv->latestWalEndTime = sendTime;
|
||||||
|
walrcv->latestWalEnd = walEnd;
|
||||||
walrcv->lastMsgSendTime = sendTime;
|
walrcv->lastMsgSendTime = sendTime;
|
||||||
walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
|
walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
|
||||||
SpinLockRelease(&walrcv->mutex);
|
SpinLockRelease(&walrcv->mutex);
|
||||||
|
@ -261,7 +261,7 @@ GetReplicationApplyDelay(void)
|
|||||||
|
|
||||||
replayPtr = GetXLogReplayRecPtr(NULL);
|
replayPtr = GetXLogReplayRecPtr(NULL);
|
||||||
|
|
||||||
if (XLByteLE(receivePtr, replayPtr))
|
if (XLByteEQ(receivePtr, replayPtr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TimestampDifference(GetCurrentChunkReplayStartTime(),
|
TimestampDifference(GetCurrentChunkReplayStartTime(),
|
||||||
|
@ -83,6 +83,12 @@ typedef struct
|
|||||||
TimestampTz lastMsgSendTime;
|
TimestampTz lastMsgSendTime;
|
||||||
TimestampTz lastMsgReceiptTime;
|
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.
|
* connection string; is used for walreceiver to connect with the primary.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user