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

Commitd45cd9e

Browse files
committed
Prevent the already-archived WAL file from being archived again.
Previously the archive recovery always created .ready file forthe last WAL file of the old timeline at the end of recovery even whenit's restored from the archive and has .done file. That is, there wasthe case where the WAL file had both .ready and .done files.This caused the already-archived WAL file to be archived again.This commit prevents the archive recovery from creating .ready filefor the last WAL file if it has .done file, in order to prevent it frombeing archived again.This bug was added when cascading replication feature was introduced,i.e., the commit5286105.So, back-patch to 9.2, where cascading replication was added.Reviewed by Michael Paquier
1 parent52ef33f commitd45cd9e

File tree

1 file changed

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

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,7 +4401,7 @@ static void
44014401
exitArchiveRecovery(TimeLineIDendTLI,XLogSegNoendLogSegNo)
44024402
{
44034403
charrecoveryPath[MAXPGPATH];
4404-
charxlogpath[MAXPGPATH];
4404+
charxlogfname[MAXFNAMELEN];
44054405

44064406
/*
44074407
* We are no longer in archive recovery state.
@@ -4429,26 +4429,28 @@ exitArchiveRecovery(TimeLineID endTLI, XLogSegNo endLogSegNo)
44294429
* for the new timeline.
44304430
*
44314431
* Notify the archiver that the last WAL segment of the old timeline is
4432-
* ready to copy to archival storage. Otherwise, it is not archived for a
4433-
* while.
4432+
* ready to copy to archival storage if its .done file doesn't exist
4433+
* (e.g., if it's the restored WAL file, it's expected to have .done file).
4434+
* Otherwise, it is not archived for a while.
44344435
*/
44354436
if (endTLI!=ThisTimeLineID)
44364437
{
44374438
XLogFileCopy(endLogSegNo,endTLI,endLogSegNo);
44384439

4440+
/* Create .ready file only when neither .ready nor .done files exist */
44394441
if (XLogArchivingActive())
44404442
{
4441-
XLogFileName(xlogpath,endTLI,endLogSegNo);
4442-
XLogArchiveNotify(xlogpath);
4443+
XLogFileName(xlogfname,endTLI,endLogSegNo);
4444+
XLogArchiveCheckDone(xlogfname);
44434445
}
44444446
}
44454447

44464448
/*
44474449
* Let's just make real sure there are not .ready or .done flags posted
44484450
* for the new segment.
44494451
*/
4450-
XLogFileName(xlogpath,ThisTimeLineID,endLogSegNo);
4451-
XLogArchiveCleanup(xlogpath);
4452+
XLogFileName(xlogfname,ThisTimeLineID,endLogSegNo);
4453+
XLogArchiveCleanup(xlogfname);
44524454

44534455
/*
44544456
* Since there might be a partial WAL segment named RECOVERYXLOG, get rid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp