Fixes storage alive size with secondary indexes#5778
Fixes storage alive size with secondary indexes#5778brooksprumo merged 1 commit intoanza-xyz:masterfrom
Conversation
| storage | ||
| .accounts | ||
| .scan_accounts_stored_meta(|stored_account| { | ||
| stored_size_alive += stored_account.stored_size(); |
There was a problem hiding this comment.
Here's the bug. We've already incremented the stored_size_alive for this storage (above). So doing it again here is wrong.
|
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5778 +/- ##
=======================================
Coverage 82.9% 83.0%
=======================================
Files 826 826
Lines 375758 375778 +20
=======================================
+ Hits 311829 311914 +85
+ Misses 63929 63864 -65 🚀 New features to boost your workflow:
|
HaoranYi
left a comment
There was a problem hiding this comment.
lgtm.
Maybe it is worth to add an assert of alive_bytes <= account_file.len().
Yeah, seems like a reasonable thing to add. |
(cherry picked from commit 679ad80) # Conflicts: # accounts-db/src/accounts_db.rs
Problem
When generating the index with secondary indexes, the AccountStorageEntry's alive bytes is incorrectly set (approximately double). This likely causes issues later, e.g. not shrinking when they should.
Summary of Changes
Fix it.
Note, I intend to backport this fix to v2.2.