Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Add StakesCache struct to abstract away locking#21738

Merged
jstarry merged 1 commit intosolana-labs:masterfrom
jstarry:stakes-cache
Dec 10, 2021
Merged

Add StakesCache struct to abstract away locking#21738
jstarry merged 1 commit intosolana-labs:masterfrom
jstarry:stakes-cache

Conversation

@jstarry
Copy link
Copy Markdown
Contributor

@jstarry jstarry commented Dec 9, 2021

Problem

Stakes cache locking details is leaking into Bank and there's no single place to prepare new stakes cache updates before grabbing a lock.

Summary of Changes

Create a thin wrapper struct around a RwLock wrapped Stakes cache instance

This PR lays the groundwork for new deserialization optimizations in #21733

Fixes #

brooksprumo
brooksprumo previously approved these changes Dec 9, 2021
Copy link
Copy Markdown
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

I like it! lgtm

@mergify mergify Bot dismissed brooksprumo’s stale review December 9, 2021 20:13

Pull request has been modified.

@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Dec 9, 2021

Rebased off master and resolved conflicts which involved moving Bank::handle_invalid_stakes_cache_keys to StakesCache::handle_invalid_keys as well

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Dec 9, 2021
@mergify mergify Bot removed the automerge Merge this Pull Request automatically once CI passes label Dec 9, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Dec 9, 2021

automerge label removed due to a CI failure

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 9, 2021

Codecov Report

Merging #21738 (1d2732b) into master (6fc3291) will decrease coverage by 0.0%.
The diff coverage is 74.7%.

@@            Coverage Diff            @@
##           master   #21738     +/-   ##
=========================================
- Coverage    81.4%    81.4%   -0.1%     
=========================================
  Files         511      511             
  Lines      143469   143489     +20     
=========================================
+ Hits       116840   116844      +4     
- Misses      26629    26645     +16     

@jstarry jstarry merged commit fd175c1 into solana-labs:master Dec 10, 2021
@jstarry jstarry deleted the stakes-cache branch December 10, 2021 15:51
mergify Bot pushed a commit that referenced this pull request Dec 10, 2021
(cherry picked from commit fd175c1)

# Conflicts:
#	runtime/src/bank.rs
#	runtime/src/serde_snapshot/tests.rs
#	runtime/src/stakes.rs
mergify Bot pushed a commit that referenced this pull request Dec 10, 2021
(cherry picked from commit fd175c1)

# Conflicts:
#	runtime/src/bank.rs
#	runtime/src/stakes.rs
@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Dec 10, 2021

@Mergifyio backport v1.8

@jstarry
Copy link
Copy Markdown
Contributor Author

jstarry commented Dec 10, 2021

@Mergifyio backport v1.9

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Dec 10, 2021

backport v1.8

✅ Backports have been created

Details

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Dec 10, 2021

backport v1.9

✅ Backports have been created

Details

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants