-
Notifications
You must be signed in to change notification settings - Fork 473
Adding an API to calculate storage size from the stored data lengths #6132
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
base: master
Are you sure you want to change the base?
Adding an API to calculate storage size from the stored data lengths #6132
Conversation
9d8306e
to
2a02c67
Compare
2a02c67
to
7f68a76
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6132 +/- ##
=========================================
- Coverage 82.9% 82.9% -0.1%
=========================================
Files 842 842
Lines 377491 377525 +34
=========================================
+ Hits 312968 312989 +21
- Misses 64523 64536 +13 🚀 New features to boost your workflow:
|
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.
Idea looks good to me.
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.
Can we split the renaming of get_account_size function and the addition of the new function into separate PR?
I don't think so in this case, because the definition of the function is changing. |
Had to update it I think because of this: Unless there is a better way of resolving issues like that. It looks like someone removed a file that had an extra blank line, so it sees my change as having added an improperly formatted file . |
Gotcha, yeah if the build on master is broken, gotta rebase (or merge) to fix. I personally always manually do the rebase on the cli, but I imagine GH "update branch" works too. |
accounts-db/src/accounts_file.rs
Outdated
Self::TieredStorage(ts) => ts | ||
.reader() | ||
.and_then(|reader| reader.get_account_sizes(sorted_offsets).ok()) | ||
.map_or(0, |reader| reader.calculate_stored_size(data_len)), |
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.
If we don't have a valid reader
here for Tiered Storage, I think that's a programmer bug. I'd recommend we do expect
. Something like:
.map_or(0, |reader| reader.calculate_stored_size(data_len)), | |
.expect("tiered storage must be ready-only") | |
.calculate_stored_size(data_len) |
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.
Can see what i put. It took me a while to figure out why the reader was needed at all, so I put that in the expect message.
Adding expects statement Updating assert to assert_eq
Problem
There is no API to calculate storage size of an account from the data length stored in account. This will be required for out dated account tracking.
Summary of Changes
Modified storage_size API to return data length instead.
Added API to convert from data length to storage_size.
See conversation here: https://github.com/anza-xyz/agave/pull/5950/files#r2069132522
Fixes #