-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Handle cleaning of zero-lamport accounts w.r.t. Incremental Snapshots #18870
Handle cleaning of zero-lamport accounts w.r.t. Incremental Snapshots #18870
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18870 +/- ##
========================================
Coverage 82.8% 82.9%
========================================
Files 453 453
Lines 128741 128967 +226
========================================
+ Hits 106705 106977 +272
+ Misses 22036 21990 -46 |
d882d4a
to
886697b
Compare
@carllin @lijunwangs @ryoqun This PR is now ready for review, but it is built on top of PR #18565. So this PR currently contains extra changes that will go away once the other PR is merged in. Feel free to review these changes, which are mostly in Thanks in advance! |
886697b
to
e2a0ad2
Compare
Moving this back to Draft as I iterate on it. |
2db8884
to
0572bc0
Compare
@carllin OK, PR should be good-to-review again! I've attempted to put the correct tests/checks in place, but I may've missed some. Hopefully this is moving in the right direction though! |
runtime/src/accounts_db.rs
Outdated
assert!( | ||
last_full_snapshot_slot.is_some() || self.zero_lamport_accounts_to_purge_later.is_empty(), | ||
"if snapshots are disabled, then zero_lamport_accounts_to_purge_later should always be empty" | ||
); |
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.
👍
runtime/src/accounts_db.rs
Outdated
self.zero_lamport_accounts_to_purge_later | ||
.insert((*slot, *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.
looks like the crux of it 😃
Handle cleaning zero-lamport accounts in slots higher than the last full snapshot slot. This is part of the Incremental Snapshot work. Fixes solana-labs#18825
e68dbb8
to
3af2c62
Compare
76c0527
to
450be98
Compare
let do_test = |test_params: TestParameters| { | ||
let account_info = AccountInfo { | ||
store_id: 42, | ||
offset: 123, | ||
stored_size: 234, | ||
lamports: 0, | ||
}; |
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.
nice, good abstraction
Problem
Zero-lamport accounts are improperly cleaned up in the context of incremental snapshots.
Summary of Changes
Option<Slot>
parameter toAccountsDb::clean_accounts()
for thelast_full_snapshot_slot
. IfSome
, thenpurges_zero_lamports
will be checked against this slot. Any purges for slots higher than the last full snapshot slot will be filtered out (i.e. _not_purged).last_full_snapshot_slot
parameterclean_accounts()
. Most all callers passNone
now.Fixes #18825