From 51639b9dcc048d29ab6cf986378c24126a9666ce Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 27 Feb 2020 16:46:38 +0100 Subject: [PATCH 3/3] Remove HAVE_WORKING_LINK Previously, hard links were not used on Windows and Cygwin, but they support them just fine in currently supported OS versions, so we can use them there as well. Since all supported platforms now support hard links, we can remove the alternative code paths. --- src/backend/storage/file/fd.c | 12 ------------ src/include/pg_config_manual.h | 7 ------- 2 files changed, 19 deletions(-) diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 34f7443110..2baadc2453 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -788,7 +788,6 @@ durable_link_or_rename(const char *oldfile, const char *newfile, int elevel) if (fsync_fname_ext(oldfile, false, false, elevel) != 0) return -1; -#ifdef HAVE_WORKING_LINK if (link(oldfile, newfile) < 0) { ereport(elevel, @@ -798,17 +797,6 @@ durable_link_or_rename(const char *oldfile, const char *newfile, int elevel) return -1; } unlink(oldfile); -#else - /* XXX: Add racy file existence check? */ - if (rename(oldfile, newfile) < 0) - { - ereport(elevel, - (errcode_for_file_access(), - errmsg("could not rename file \"%s\" to \"%s\": %m", - oldfile, newfile))); - return -1; - } -#endif /* * Make change persistent in case of an OS crash, both the new entry and diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index b4ce53300b..d74a8dd808 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -129,13 +129,6 @@ #undef HAVE_UNIX_SOCKETS #endif -/* - * Define this if your operating system supports link() - */ -#if !defined(WIN32) && !defined(__CYGWIN__) -#define HAVE_WORKING_LINK 1 -#endif - /* * USE_POSIX_FADVISE controls whether Postgres will attempt to use the * posix_fadvise() kernel call. Usually the automatic configure tests are -- 2.25.0