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

Commitc8746f9

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 parent9a85103 commitc8746f9

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
@@ -2060,6 +2060,7 @@ static void
20602060
LogicalRepApplyLoop(XLogRecPtrlast_received)
20612061
{
20622062
TimestampTzlast_recv_timestamp=GetCurrentTimestamp();
2063+
boolping_sent= false;
20632064

20642065
/*
20652066
* Init the ApplyMessageContext which we clean up after each replication
@@ -2080,14 +2081,14 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
20802081
/* mark as idle, before starting to loop */
20812082
pgstat_report_activity(STATE_IDLE,NULL);
20822083

2084+
/* This outer loop iterates once per wait. */
20832085
for (;;)
20842086
{
20852087
pgsocketfd=PGINVALID_SOCKET;
20862088
intrc;
20872089
intlen;
20882090
char*buf=NULL;
20892091
boolendofstream= false;
2090-
boolping_sent= false;
20912092
longwait_time;
20922093

20932094
CHECK_FOR_INTERRUPTS();
@@ -2098,7 +2099,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
20982099

20992100
if (len!=0)
21002101
{
2101-
/*Process thedata */
2102+
/*Loop to process all availabledata (without blocking). */
21022103
for (;;)
21032104
{
21042105
CHECK_FOR_INTERRUPTS();
@@ -2267,10 +2268,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
22672268
ereport(ERROR,
22682269
(errmsg("terminating logical replication worker due to timeout")));
22692270

2270-
/*
2271-
* We didn't receive anything new, for half of receiver
2272-
* replication timeout. Ping the server.
2273-
*/
2271+
/* Check to see if it's time for a ping. */
22742272
if (!ping_sent)
22752273
{
22762274
timeout=TimestampTzPlusMilliseconds(last_recv_timestamp,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp