mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-04 03:07:20 +02:00
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
This commit is contained in:
parent
45e4067c05
commit
feed5ee475
@ -1103,6 +1103,8 @@ UpdateWorkerStats(XLogRecPtr last_lsn, TimestampTz send_time, bool reply)
|
|||||||
static void
|
static void
|
||||||
LogicalRepApplyLoop(XLogRecPtr last_received)
|
LogicalRepApplyLoop(XLogRecPtr last_received)
|
||||||
{
|
{
|
||||||
|
TimestampTz last_recv_timestamp = GetCurrentTimestamp();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init the ApplyMessageContext which we clean up after each replication
|
* Init the ApplyMessageContext which we clean up after each replication
|
||||||
* protocol message.
|
* protocol message.
|
||||||
@ -1121,7 +1123,6 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
|
|||||||
int len;
|
int len;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
bool endofstream = false;
|
bool endofstream = false;
|
||||||
TimestampTz last_recv_timestamp = GetCurrentTimestamp();
|
|
||||||
bool ping_sent = false;
|
bool ping_sent = false;
|
||||||
long wait_time;
|
long wait_time;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user