浏览代码

repository: sync write file in get_fd

this fixes a strange test failure that did not happen until now:
it could not read the MAGIC bytes from a (quite new) segment file,
it just returned the empty string.

maybe its appearance is related to the removed I/O calls.
Thomas Waldmann 3 年之前
父节点
当前提交
bf9f42320e
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/borg/repository.py

+ 3 - 0
src/borg/repository.py

@@ -1462,6 +1462,9 @@ class LoggedIO:
                         del self.fds[k]
 
         clean_old()
+        if self._write_fd is not None:
+            # without this, we have a test failure now
+            self._write_fd.sync()
         try:
             ts, fd = self.fds[segment]
         except KeyError: