solana icon indicating copy to clipboard operation
solana copied to clipboard

Replaces ReadAccountMapEntry in do_scan_secondary_index()

Open brooksprumo opened this issue 2 years ago • 1 comments

Problem

See https://github.com/solana-labs/solana/issues/34786 for background.

We want to limit the use of ReadAccountMapEntry, from AccountsIndex, everywhere. Ultimately removing it once there are no more uses.

When scanning a secondary index, we look up each pubkey in the index and then apply a callback function to the entry if found. Currently this uses ReadAccountMapEntry via AccountsIndex::get(), but we can do it other ways without ReadAccountMapEntry.

Summary of Changes

Adds get_with_and_then() and uses it in do_scan_secondary_index()

brooksprumo avatar Feb 16 '24 22:02 brooksprumo

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.7%. Comparing base (da08868) to head (604162f). Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #35219     +/-   ##
=========================================
- Coverage    81.7%    81.7%   -0.1%     
=========================================
  Files         834      834             
  Lines      224244   224249      +5     
=========================================
- Hits       183398   183381     -17     
- Misses      40846    40868     +22     

codecov[bot] avatar Feb 16 '24 23:02 codecov[bot]

I rebased and force-pushed this branch to pull in #35307.

brooksprumo avatar Feb 24 '24 02:02 brooksprumo

@HaoranYi @jeffwashington This PR is now ready for a re-review.

brooksprumo avatar Feb 27 '24 00:02 brooksprumo

Rebased on top of #35336, so that I can use get_account_info_with_and_then() in the impl of this PR.

brooksprumo avatar Feb 28 '24 01:02 brooksprumo

@HaoranYi @jeffwashington This PR is ready for re-review. Thanks!

brooksprumo avatar Feb 28 '24 01:02 brooksprumo