v2.3: Scans each storage only once when building accounts index (backport of #6745)#6896
Merged
brooksprumo merged 2 commits intov2.3from Jul 10, 2025
Merged
v2.3: Scans each storage only once when building accounts index (backport of #6745)#6896brooksprumo merged 2 commits intov2.3from
brooksprumo merged 2 commits intov2.3from
Conversation
(cherry picked from commit cfa4c2c)
brooksprumo
reviewed
Jul 9, 2025
Comment on lines
+8075
to
+8076
| rent_epoch: account.rent_epoch, | ||
| executable: account.executable, |
There was a problem hiding this comment.
Note, these two fields (rent_epoch and executable) were removed from IndexInfoInner in master. They are not used here.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v2.3 #6896 +/- ##
=======================================
Coverage 82.8% 82.8%
=======================================
Files 850 850
Lines 379824 379841 +17
=======================================
+ Hits 314710 314744 +34
+ Misses 65114 65097 -17 🚀 New features to boost your workflow:
|
roryharr
approved these changes
Jul 9, 2025
t-nelson
approved these changes
Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When building the accounts index, if secondary indexes are on, we scan each account storage file twice. This is bad, performance wise. The second scan is needed to get each account's data, which secondary indexes need.
We should switch on if secondary indexes are enabled or not, and then decide how to scan the storage. E.g. if secondary indexes are on, scan once with account data. If secondary indexes are off, scan once without account data.
Summary of Changes
Instead of scanning twice, only scan once! Pick the scan function depending on if secondary indexes are on or off.
Justification to Backport
@alessandrod asked me to. It is for startup perf improvement when secondary indexes are used (rpc-only).
This is an automatic backport of pull request #6745 done by [Mergify](https://mergify.com).