Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@andresilva
Copy link
Collaborator

Fixes #754.

Comment on lines -78 to -80
file.shutdown()
.await
.map_err(|e| Error::BlobCloseFailed(self.partition.clone(), hex(&self.name), e))
Copy link
Collaborator Author

@andresilva andresilva Aug 4, 2025

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).

Comment on lines -134 to -137
// 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
Copy link
Collaborator Author

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).

@patrick-ogrady patrick-ogrady requested a review from danlaine August 4, 2025 14:04
@andresilva andresilva changed the title Remove Blob::close [runtime/storage] Remove Blob::close Aug 4, 2025
Copy link
Collaborator

@danlaine danlaine left a 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!

@andresilva
Copy link
Collaborator Author

I think all comments have been addressed.

@andresilva andresilva requested a review from danlaine August 6, 2025 20:45
@danlaine
Copy link
Collaborator

danlaine commented Aug 6, 2025

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.

danlaine
danlaine previously approved these changes Aug 6, 2025
@patrick-ogrady patrick-ogrady merged commit 33426bc into commonwarexyz:main Aug 7, 2025
32 checks passed
@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 93.84615% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.32%. Comparing base (65ee8a7) to head (5951f24).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
runtime/src/storage/metered.rs 87.93% 7 Missing ⚠️
runtime/src/storage/audited.rs 66.66% 1 Missing ⚠️
@@            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     
Files with missing lines Coverage Δ
runtime/src/lib.rs 96.69% <100.00%> (+0.25%) ⬆️
runtime/src/storage/memory.rs 100.00% <ø> (ø)
runtime/src/storage/mod.rs 95.93% <100.00%> (ø)
runtime/src/storage/tokio/unix.rs 100.00% <ø> (ø)
runtime/src/utils/buffer/append.rs 100.00% <100.00%> (ø)
runtime/src/utils/buffer/mod.rs 99.85% <100.00%> (+<0.01%) ⬆️
runtime/src/utils/buffer/pool.rs 95.31% <100.00%> (ø)
runtime/src/utils/buffer/write.rs 98.57% <ø> (-0.08%) ⬇️
storage/src/archive/prunable/mod.rs 100.00% <100.00%> (ø)
storage/src/freezer/mod.rs 99.67% <100.00%> (ø)
... and 10 more

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[Storage] Remove close from Blob trait

3 participants