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

Fix an issue where aborted processes could corrupt storage #8802

Merged
merged 4 commits into from
Sep 27, 2024

Conversation

eivindjahren
Copy link
Contributor

@eivindjahren eivindjahren commented Sep 26, 2024

Issue
Resolves #8799

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.31%. Comparing base (e2d3a90) to head (e16566a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8802      +/-   ##
==========================================
+ Coverage   91.29%   91.31%   +0.01%     
==========================================
  Files         342      342              
  Lines       20985    20995      +10     
==========================================
+ Hits        19159    19171      +12     
+ Misses       1826     1824       -2     
Flag Coverage Δ
cli-tests 39.55% <100.00%> (+0.01%) ⬆️
gui-tests 73.50% <100.00%> (-0.02%) ⬇️
performance-tests 50.09% <92.85%> (-0.01%) ⬇️
unit-tests 79.84% <96.42%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@eivindjahren eivindjahren force-pushed the transactional_write branch 2 times, most recently from a6921a5 to 181d077 Compare September 26, 2024 09:40
@eivindjahren eivindjahren marked this pull request as ready for review September 26, 2024 12:57
@eivindjahren eivindjahren changed the title Use a transactional write in storage Fix an issue where aborted processes could corrupt storage Sep 26, 2024
@eivindjahren eivindjahren added the release-notes:bug-fix Automatically categorise as bug fix in release notes label Sep 26, 2024
filepath = Path("./file.txt")
storage._write_transaction(filepath, data)

assert filepath.read_bytes() == data
Copy link
Contributor

Choose a reason for hiding this comment

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

deindent one level to make sure the context manager does not delete it (which I assume it is not meant to do)?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, that context manager is probably irrelevant to _write_transaction.

Copy link
Contributor

@berland berland left a comment

Choose a reason for hiding this comment

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

Nice!

@eivindjahren eivindjahren merged commit 321767c into equinor:main Sep 27, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:bug-fix Automatically categorise as bug fix in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement transactional writes to storage
3 participants