Skip to content

Commit 3f60f69

Browse files
committed
Fix timeout handling in logical replication worker
The timestamp tracking the last moment a message is received in a logical replication worker was initialized in each loop checking if a message was received or not, causing wal_receiver_timeout to be ignored in basically any logical replication deployments. This also broke the ping sent to the server when reaching half of wal_receiver_timeout. This simply moves the initialization of the timestamp out of the apply loop to the beginning of LogicalRepApplyLoop(). Reported-by: Jehan-Guillaume De Rorthais Author: Julien Rouhaud Discussion: https://postgr.es/m/CAOBaU_ZHESFcWva8jLjtZdCLspMj7vqaB2k++rjHLY897ZxbYw@mail.gmail.com Backpatch-through: 10
1 parent 38ddeab commit 3f60f69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/replication/logical/worker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,8 @@ UpdateWorkerStats(XLogRecPtr last_lsn, TimestampTz send_time, bool reply)
10891089
static void
10901090
LogicalRepApplyLoop(XLogRecPtr last_received)
10911091
{
1092+
TimestampTz last_recv_timestamp = GetCurrentTimestamp();
1093+
10921094
/*
10931095
* Init the ApplyMessageContext which we clean up after each replication
10941096
* protocol message.
@@ -1107,7 +1109,6 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
11071109
int len;
11081110
char *buf = NULL;
11091111
bool endofstream = false;
1110-
TimestampTz last_recv_timestamp = GetCurrentTimestamp();
11111112
bool ping_sent = false;
11121113
long wait_time;
11131114

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy