Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

borg delete --force --force to delete severely corrupted archives, fixes #1975 #2184

Merged
merged 1 commit into from Feb 26, 2017

Conversation

ThomasWaldmann
Copy link
Member

No description provided.

@ThomasWaldmann ThomasWaldmann added this to the 1.1.0b4 milestone Feb 19, 2017
@ThomasWaldmann ThomasWaldmann self-assigned this Feb 19, 2017
@codecov-io
Copy link

codecov-io commented Feb 19, 2017

Codecov Report

Merging #2184 into master will decrease coverage by -0.18%.
The diff coverage is 55%.

@@            Coverage Diff             @@
##           master    #2184      +/-   ##
==========================================
- Coverage   83.82%   83.65%   -0.18%     
==========================================
  Files          20       20              
  Lines        7203     7219      +16     
  Branches     1234     1237       +3     
==========================================
+ Hits         6038     6039       +1     
- Misses        837      850      +13     
- Partials      328      330       +2
Impacted Files Coverage Δ
src/borg/archive.py 82.38% <ø> (ø)
src/borg/archiver.py 84.77% <64.7%> (-0.19%)
src/borg/locking.py 87.17% <ø> (-1.29%)
src/borg/helpers.py 87.51% <ø> (-0.51%)
src/borg/remote.py 78.28% <ø> (-0.22%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4862efe...4d81b18. Read the comment docs.

@@ -2384,6 +2403,9 @@ def process_epilog(epilog):
subparser.add_argument('--force', dest='forced',
action='store_true', default=False,
help='force deletion of corrupted archives')
subparser.add_argument('--zap', dest='zap',
action='store_true', default=False,
help='force manifest removal of corrupted archives')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between --force and --zap?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--zap does much less (like the external fix script you made for this ticket).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, ok. I see. Yes. Wouldn't be straightforward to detect. Perhaps this should be more like a "--force --force" option, so that it's clear that this should only be used if it's too corrupt to work with even "--force"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, sounds good and argparse supports it.

@ThomasWaldmann ThomasWaldmann changed the title borg delete --zap to delete severely corrupted archives, fixes #1975 borg delete --force --force to delete severely corrupted archives, fixes #1975 Feb 19, 2017
else:
deleted = True
logger.info('Deleted {} ({}/{}).'.format(archive_name, i, len(archive_names)))
if deleted and yes('Are you sure? [y/N] '):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking about removing the yes().

the forced == 1 does not ask either and if users add another --force, they already said that they mean it.

@enkore
Copy link
Contributor

enkore commented Feb 21, 2017

I can has test case? ;)

logger.info('Deleted {} ({}/{}).'.format(archive_name, i, len(archive_names)))
if deleted:
manifest.write()
repository.append_only = True # avoid issues in compaction by not doing it
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, does not work with remote repo.

@ThomasWaldmann
Copy link
Member Author

btw, i also tried to add a test for the single --force delete, but it needs some different corruption code that cleanly removes an archive chunk from repo.

@enkore
Copy link
Contributor

enkore commented Feb 22, 2017

Suggestion: Don't corrupt the low-level structures for the tests, it is expected that only check--repair can fix it and that --force² might fail after the commit. Instead, write some invalid data via the Repository API, that way it's easier to test.

@ThomasWaldmann
Copy link
Member Author

fixed the test, collapsed changesets. anything else?

@ThomasWaldmann
Copy link
Member Author

merge?

this one first, there is also another one that adds a test for single-force also, that one second.

@ThomasWaldmann ThomasWaldmann merged commit 9bc825a into borgbackup:master Feb 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants