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

Commitc7371c4

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 parente64d3c5 commitc7371c4

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
@@ -5323,7 +5323,7 @@ static void
53235323
exitArchiveRecovery(TimeLineIDendTLI,XLogSegNoendLogSegNo)
53245324
{
53255325
charrecoveryPath[MAXPGPATH];
5326-
charxlogpath[MAXPGPATH];
5326+
charxlogfname[MAXFNAMELEN];
53275327

53285328
/*
53295329
* We are no longer in archive recovery state.
@@ -5351,26 +5351,28 @@ exitArchiveRecovery(TimeLineID endTLI, XLogSegNo endLogSegNo)
53515351
* for the new timeline.
53525352
*
53535353
* Notify the archiver that the last WAL segment of the old timeline is
5354-
* ready to copy to archival storage. Otherwise, it is not archived for a
5355-
* while.
5354+
* ready to copy to archival storage if its .done file doesn't exist
5355+
* (e.g., if it's the restored WAL file, it's expected to have .done file).
5356+
* Otherwise, it is not archived for a while.
53565357
*/
53575358
if (endTLI!=ThisTimeLineID)
53585359
{
53595360
XLogFileCopy(endLogSegNo,endTLI,endLogSegNo);
53605361

5362+
/* Create .ready file only when neither .ready nor .done files exist */
53615363
if (XLogArchivingActive())
53625364
{
5363-
XLogFileName(xlogpath,endTLI,endLogSegNo);
5364-
XLogArchiveNotify(xlogpath);
5365+
XLogFileName(xlogfname,endTLI,endLogSegNo);
5366+
XLogArchiveCheckDone(xlogfname);
53655367
}
53665368
}
53675369

53685370
/*
53695371
* Let's just make real sure there are not .ready or .done flags posted
53705372
* for the new segment.
53715373
*/
5372-
XLogFileName(xlogpath,ThisTimeLineID,endLogSegNo);
5373-
XLogArchiveCleanup(xlogpath);
5374+
XLogFileName(xlogfname,ThisTimeLineID,endLogSegNo);
5375+
XLogArchiveCleanup(xlogfname);
53745376

53755377
/*
53765378
* Since there might be a partial WAL segment named RECOVERYXLOG, get rid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp