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

Commit7899aa3

Browse files
committed
Fix bug in clean shutdown of walsender that pg_receiving is connecting to.
On clean shutdown, walsender waits for all WAL to be replicated to a standby,and exits. It determined whether that replication had been completed bychecking whether its sent location had been equal to a standby's flushlocation. Unfortunately this condition never becomes true when the standbysuch as pg_receivexlog which always returns an invalid flush location isconnecting to walsender, and then walsender waits forever.This commit changes walsender so that it just checks a standby's writelocation if a flush location is invalid.Back-patch to 9.1 where enough infrastructure for this exists.
1 parentba5946e commit7899aa3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/backend/replication/walsender.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,20 @@ WalSndLoop(void)
808808
*/
809809
if (walsender_ready_to_stop)
810810
{
811+
XLogRecPtrreplicatedPtr;
812+
811813
/* ... let's just be real sure we're caught up ... */
812814
XLogSend(output_message,&caughtup);
813-
if (caughtup&&XLByteEQ(sentPtr,MyWalSnd->flush)&&
815+
816+
/*
817+
* Check a write location to see whether all the WAL have
818+
* successfully been replicated if this walsender is connecting
819+
* to a standby such as pg_receivexlog which always returns
820+
* an invalid flush location. Otherwise, check a flush location.
821+
*/
822+
replicatedPtr=XLogRecPtrIsInvalid(MyWalSnd->flush) ?
823+
MyWalSnd->write :MyWalSnd->flush;
824+
if (caughtup&&XLByteEQ(sentPtr,replicatedPtr)&&
814825
!pq_is_send_pending())
815826
{
816827
walsender_shutdown_requested= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp