This is an archive of the discontinued Mercurial Phabricator instance.

remotefilelog: make pack cleanup more robust
ClosedPublic

Authored by durham on Aug 31 2017, 6:07 PM.
Tags
None
Subscribers

Details

Reviewers
ms2316
Group Reviewers
Restricted Project
Commits
rFBHGXf52d7e0b51d4: remotefilelog: make pack cleanup more robust
Summary

We're seeing exceptions from the unlink cleanup logic hide the actual exception
from the code. In order to debug the actual exception, we need to eat the
cleanup exceptions and in any place where we eat an exception inside of a catch
block, we need to manually rethrow the original exception, otherwise we end up
throwing the second caught exception (from the cleanup logic).

Test Plan

Ran the tests. This is a particular odd edge case, so I need to run
these bits in the production environment where it was occuring before I can
understand why it was happening.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durham created this revision.Aug 31 2017, 6:07 PM
ms2316 added a subscriber: ms2316.Sep 5 2017, 11:48 AM
ms2316 added a comment.Sep 5 2017, 1:05 PM
This comment was removed by ms2316.
remotefilelog/basepack.py
322

If self.opener.rename(...) throws an exception then the 'sha + SUFFIX' file is not created? I am not sure if it is created or not, therefore I would add unlink 'sha + SUFFIX' files here just in case.

323–324

What if self._cleantemppacks() raises an exception? Won't we re-raise the exception from _cleantemppacks() on line 324 instead of the exception in the code?

ms2316 added inline comments.Sep 5 2017, 1:21 PM
remotefilelog/basepack.py
323–324

... instead of the exception on line 321? ***

ms2316 accepted this revision.EditedSep 5 2017, 2:15 PM

What are the unit test failures? And the comment on 322.

remotefilelog/basepack.py
323–324

No it wont. Never mind

This revision is now accepted and ready to land.Sep 5 2017, 2:15 PM
durham added a comment.Sep 5 2017, 2:27 PM

The unit test failures are just my development environment not liking to run unit tests from inside arc. The tests pass when I run them myself.

remotefilelog/basepack.py
322

Yea, if rename throws then the file was not created. I don't want to blindly delete the file, since other hg processes may have created the exact same pack file (which might be why this process's rename failed).

ms2316 added a comment.Sep 5 2017, 2:29 PM

Looks good to me then

This revision was automatically updated to reflect the committed changes.