8000 Remove special cases for ETXTBSY from new fsync'ing logic. · ilexshen/postgres@57e1138 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57e1138

Browse files
committed
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.
1 parent 1c8c656 commit 57e1138

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

src/backend/storage/file/fd.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,18 +2648,15 @@ pre_sync_fname(const char *fname, bool isdir, int elevel)
26482648
{
26492649
if (errno == EACCES || (isdir && errno == EISDIR))
26502650
return;
2651-
2652-
#ifdef ETXTBSY
2653-
if (errno == ETXTBSY)
2654-
return;
2655-
#endif
2656-
26572651
ereport(elevel,
26582652
(errcode_for_file_access(),
26592653
errmsg("could not open file \"%s\": %m", fname)));
26602654
return;
26612655
}
26622656

2657+
/*
2658+
* We ignore errors from pg_flush_data() because this is only a hint.
2659+
*/
26632660
(void) pg_flush_data(fd, 0, 0);
26642661

26652662
(void) CloseTransientFile(fd);
@@ -2703,12 +2700,6 @@ fsync_fname_ext(const char *fname, bool isdir, int elevel)
27032700
{
27042701
if (errno == EACCES || (isdir && errno == EISDIR))
27052702
return;
2706-
2707-
#ifdef ETXTBSY
2708-
if (errno == ETXTBSY)
2709-
return;
2710-
#endif
2711-
27122703
ereport(elevel,
27132704
(errcode_for_file_access(),
27142705
errmsg("could not open file \"%s\": %m", fname)));

src/bin/initdb/initdb.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,6 @@ pre_sync_fname(const char *fname, bool isdir)
619619
{
620620
if (errno == EACCES || (isdir && errno == EISDIR))
621621
return;
622-
623-
#ifdef ETXTBSY
624-
if (errno == ETXTBSY)
625-
return;
626-
#endif
627-
628622
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
629623
progname, fname, strerror(errno));
630624
return;
@@ -684,12 +678,6 @@ fsync_fname_ext(const char *fname, bool isdir)
684678
{
685679
if (errno == EACCES || (isdir && errno == EISDIR))
686680
return;
687-
688-
#ifdef ETXTBSY
689-
if (errno == ETXTBSY)
690-
return;
691-
#endif
692-
693681
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
694682
progname, fname, strerror(errno));
695683
return;

0 commit comments

Comments
 (0)
0