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

Commit090e8a9

Browse files
Wake WALSender to reduce data loss at failover for async commit.
WALSender now woken up after each background flush by WALwriter, avoidingmulti-second replication delay for an all-async commit workload.Replication delay reduced from 7s with default settings to 200ms, allowingsignificantly reduced data loss at failover.Andres Freund and Simon Riggs
1 parent110ebff commit090e8a9

File tree

1 file changed

+9
-0
lines changed
  • src/backend/access/transam

1 file changed

+9
-0
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,6 +2115,7 @@ XLogBackgroundFlush(void)
21152115
{
21162116
XLogRecPtrWriteRqstPtr;
21172117
boolflexible= true;
2118+
boolwrote_something= false;
21182119

21192120
/* XLOG doesn't need flushing during recovery */
21202121
if (RecoveryInProgress())
@@ -2183,10 +2184,18 @@ XLogBackgroundFlush(void)
21832184
WriteRqst.Write=WriteRqstPtr;
21842185
WriteRqst.Flush=WriteRqstPtr;
21852186
XLogWrite(WriteRqst,flexible, false);
2187+
wrote_something= true;
21862188
}
21872189
LWLockRelease(WALWriteLock);
21882190

21892191
END_CRIT_SECTION();
2192+
2193+
/*
2194+
* If we wrote something then we have something to send to standbys also,
2195+
* otherwise the replication delay become around 7s with just async commit.
2196+
*/
2197+
if (wrote_something)
2198+
WalSndWakeup();
21902199
}
21912200

21922201
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp