Skip to content

v2.3: Scans each storage only once when building accounts index (backport of #6745)#6896

Merged
brooksprumo merged 2 commits intov2.3from
mergify/bp/v2.3/pr-6745
Jul 10, 2025
Merged

v2.3: Scans each storage only once when building accounts index (backport of #6745)#6896
brooksprumo merged 2 commits intov2.3from
mergify/bp/v2.3/pr-6745

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented Jul 9, 2025

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).

@mergify mergify Bot requested a review from a team as a code owner July 9, 2025 16:03
Comment on lines +8075 to +8076
rent_epoch: account.rent_epoch,
executable: account.executable,
Copy link
Copy Markdown

@brooksprumo brooksprumo Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, these two fields (rent_epoch and executable) were removed from IndexInfoInner in master. They are not used here.

@brooksprumo brooksprumo requested review from HaoranYi and roryharr July 9, 2025 16:14
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.8%. Comparing base (9963221) to head (9c3689b).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@brooksprumo brooksprumo merged commit d844c32 into v2.3 Jul 10, 2025
46 checks passed
@brooksprumo brooksprumo deleted the mergify/bp/v2.3/pr-6745 branch July 10, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants