From b062d7736423dda1720b0974e76f9cc137d2f426 Mon Sep 17 00:00:00 2001 From: movead Date: Tue, 29 Jun 2021 19:19:26 +0800 Subject: [PATCH] fix issue that receive thread has no chance to send a feedback --- src/bin/pg_basebackup/receivelog.cpp | 4 ++-- src/bin/pg_ctl/receivelog.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/pg_basebackup/receivelog.cpp b/src/bin/pg_basebackup/receivelog.cpp index 5a18a3e32..6c52a1661 100644 --- a/src/bin/pg_basebackup/receivelog.cpp +++ b/src/bin/pg_basebackup/receivelog.cpp @@ -709,10 +709,10 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const if (standby_message_timeout_local) { #ifdef HAVE_INT64_TIMESTAMP timeout.tv_sec = CalculateCopyStreamSleeptime(local_now, - standby_message_timeout_local, + standby_message_timeout_local / 2, last_status); #else - timeout.tv_sec = last_status + standby_message_timeout_local - local_now - 1; + timeout.tv_sec = last_status + (standby_message_timeout_local / 2) - local_now - 1; #endif if (timeout.tv_sec <= 0) timeout.tv_sec = 1; /* Always sleep at least 1 sec */ diff --git a/src/bin/pg_ctl/receivelog.cpp b/src/bin/pg_ctl/receivelog.cpp index 95f533dbd..ace5bc32d 100644 --- a/src/bin/pg_ctl/receivelog.cpp +++ b/src/bin/pg_ctl/receivelog.cpp @@ -665,7 +665,7 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const FD_ZERO(&input_mask); FD_SET(PQsocket(conn), &input_mask); if (standby_message_timeout) { - timeout.tv_sec = last_status + standby_message_timeout - local_now - 1; + timeout.tv_sec = last_status + (standby_message_timeout / 2) - local_now - 1; if (timeout.tv_sec <= 0) timeout.tv_sec = 1; /* Always sleep at least 1 sec */ timeout.tv_usec = 0;