Skip to content
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

Replaces ReadAccountMapEntry in read_index_for_accessor_or_load_slow() #35220

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Feb 16, 2024

Problem

See #34786 for background.

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

When reading the index for an account accessor, we currently use 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 read_index_for_accessor_or_load_slow()

@brooksprumo brooksprumo added the work in progress This isn't quite right yet label Feb 16, 2024
@brooksprumo brooksprumo self-assigned this Feb 16, 2024
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4b65cc8) 81.6% compared to head (f57b729) 81.6%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #35220     +/-   ##
=========================================
- Coverage    81.6%    81.6%   -0.1%     
=========================================
  Files         833      833             
  Lines      224765   224776     +11     
=========================================
- Hits       183480   183476      -4     
- Misses      41285    41300     +15     

@brooksprumo brooksprumo force-pushed the self-ref/2/read_index_for_accessor_or_load_slow branch 2 times, most recently from 2e99fc1 to f57b729 Compare February 19, 2024 15:37
@brooksprumo brooksprumo removed the work in progress This isn't quite right yet label Feb 19, 2024
@brooksprumo brooksprumo changed the title Uses get_with_and_then() in read_index_for_accessor_or_load_slow() Replaces ReadAccountMapEntry in read_index_for_accessor_or_load_slow() Feb 19, 2024
Comment on lines -5104 to -5118
// `lock` is dropped here rather pretty quickly with clone_in_lock = false,
// so the entry could be raced for mutation by other subsystems,
// before we actually provision an account data for caller's use from now on.
// This is traded for less contention and resultant performance, introducing fair amount of
// delicate handling in retry_to_get_account_accessor() below ;)
// you're warned!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a lot of comments that I removed in this function. I feel like some is out-of-date and is fine to remove, but some may still be useful... Any thoughts on what should stay and how/where to put it?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is hard to fit them in. They are outdated in a few ways. clone_in_lock is straightforward to understand. I'm ok with removing the comments. The code is simpler.

@brooksprumo brooksprumo marked this pull request as ready for review February 19, 2024 16:29
Copy link
Contributor

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

On code wise, the change in the PR looks good to me. About code comments, it looks like there may be some delicate interaction with "retry". I will defer to jeff to decide how to deal with these comments.

@brooksprumo brooksprumo force-pushed the self-ref/2/read_index_for_accessor_or_load_slow branch from f57b729 to ddce2f2 Compare February 23, 2024 23:53
@brooksprumo
Copy link
Contributor Author

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

Copy link
Contributor

@jeffwashington jeffwashington 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 8143fc3 into solana-labs:master Feb 26, 2024
35 checks passed
@brooksprumo brooksprumo deleted the self-ref/2/read_index_for_accessor_or_load_slow branch February 26, 2024 19:19
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.

3 participants