-
Notifications
You must be signed in to change notification settings - Fork 266
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
Optimize max_flushed_root update in flushing roots #4320
base: master
Are you sure you want to change the base?
Conversation
@@ -6295,33 +6295,35 @@ impl AccountsDb { | |||
}); | |||
|
|||
// Always flush up to `requested_flush_root`, which is necessary for things like snapshotting. | |||
let cached_roots: BTreeSet<Slot> = self.accounts_cache.clear_roots(requested_flush_root); | |||
let flushed_roots: BTreeSet<Slot> = self.accounts_cache.clear_roots(requested_flush_root); |
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.
rename: cached_roots -> flushed_roots for clarity.
probably won't matter much in actual performance. But it is still nice to have. |
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.
One thing I thought of, where dooes the accounts_cache's max_flush_root get used? Anywhere in the foreground/transaction processing? That's the only place I can think of where delaying when set_max_flush_root()
may make a difference.
There are 3 usages of max_flushed_root.
2 and 3 are from the same account background thread. So this change should not 1 is used from bank thread. We can prove that any call of slot for Proof:
Claim: Any slot 'S' that called on add_root() must be greater than the max slot in Claim: max_flushed_root must be less than max slot in Therefore, S > max('w_maybe_flushed_roots') >= max_flushed_root. Q.E.D Therefore, 1 won't be affected by this change too. |
Problem
When updating max flushed root in accounts index, we don't need to update it for ever flushed root in the loop. We can update it with the last flushed root.
split from #4304
Summary of Changes
update max flushed root in account index with the last flushed root.
Fixes #