-
Notifications
You must be signed in to change notification settings - Fork 112
[runtime/storage] Remove Blob::close
#1351
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
[runtime/storage] Remove Blob::close
#1351
Conversation
| file.shutdown() | ||
| .await | ||
| .map_err(|e| Error::BlobCloseFailed(self.partition.clone(), hex(&self.name), e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fine because on fs::File all that tokio does is flush (https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/fs/file.rs#L874-L877).
| // TODO danlaine: This is error-prone because the metrics will be | ||
| // incorrect if the blob is dropped before it's closed. We should | ||
| // consider using a `Drop` implementation to decrement the metric. | ||
| // https://github.com/commonwarexyz/monorepo/issues/754 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also calling close on cloned blobs would lead to erroneously decrementing the counter (since all clones share the same underlying blob).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for having a go at this!
|
I think all comments have been addressed. |
Awesome, thanks! I'm going to apply some more nits and tweaks but this looks almost done to me. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1351 +/- ##
==========================================
+ Coverage 91.24% 91.32% +0.07%
==========================================
Files 262 265 +3
Lines 65280 66015 +735
==========================================
+ Hits 59565 60286 +721
- Misses 5715 5729 +14
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Fixes #754.