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

LockRoster.modify: no KeyError if element was already gone, fixes #7937 #7941

Merged

Conversation

ThomasWaldmann
Copy link
Member

The intention of LockRoster.modify(key, REMOVE) is to remove self.id.

Using set.discard will just ignore it if self.id is not present there anymore.

Previously, using set.remove triggered a KeyError that has been frequently seen in tracebacks of teardowns involving Repository.del and Repository.exit.

I added a REMOVE2 op to serve one caller that needs to get the KeyError if self.id was not present.

Thanks to @herrmanntom for the workaround!

…gbackup#7937

The intention of LockRoster.modify(key, REMOVE) is to remove self.id.

Using set.discard will just ignore it if self.id is not present there anymore.

Previously, using set.remove triggered a KeyError that has been frequently
seen in tracebacks of teardowns involving Repository.__del__ and Repository.__exit__.

I added a REMOVE2 op to serve one caller that needs to get the KeyError if
self.id was not present.

Thanks to @herrmanntom for the workaround!
@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d4a54f2) 83.65% compared to head (2d86b7e) 83.65%.
Report is 5 commits behind head on master.

Files Patch % Lines
src/borg/locking.py 75.00% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7941   +/-   ##
=======================================
  Coverage   83.65%   83.65%           
=======================================
  Files          66       66           
  Lines       11857    11860    +3     
  Branches     2148     2149    +1     
=======================================
+ Hits         9919     9922    +3     
- Misses       1363     1364    +1     
+ Partials      575      574    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann ThomasWaldmann merged commit 6a5feaf into borgbackup:master Nov 18, 2023
13 checks passed
@ThomasWaldmann ThomasWaldmann deleted the lockroster-remove-fix-master branch November 18, 2023 19:32
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.

2 participants