From: Matt Amos Date: Wed, 7 Sep 2016 10:31:17 +0000 (+0100) Subject: Fsync all the things, all the time. X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/bd63b8da0009075761535690e4fd9a270906b1f5?hp=707bd7579fca316f258c60d3b473c8021d74ae41 Fsync all the things, all the time. --- diff --git a/cookbooks/planet/files/default/replication-bin/replicate-changesets b/cookbooks/planet/files/default/replication-bin/replicate-changesets index 74cd53caa..e71d4c548 100644 --- a/cookbooks/planet/files/default/replication-bin/replicate-changesets +++ b/cookbooks/planet/files/default/replication-bin/replicate-changesets @@ -225,6 +225,15 @@ class Replicator fh.write(YAML.dump(@state)) end + # fsync the files in their old locations. + fsync(tmp_data) + fsync(tmp_state) + + # sync the directory as well, to ensure that the file is reachable + # from the dirent and has been updated to account for any allocations. + fdirsync(File.dirname(tmp_data)) + fdirsync(File.dirname(tmp_state)) + # sanity check: the files we're moving into place # should be non-empty. raise "Temporary gzip file should exist, but doesn't." unless File.exist?(tmp_data)