Refactors AccountsBackgroundService if a snapshot request was not handled#6418
Refactors AccountsBackgroundService if a snapshot request was not handled#6418brooksprumo merged 3 commits intoanza-xyz:masterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6418 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 848 848
Lines 379479 379490 +11
=========================================
- Hits 314588 314355 -233
- Misses 64891 65135 +244 🚀 New features to boost your workflow:
|
| // if we're cleaning, then force flush, otherwise be lazy | ||
| bank.rc | ||
| .accounts | ||
| .accounts_db | ||
| .flush_accounts_cache(should_clean, Some(max_clean_slot_inclusive)); |
There was a problem hiding this comment.
First change: unify flush
Previously, the else-if and the else branches both flush. One with force=true, and one with force=false. And that 'force' was based on if we're cleaning or not.
| // see the comments in Bank::clean_accounts() for why we sub 1 here | ||
| let max_clean_slot_inclusive = bank.slot().saturating_sub(1); |
There was a problem hiding this comment.
The next PR will change this max clean slot, and that'll be the final fix for the underlying issue. So we'll want to feel pretty good about this refactor first.
|
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. |
Problem
The main problem is #6295. As a means to that end, we need to ensure we don't clean past any enqueued snapshot request's slot.
Since we call
flushandcleanin multiple branches (if a snapshot request is not handled), it's not straight forward to share a "max cleanable slot" between them all.Summary of Changes
Refactor the AccountsBackgroundService code, when a snapshot request was not handled, to make it possible to share a "max cleanable slot".
Note, needs to be backported to v2.3.