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

Commit78ea8b5

Browse files
committed
Fix WAL recycling on standbys depending on archive_mode
A restart point or a checkpoint recycling WAL segments treats segmentsmarked with neither ".done" (archiving is done) or ".ready" (segment isready to be archived) in archive_status the same way for archive_modebeing "on" or "always". While for a primary this is fine, a standbyrunning a restart point with archive_mode = on would try to mark such asegment as ready for archiving, which is something that will neverhappen except after the standby is promoted.Note that this problem applies only to WAL segments coming from thelocal pg_wal the first time archive recovery is run. Segments part of aself-contained base backup are the most common case where this couldhappen, however even in this case normally the .done markers would bemost likely part of the backup. Segments recovered from an archive aremarked as .ready or .done by the startup process, and segments finishedstreaming are marked as such by the WAL receiver, so they are handledalready.Reported-by: Haruka TakatsukaAuthor: Michael PaquierDiscussion:https://postgr.es/m/15402-a453c90ed4cf88b2@postgresql.orgBackpatch-through: 9.5, where archive_mode = always has been added.
1 parentaaf10f3 commit78ea8b5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,16 @@ XLogArchiveCheckDone(const char *xlog)
620620
{
621621
chararchiveStatusPath[MAXPGPATH];
622622
structstatstat_buf;
623+
boolinRecovery=RecoveryInProgress();
623624

624-
/* Always deletable if archiving is off */
625-
if (!XLogArchivingActive())
625+
/*
626+
* The file is always deletable if archive_mode is "off". On standbys
627+
* archiving is disabled if archive_mode is "on", and enabled with
628+
* "always". On a primary, archiving is enabled if archive_mode is "on"
629+
* or "always".
630+
*/
631+
if (!((XLogArchivingActive()&& !inRecovery)||
632+
(XLogArchivingAlways()&&inRecovery)))
626633
return true;
627634

628635
/* First check for .done --- this means archiver is done with it */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp