-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Accounts index updates, remove pubkey when dead account #7408
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7408 +/- ##
========================================
+ Coverage 80.6% 80.6% +<.1%
========================================
Files 245 244 -1
Lines 48439 47778 -661
========================================
- Hits 39048 38548 -500
+ Misses 9391 9230 -161 |
runtime/src/accounts_db.rs
Outdated
for pubkey in purges.keys() { | ||
reclaims.extend(accounts_index.purge(&pubkey)); | ||
let purge = accounts_index.purge(&pubkey); |
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.
nits: I think .1
and .0
isn't readable... So how about this using destructring?
let mut all_reclaims = Vec::new();
for ...
let (reclaims, is_empty) = accounts_index...
all_reclaims.extend(reclaims);
if (is_empty) {
dead_keys.push(...
}
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.
Yea. That's better. Thanks.
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 cleaning up the code into the fine details!
LGTM with nits
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.
(Err, I've selected wrong radio button, so this is a re-submit to overwrite previous one)
Thanks for cleaning up the code into the fine details!
LGTM with nits
eee930e
to
d3e4d8e
Compare
Problem
The accounts index never cleans up dead account keys, leaving a pubkey in the hash table pointing to a vec which will not be deallocated.
Summary of Changes
Detect when an account exists on no branches in purge zero lamport accounts and remove it from the index.
Fixes #