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

disk index: break ref_count u64 into reserved bits #30997

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

jeffwashington
Copy link
Contributor

Problem

See #30711

Summary of Changes

We can use extra bits inside of RefCount to store bits like Occupied inside a disk index or data bucket. We can also use them as an enum tag for more complicated implementations such as storing a single slot list entry inside IndexEntry and not using the data file at all.

Fixes #

@@ -365,7 +365,7 @@ mod tests {
let v = (0..count)
.map(|x| (x as usize, x as usize /*thread_rng().gen::<usize>()*/))
.collect::<Vec<_>>();
let rc = thread_rng().gen::<RefCount>();
let rc = thread_rng().gen_range(0, RefCount::MAX >> 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend adding a comment here why we're shifting right. May help the next brave soul. (Can be done in a subsequent PR.)

@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Merging #30997 (d796a26) into master (3278035) will decrease coverage by 0.1%.
The diff coverage is 61.5%.

@@            Coverage Diff            @@
##           master   #30997     +/-   ##
=========================================
- Coverage    81.5%    81.5%   -0.1%     
=========================================
  Files         728      728             
  Lines      205471   205479      +8     
=========================================
- Hits       167554   167534     -20     
- Misses      37917    37945     +28     

@jeffwashington jeffwashington merged commit 3f6c33d into solana-labs:master Mar 31, 2023
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.

2 participants