diff --git a/src/backend/replication/walreceiverfuncs.c b/src/backend/replication/walreceiverfuncs.c
index 2d6cdfe0a2..f5f55c6b7d 100644
--- a/src/backend/replication/walreceiverfuncs.c
+++ b/src/backend/replication/walreceiverfuncs.c
@@ -272,6 +272,15 @@ RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo,
 		walrcv->receivedTLI = tli;
 		walrcv->latestChunkStart = recptr;
 	}
+	/*
+	 * If it will restart the walreceiver, set the receivedUpto to the starting point,
+	 * so that the process will not read the old data before walreceiver starts.
+	 */
+	else if (launch && recptr < walrcv->receivedUpto)
+	{
+		walrcv->receivedUpto = recptr;
+		walrcv->latestChunkStart = recptr;
+	}
 	walrcv->receiveStart = recptr;
 	walrcv->receiveStartTLI = tli;
 
