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

Commit9b8a851

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 parent63abf9a commit9b8a851

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
@@ -1077,6 +1077,7 @@ static void
10771077
LogicalRepApplyLoop(XLogRecPtrlast_received)
10781078
{
10791079
TimestampTzlast_recv_timestamp=GetCurrentTimestamp();
1080+
boolping_sent= false;
10801081

10811082
/*
10821083
* Init the ApplyMessageContext which we clean up after each replication
@@ -1089,14 +1090,14 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
10891090
/* mark as idle, before starting to loop */
10901091
pgstat_report_activity(STATE_IDLE,NULL);
10911092

1093+
/* This outer loop iterates once per wait. */
10921094
for (;;)
10931095
{
10941096
pgsocketfd=PGINVALID_SOCKET;
10951097
intrc;
10961098
intlen;
10971099
char*buf=NULL;
10981100
boolendofstream= false;
1099-
boolping_sent= false;
11001101
longwait_time;
11011102

11021103
CHECK_FOR_INTERRUPTS();
@@ -1107,7 +1108,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
11071108

11081109
if (len!=0)
11091110
{
1110-
/*Process thedata */
1111+
/*Loop to process all availabledata (without blocking). */
11111112
for (;;)
11121113
{
11131114
CHECK_FOR_INTERRUPTS();
@@ -1280,10 +1281,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
12801281
ereport(ERROR,
12811282
(errmsg("terminating logical replication worker due to timeout")));
12821283

1283-
/*
1284-
* We didn't receive anything new, for half of receiver
1285-
* replication timeout. Ping the server.
1286-
*/
1284+
/* Check to see if it's time for a ping. */
12871285
if (!ping_sent)
12881286
{
12891287
timeout=TimestampTzPlusMilliseconds(last_recv_timestamp,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp