Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b81a30

Browse files
committed
Fix over-eager ping'ing in logical replication receiver.
Commit3f60f69 only partially fixed the broken-status-trackingissue in LogicalRepApplyLoop: we need ping_sent to have the samelifetime as last_recv_timestamp. The effects are much less seriousthan what that commit fixed, though. AFAICS this would just lead toextra ping requests being sent, once per second until the senderresponds. Still, it's a bug, so backpatch to v10 as before.Discussion:https://postgr.es/m/959627.1599248476@sss.pgh.pa.us
1 parent4a4f3bf commit9b81a30

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎src/backend/replication/logical/worker.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ static void
14911491
LogicalRepApplyLoop(XLogRecPtrlast_received)
14921492
{
14931493
TimestampTzlast_recv_timestamp=GetCurrentTimestamp();
1494+
boolping_sent= false;
14941495

14951496
/*
14961497
* Init the ApplyMessageContext which we clean up after each replication
@@ -1503,14 +1504,14 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
15031504
/* mark as idle, before starting to loop */
15041505
pgstat_report_activity(STATE_IDLE,NULL);
15051506

1507+
/* This outer loop iterates once per wait. */
15061508
for (;;)
15071509
{
15081510
pgsocketfd=PGINVALID_SOCKET;
15091511
intrc;
15101512
intlen;
15111513
char*buf=NULL;
15121514
boolendofstream= false;
1513-
boolping_sent= false;
15141515
longwait_time;
15151516

15161517
CHECK_FOR_INTERRUPTS();
@@ -1521,7 +1522,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
15211522

15221523
if (len!=0)
15231524
{
1524-
/*Process thedata */
1525+
/*Loop to process all availabledata (without blocking). */
15251526
for (;;)
15261527
{
15271528
CHECK_FOR_INTERRUPTS();
@@ -1690,10 +1691,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
16901691
ereport(ERROR,
16911692
(errmsg("terminating logical replication worker due to timeout")));
16921693

1693-
/*
1694-
* We didn't receive anything new, for half of receiver
1695-
* replication timeout. Ping the server.
1696-
*/
1694+
/* Check to see if it's time for a ping. */
16971695
if (!ping_sent)
16981696
{
16991697
timeout=TimestampTzPlusMilliseconds(last_recv_timestamp,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp