Squash supermajority root on blockstore replay at startup#11727
Squash supermajority root on blockstore replay at startup#11727carllin merged 3 commits intosolana-labs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11727 +/- ##
========================================
Coverage 82.0% 82.0%
========================================
Files 330 330
Lines 76742 76862 +120
========================================
+ Hits 62970 63083 +113
- Misses 13772 13779 +7 |
mvines
left a comment
There was a problem hiding this comment.
Thanks! A backport to v1.3 would be very nice. Maybe not v1.2 though, let's let this bake on testnet
|
Is it the best way to do this? Seems like a lot to keep in sync with how roots are actually set on the replay side. |
Co-authored-by: Michael Vines <mvines@gmail.com>
Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit f7adb68)
(cherry picked from commit f7adb68)
| vote_state | ||
| .unwrap() | ||
| .root_slot | ||
| .map(|root_slot| (root_slot, stake)) |
There was a problem hiding this comment.
@carllin Well is this ok? What if different vote account has same root_slot? I think it's silently overwritten when collect()-ing into roots? Or does collect() summing automatically for us in this case?
There was a problem hiding this comment.
@ryoqun that's a bug, it definitely doesn't sum it automatically. I forgot to update it when I switched the type to BTreeMap from Vec. Thanks for the catch!
| }; | ||
|
|
||
| if let Some(new_root_bank) = new_root_bank { | ||
| *root = new_root_bank.slot(); |
There was a problem hiding this comment.
Btw, how the non-empty slot interval (blockstore.max_root(), supermajority_root] is marked at rooted for the blockstore?
There was a problem hiding this comment.
@ryoqun it's currently not. We could, but I think the current implementation is equivalent to starting a snapshot at supermajority_root, in which case those rooted slots in the range (blockstore.max_root(), supermajority_root] won't be marked in blockstore anyways.
| // If we've reached the last known root in blockstore, start looking | ||
| // for newer cluster confirmed roots | ||
| let new_root_bank = { | ||
| if *root == max_root { |
There was a problem hiding this comment.
(for the record:) this condition was wrong... #14557
Problem
After long periods of no progress, a single node can have a long ledger it needs to replay, which is prohibitively taxing on memory and compute
Summary of Changes
Squash banks that supermajority has rooted on replay at startup
Fixes #