Merge "Fix incorrect passing of file object to fsync()"

This commit is contained in:
Jenkins 2015-05-01 17:06:48 +00:00 committed by Gerrit Code Review
commit 65f28ae105
2 changed files with 3 additions and 4 deletions

View File

@ -1786,8 +1786,8 @@ class ECDiskFileWriter(DiskFileWriter):
def _finalize_durable(self, durable_file_path):
exc = msg = None
try:
with open(durable_file_path, 'w') as _fd:
fsync(_fd)
with open(durable_file_path, 'w') as _fp:
fsync(_fp.fileno())
try:
self.manager.hash_cleanup_listdir(self._datadir)
except OSError:

View File

@ -2650,8 +2650,7 @@ class DiskFileMixin(BaseDiskFileTestMixin):
}[policy.policy_type]
self.assertEqual(expected, mock_fsync.call_count)
if policy.policy_type == EC_POLICY:
durable_file = '%s.durable' % timestamp.internal
self.assertTrue(durable_file in str(mock_fsync.call_args[0]))
self.assertTrue(isinstance(mock_fsync.call_args[0][0], int))
def test_commit_ignores_hash_cleanup_listdir_error(self):
for policy in POLICIES: