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

Commit87d8bd7

Browse files
Ensure all replication message info is available and correct via WalRcv
1 parentbe690e2 commit87d8bd7

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
@@ -218,7 +218,7 @@ WalReceiverMain(void)
218218
startpoint=walrcv->receiveStart;
219219

220220
/* Initialise to a sanish value */
221-
walrcv->lastMsgSendTime=walrcv->lastMsgReceiptTime=GetCurrentTimestamp();
221+
walrcv->lastMsgSendTime=walrcv->lastMsgReceiptTime=walrcv->latestWalEndTime=GetCurrentTimestamp();
222222

223223
SpinLockRelease(&walrcv->mutex);
224224

@@ -749,6 +749,9 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
749749

750750
/* Update shared-memory status */
751751
SpinLockAcquire(&walrcv->mutex);
752+
if (XLByteLT(walrcv->latestWalEnd,walEnd))
753+
walrcv->latestWalEndTime=sendTime;
754+
walrcv->latestWalEnd=walEnd;
752755
walrcv->lastMsgSendTime=sendTime;
753756
walrcv->lastMsgReceiptTime=lastMsgReceiptTime;
754757
SpinLockRelease(&walrcv->mutex);

‎src/backend/replication/walreceiverfuncs.c

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

261261
replayPtr=GetXLogReplayRecPtr(NULL);
262262

263-
if (XLByteLE(receivePtr,replayPtr))
263+
if (XLByteEQ(receivePtr,replayPtr))
264264
return0;
265265

266266
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