diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/timeline.c | 18 | ||||
-rw-r--r-- | src/backend/access/transam/xlog.c | 10 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index be21968293c..c9344e5e8b4 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -439,14 +439,11 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, /* * Now move the completed history file into place with its final name. + * The target file should not exist. */ TLHistoryFilePath(path, newTLI); - - /* - * Perform the rename using link if available, paranoidly trying to avoid - * overwriting an existing file (there shouldn't be one). - */ - durable_rename_excl(tmppath, path, ERROR); + Assert(access(path, F_OK) != 0 && errno == ENOENT); + durable_rename(tmppath, path, ERROR); /* The history file can be archived immediately. */ if (XLogArchivingActive()) @@ -517,14 +514,11 @@ writeTimeLineHistoryFile(TimeLineID tli, char *content, int size) /* * Now move the completed history file into place with its final name. + * The target file should not exist. */ TLHistoryFilePath(path, tli); - - /* - * Perform the rename using link if available, paranoidly trying to avoid - * overwriting an existing file (there shouldn't be one). - */ - durable_rename_excl(tmppath, path, ERROR); + Assert(access(path, F_OK) != 0 && errno == ENOENT); + durable_rename(tmppath, path, ERROR); } /* diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 61cda56c6ff..45c84e3959c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3323,14 +3323,12 @@ InstallXLogFileSegment(XLogSegNo *segno, char *tmppath, } } - /* - * Perform the rename using link if available, paranoidly trying to avoid - * overwriting an existing file (there shouldn't be one). - */ - if (durable_rename_excl(tmppath, path, LOG) != 0) + /* The target file should not exist */ + Assert(access(path, F_OK) != 0 && errno == ENOENT); + if (durable_rename(tmppath, path, LOG) != 0) { LWLockRelease(ControlFileLock); - /* durable_rename_excl already emitted log message */ + /* durable_rename already emitted log message */ return false; } |