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

Commit2e1b4ad

Browse files
committed
Remember asking for feedback during walsender shutdown.
Since5a991ef we're explicitly asking for feedback from the receivingside when shutting down walsender, if there's not yet replicateddata.Unfortunately we didn't remember (i.e. set waiting_for_ping_response totrue) having asked for feedback, leading to scenarios in which replieswere requested at a high frequency.I can't reproduce this problem on my laptop, I think that's because theproblem requires a significant TCP window to manifest due to the!pq_is_send_pending() condition. But since this clearly is a bug, let'sfix it. There's quite possibly more wrong than just this though.While fiddling with WalSndDone(), I rewrote a hard to understand commentabout looking at the flush vs. the write position.Reported-By: Nick Cleaton, Magnus HaganderAuthor: Nick CleatonDiscussion: CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ@mail.gmail.com CABUevExsjROqDcD0A2rnJ6HK6FuKGyewJr3PL12pw85BHFGS2Q@mail.gmail.comBackpatch: 9.4, were5a991ef introduced the use of feedback messages during shutdown.
1 parent94a1653 commit2e1b4ad

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/replication/walsender.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,13 +2486,14 @@ WalSndDone(WalSndSendDataCallback send_data)
24862486
send_data();
24872487

24882488
/*
2489-
*Check a write location to seewhether alltheWALhave successfully
2490-
*been replicated ifthis walsender is connecting to a standby such as
2491-
*pg_receivexlog which always returnsan invalid flush location.
2492-
*Otherwise, check a flushlocation.
2489+
*To figure outwhether all WALhas successfully been replicated, check
2490+
*flush location ifvalid, write otherwise. Tools like pg_receivexlog
2491+
*will usually (unless in synchronous mode) returnan invalid flush
2492+
* location.
24932493
*/
24942494
replicatedPtr=XLogRecPtrIsInvalid(MyWalSnd->flush) ?
24952495
MyWalSnd->write :MyWalSnd->flush;
2496+
24962497
if (WalSndCaughtUp&&sentPtr==replicatedPtr&&
24972498
!pq_is_send_pending())
24982499
{
@@ -2503,7 +2504,10 @@ WalSndDone(WalSndSendDataCallback send_data)
25032504
proc_exit(0);
25042505
}
25052506
if (!waiting_for_ping_response)
2507+
{
25062508
WalSndKeepalive(true);
2509+
waiting_for_ping_response= true;
2510+
}
25072511
}
25082512

25092513
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp