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

Commit16222f3

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 parent5c35328 commit16222f3

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
@@ -2168,6 +2168,7 @@ XLogBackgroundFlush(void)
21682168
{
21692169
XLogRecPtrWriteRqstPtr;
21702170
boolflexible= true;
2171+
boolwrote_something= false;
21712172

21722173
/* XLOG doesn't need flushing during recovery */
21732174
if (RecoveryInProgress())
@@ -2236,10 +2237,18 @@ XLogBackgroundFlush(void)
22362237
WriteRqst.Write=WriteRqstPtr;
22372238
WriteRqst.Flush=WriteRqstPtr;
22382239
XLogWrite(WriteRqst,flexible, false);
2240+
wrote_something= true;
22392241
}
22402242
LWLockRelease(WALWriteLock);
22412243

22422244
END_CRIT_SECTION();
2245+
2246+
/*
2247+
* If we wrote something then we have something to send to standbys also,
2248+
* otherwise the replication delay become around 7s with just async commit.
2249+
*/
2250+
if (wrote_something)
2251+
WalSndWakeup();
22432252
}
22442253

22452254
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp