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

Commit9b47ee6

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 parent616110e commit9b47ee6

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
@@ -1132,6 +1132,7 @@ static void
11321132
LogicalRepApplyLoop(XLogRecPtrlast_received)
11331133
{
11341134
TimestampTzlast_recv_timestamp=GetCurrentTimestamp();
1135+
boolping_sent= false;
11351136

11361137
/*
11371138
* Init the ApplyMessageContext which we clean up after each replication
@@ -1144,14 +1145,14 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
11441145
/* mark as idle, before starting to loop */
11451146
pgstat_report_activity(STATE_IDLE,NULL);
11461147

1148+
/* This outer loop iterates once per wait. */
11471149
for (;;)
11481150
{
11491151
pgsocketfd=PGINVALID_SOCKET;
11501152
intrc;
11511153
intlen;
11521154
char*buf=NULL;
11531155
boolendofstream= false;
1154-
boolping_sent= false;
11551156
longwait_time;
11561157

11571158
CHECK_FOR_INTERRUPTS();
@@ -1162,7 +1163,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
11621163

11631164
if (len!=0)
11641165
{
1165-
/*Process thedata */
1166+
/*Loop to process all availabledata (without blocking). */
11661167
for (;;)
11671168
{
11681169
CHECK_FOR_INTERRUPTS();
@@ -1331,10 +1332,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
13311332
ereport(ERROR,
13321333
(errmsg("terminating logical replication worker due to timeout")));
13331334

1334-
/*
1335-
* We didn't receive anything new, for half of receiver
1336-
* replication timeout. Ping the server.
1337-
*/
1335+
/* Check to see if it's time for a ping. */
13381336
if (!ping_sent)
13391337
{
13401338
timeout=TimestampTzPlusMilliseconds(last_recv_timestamp,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp