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

Commit4d342b9

Browse files
committed
Archive timeline history files in standby if archive_mode is set to "always".
Previously the standby server didn't archive timeline history filesstreamed from the primary even when archive_mode is set to "always",while it archives the streamed WAL files. This could cause the PITR tofail because there was no required timeline history file in the archive.The cause of this issue was that walreceiver didn't mark those files asready for archiving.This commit makes walreceiver mark those streamed timeline historyfiles as ready for archiving if archive_mode=always. Then the archiverprocess archives the marked timeline history files.Back-patch to all supported versions.Reported-by: Grigory SmolkinAuthor: Grigory Smolkin, Fujii MasaoReviewed-by: David Zhang, Anastasia LubennikovaDiscussion:https://postgr.es/m/54b059d4-2b48-13a4-6f43-95a087c92367@postgrespro.ru
1 parent8aa4496 commit4d342b9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎doc/src/sgml/high-availability.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,8 @@ synchronous_standby_names = 'ANY 2 (s1, s2, s3)'
13851385
If <varname>archive_mode</varname> is set to <literal>on</literal>, the
13861386
archiver is not enabled during recovery or standby mode. If the standby
13871387
server is promoted, it will start archiving after the promotion, but
1388-
will not archive any WAL it did not generate itself. To get a complete
1388+
will not archive any WAL or timeline history files that
1389+
it did not generate itself. To get a complete
13891390
series of WAL files in the archive, you must ensure that all WAL is
13901391
archived, before it reaches the standby. This is inherently true with
13911392
file-based log shipping, as the standby can only restore files that

‎src/backend/replication/walreceiver.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,15 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
719719
*/
720720
writeTimeLineHistoryFile(tli,content,len);
721721

722+
/*
723+
* Mark the streamed history file as ready for archiving
724+
* if archive_mode is always.
725+
*/
726+
if (XLogArchiveMode!=ARCHIVE_MODE_ALWAYS)
727+
XLogArchiveForceDone(fname);
728+
else
729+
XLogArchiveNotify(fname);
730+
722731
pfree(fname);
723732
pfree(content);
724733
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp