Merge lp:~jameinel/bzr/2.4-fdatasync-ENOTSUP-1075108 into lp:bzr/2.4
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6075 |
Proposed branch: | lp:~jameinel/bzr/2.4-fdatasync-ENOTSUP-1075108 |
Merge into: | lp:bzr/2.4 |
Prerequisite: | lp:~jameinel/bzr/2.4-overridAttr-non-existant |
Diff against target: |
120 lines (+66/-1) 3 files modified
bzrlib/osutils.py (+14/-1) bzrlib/tests/test_osutils.py (+44/-0) doc/en/release-notes/bzr-2.4.txt (+8/-0) |
To merge this branch: | bzr merge lp:~jameinel/bzr/2.4-fdatasync-ENOTSUP-1075108 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Needs Fixing | ||
Martin Packman (community) | Approve | ||
Review via email: mp+132877@code.launchpad.net |
Commit message
Bug #1075108, handle when fdatasync returns EOPNOTSUPP, which should be considered a non-fatal error.
Description of the change
This branch is a fix for calling fdatasync() in cases where it would otherwise fail.
We introduced fdatasync() as a way to reduce the window for power failure crashes triggering data loss. However, it appears that if you are on an SSH mounted filesystem, we will get an ENOTSUP error.
This change makes it so that any IOError while calling fdatasync() is just logged quietly rather than failing. Similar to what we do if 'chmod()' fails.
We could be more strict in the type of errors that we suppress, but ENOTSUP doesn't exist on Windows, and it isn't like we would get useful errors. Instead we try fdatasync, but don't worry if it fails, because we used to not call it at all.
This depends on my overrideAttr change, because I wanted to have the tests run even on Windows, where fdatasync doesn't exist. And even just doing lots of 'if getattr()... is None: raise TestNotApplicable' makes the tests hard to read.
I can split it out if we decide not to land the overrideAttr change.
Seems like the best option. It's unfortunate that this will mask persistent errors such as the one in the bug, ideally we'd want to inform the user that their filesystem doesn't provide data safety rather than just logging repeatedly, but that's hard from a command line tool that is run many times.