Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8c46f0c

Browse files
committed
Don't fsync() files when --no-sync is specified
Michael Paquier
1 parent 10c064c commit 8c46f0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bin/pg_basebackup/walmethods.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ tar_sync(Walfile f)
611611
Assert(f != NULL);
612612
tar_clear_error();
613613

614+
if (!tar_data->sync)
615+
return 0;
616+
614617
/*
615618
* Always sync the whole tarfile, because that's all we can do. This makes
616619
* no sense on compressed files, so just ignore those.
@@ -842,7 +845,8 @@ tar_finish(void)
842845
#endif
843846

844847
/* sync the empty blocks as well, since they're after the last file */
845-
fsync(tar_data->fd);
848+
if (tar_data->sync)
849+
fsync(tar_data->fd);
846850

847851
if (close(tar_data->fd) != 0)
848852
return false;

0 commit comments

Comments
 (0)