Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6a2cbe1

Browse files
Ensure all replication message info is available and correct via WalRcv
1 parent6f4b8a4 commit6a2cbe1

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

‎src/backend/replication/walreceiver.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ WalReceiverMain(void)
219219
startpoint=walrcv->receiveStart;
220220

221221
/* Initialise to a sanish value */
222-
walrcv->lastMsgSendTime=walrcv->lastMsgReceiptTime=GetCurrentTimestamp();
222+
walrcv->lastMsgSendTime=walrcv->lastMsgReceiptTime=walrcv->latestWalEndTime=GetCurrentTimestamp();
223223

224224
SpinLockRelease(&walrcv->mutex);
225225

@@ -759,6 +759,9 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
759759

760760
/* Update shared-memory status */
761761
SpinLockAcquire(&walrcv->mutex);
762+
if (XLByteLT(walrcv->latestWalEnd,walEnd))
763+
walrcv->latestWalEndTime=sendTime;
764+
walrcv->latestWalEnd=walEnd;
762765
walrcv->lastMsgSendTime=sendTime;
763766
walrcv->lastMsgReceiptTime=lastMsgReceiptTime;
764767
SpinLockRelease(&walrcv->mutex);

‎src/backend/replication/walreceiverfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ GetReplicationApplyDelay(void)
261261

262262
replayPtr=GetXLogReplayRecPtr(NULL);
263263

264-
if (XLByteLE(receivePtr,replayPtr))
264+
if (XLByteEQ(receivePtr,replayPtr))
265265
return0;
266266

267267
TimestampDifference(GetCurrentChunkReplayStartTime(),

‎src/include/replication/walreceiver.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ typedef struct
8383
TimestampTzlastMsgSendTime;
8484
TimestampTzlastMsgReceiptTime;
8585

86+
/*
87+
* Latest reported end of WAL on the sender
88+
*/
89+
XLogRecPtrlatestWalEnd;
90+
TimestampTzlatestWalEndTime;
91+
8692
/*
8793
* connection string; is used for walreceiver to connect with the primary.
8894
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp