aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-05-29 15:11:36 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-05-29 15:11:36 -0400
commit35dd1b51f2ea7a41621b7ab04be605ecfd7cfaf7 (patch)
tree2dcd80c2152c97c1b397a18da707d6222fc8d508
parent52fc948444dde2d10f261e66766e6842231a9d46 (diff)
downloadpostgresql-35dd1b51f2ea7a41621b7ab04be605ecfd7cfaf7.tar.gz
postgresql-35dd1b51f2ea7a41621b7ab04be605ecfd7cfaf7.zip
Remove special cases for ETXTBSY from new fsync'ing logic.
The argument that this is a sufficiently-expected case to be silently ignored seems pretty thin. Andres had brought it up back when we were still considering that most fsync failures should be hard errors, and it probably would be legit not to fail hard for ETXTBSY --- but the same is true for EROFS and other cases, which is why we gave up on hard failures. ETXTBSY is surely not a normal case, so logging the failure seems fine from here.
-rw-r--r--src/backend/storage/file/fd.c15
-rw-r--r--src/bin/initdb/initdb.c12
2 files changed, 3 insertions, 24 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 09fcee92e59..7c88e731463 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2654,18 +2654,15 @@ pre_sync_fname(const char *fname, bool isdir, int elevel)
{
if (errno == EACCES || (isdir && errno == EISDIR))
return;
-
-#ifdef ETXTBSY
- if (errno == ETXTBSY)
- return;
-#endif
-
ereport(elevel,
(errcode_for_file_access(),
errmsg("could not open file \"%s\": %m", fname)));
return;
}
+ /*
+ * We ignore errors from pg_flush_data() because this is only a hint.
+ */
(void) pg_flush_data(fd, 0, 0);
(void) CloseTransientFile(fd);
@@ -2709,12 +2706,6 @@ fsync_fname_ext(const char *fname, bool isdir, int elevel)
{
if (errno == EACCES || (isdir && errno == EISDIR))
return;
-
-#ifdef ETXTBSY
- if (errno == ETXTBSY)
- return;
-#endif
-
ereport(elevel,
(errcode_for_file_access(),
errmsg("could not open file \"%s\": %m", fname)));
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 03419387a84..3c35429045e 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -625,12 +625,6 @@ pre_sync_fname(const char *fname, bool isdir)
{
if (errno == EACCES || (isdir && errno == EISDIR))
return;
-
-#ifdef ETXTBSY
- if (errno == ETXTBSY)
- return;
-#endif
-
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, fname, strerror(errno));
return;
@@ -690,12 +684,6 @@ fsync_fname_ext(const char *fname, bool isdir)
{
if (errno == EACCES || (isdir && errno == EISDIR))
return;
-
-#ifdef ETXTBSY
- if (errno == ETXTBSY)
- return;
-#endif
-
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, fname, strerror(errno));
return;