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

Commitdd85acf

Browse files
committed
Make recovery rename tablespace_map to *.old if backup_label is not present.
If tablespace_map file is present without backup_label file, there isno use of such file. There is no harm in retaining it, but it is betterto get rid of the map file so that we don't have any redundant filein data directory and it will avoid any sort of confusion. It seemsprudent though to just rename the file out of the way rather thandelete it completely, also we ignore any error that occurs in renameoperation as even if map file is present without backup_label file,it is harmless.Back-patch to 9.5 where tablespace_map file was introduced.Amit Kapila, reviewed by Robert Haas, Alvaro Herrera and me.
1 parent0e42397 commitdd85acf

File tree

1 file changed

+28
-0
lines changed
  • src/backend/access/transam

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5912,6 +5912,7 @@ StartupXLOG(void)
59125912
XLogReaderState*xlogreader;
59135913
XLogPageReadPrivateprivate;
59145914
boolfast_promoted= false;
5915+
structstatst;
59155916

59165917
/*
59175918
* Read control file and check XLOG status looks valid.
@@ -6138,6 +6139,33 @@ StartupXLOG(void)
61386139
}
61396140
else
61406141
{
6142+
/*
6143+
* If tablespace_map file is present without backup_label file, there
6144+
* is no use of such file. There is no harm in retaining it, but it
6145+
* is better to get rid of the map file so that we don't have any
6146+
* redundant file in data directory and it will avoid any sort of
6147+
* confusion. It seems prudent though to just rename the file out
6148+
* of the way rather than delete it completely, also we ignore any
6149+
* error that occurs in rename operation as even if map file is
6150+
* present without backup_label file, it is harmless.
6151+
*/
6152+
if (stat(TABLESPACE_MAP,&st)==0)
6153+
{
6154+
unlink(TABLESPACE_MAP_OLD);
6155+
if (rename(TABLESPACE_MAP,TABLESPACE_MAP_OLD)==0)
6156+
ereport(LOG,
6157+
(errmsg("ignoring \"%s\" file because no \"%s\" file exists",
6158+
TABLESPACE_MAP,BACKUP_LABEL_FILE),
6159+
errdetail("\"%s\" was renamed to \"%s\".",
6160+
TABLESPACE_MAP,TABLESPACE_MAP_OLD)));
6161+
else
6162+
ereport(LOG,
6163+
(errmsg("ignoring \"%s\" file because no \"%s\" file exists",
6164+
TABLESPACE_MAP,BACKUP_LABEL_FILE),
6165+
errdetail("Could not rename file \"%s\" to \"%s\": %m.",
6166+
TABLESPACE_MAP,TABLESPACE_MAP_OLD)));
6167+
}
6168+
61416169
/*
61426170
* It's possible that archive recovery was requested, but we don't
61436171
* know how far we need to replay the WAL before we reach consistency.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp