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

Commit6d12cc1

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 parentb53942e commit6d12cc1

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
@@ -5334,7 +5334,7 @@ static void
53345334
exitArchiveRecovery(TimeLineIDendTLI,XLogSegNoendLogSegNo)
53355335
{
53365336
charrecoveryPath[MAXPGPATH];
5337-
charxlogpath[MAXPGPATH];
5337+
charxlogfname[MAXFNAMELEN];
53385338

53395339
/*
53405340
* We are no longer in archive recovery state.
@@ -5362,26 +5362,28 @@ exitArchiveRecovery(TimeLineID endTLI, XLogSegNo endLogSegNo)
53625362
* for the new timeline.
53635363
*
53645364
* Notify the archiver that the last WAL segment of the old timeline is
5365-
* ready to copy to archival storage. Otherwise, it is not archived for a
5366-
* while.
5365+
* ready to copy to archival storage if its .done file doesn't exist
5366+
* (e.g., if it's the restored WAL file, it's expected to have .done file).
5367+
* Otherwise, it is not archived for a while.
53675368
*/
53685369
if (endTLI!=ThisTimeLineID)
53695370
{
53705371
XLogFileCopy(endLogSegNo,endTLI,endLogSegNo);
53715372

5373+
/* Create .ready file only when neither .ready nor .done files exist */
53725374
if (XLogArchivingActive())
53735375
{
5374-
XLogFileName(xlogpath,endTLI,endLogSegNo);
5375-
XLogArchiveNotify(xlogpath);
5376+
XLogFileName(xlogfname,endTLI,endLogSegNo);
5377+
XLogArchiveCheckDone(xlogfname);
53765378
}
53775379
}
53785380

53795381
/*
53805382
* Let's just make real sure there are not .ready or .done flags posted
53815383
* for the new segment.
53825384
*/
5383-
XLogFileName(xlogpath,ThisTimeLineID,endLogSegNo);
5384-
XLogArchiveCleanup(xlogpath);
5385+
XLogFileName(xlogfname,ThisTimeLineID,endLogSegNo);
5386+
XLogArchiveCleanup(xlogfname);
53855387

53865388
/*
53875389
* Since there might be a partial WAL segment named RECOVERYXLOG, get rid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp