]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/planet/files/default/replication-bin/replicate-changesets
Merge remote-tracking branch 'github/pull/89'
[chef.git] / cookbooks / planet / files / default / replication-bin / replicate-changesets
index 74cd53caad6e10266f5190a96382262e37894828..e71d4c5482aae3a861f250de6ddde77accafc870 100644 (file)
@@ -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)