Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6a392cc

Browse files
author
Commitfest Bot
committed
[CF 5199] v2 - Fix standby may crash when switching-over in certain special cases
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5199 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/CAAccyYKzMZiq5xOjUkjhvxth8V+yiNuyX=9xcnLM_yBM9oYWFQ@mail.gmail.com Author(s): pixian shi
2 parents daa1689 + 45821f4 commit 6a392cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/replication/walreceiverfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo,
298298
walrcv->startTime = now;
299299

300300
/*
301-
* If this is the first startup of walreceiver (on this timeline),
301+
* If this is the first startup of walreceiver (on this timeline) or recptr lt last flushedLsn,
302302
* initialize flushedUpto and latestChunkStart to the starting point.
303303
*/
304-
if (walrcv->receiveStart == 0 || walrcv->receivedTLI != tli)
304+
if (walrcv->receiveStart == 0 || walrcv->receivedTLI != tli || recptr < walrcv->receiveStart)
305305
{
306306
walrcv->flushedUpto = recptr;
307307
walrcv->receivedTLI = tli;

0 commit comments

Comments
 (0)