[Request] [+ ] D10776: revlog: close the index file handle after the data one
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu May 27 07:06:19 UTC 2021
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This make sure the data file is flushed before the index. preventing the index
to reference unflushed data.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10776
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2267,10 +2267,12 @@
self._write_docket(transaction)
finally:
self._writinghandles = None
+ if dfh is not None:
+ dfh.close()
+ # closing the index file last to avoid exposing referent to
+ # potential unflushed data content.
if ifh is not None:
ifh.close()
- if dfh is not None:
- dfh.close()
def _write_docket(self, transaction):
"""write the current docket on disk
To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210527/cc38dcd9/attachment.html>
More information about the Mercurial-patches
mailing list