-
Notifications
You must be signed in to change notification settings - Fork 306
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
clean all zero storages at index generation time #3196
clean all zero storages at index generation time #3196
Conversation
af2789a
to
42ea974
Compare
Are there perf numbers for how this impacts a node? How many stores are only accounts with zero lamports? |
This has been a issue for a while, especially with long running skip rewrite nodes, I will start a node to gather the stats. |
Note that this PR it self doesn't fully solve the problem. But this is a good step to the solution. To fully solve the problem, we will need "shrink" PR, which handles single slot one ref zero accounts. |
@HaoranYi check this out, too. I added something here to force us to shrink these all zero lamport account storages. This work is so old I've lost my memory of how well this worked or didn't. I think without the full solution, it isn't really helpful to run clean unless the entire storage is zero lamport. However, it seems highly unlikely with the code we have today that we'll end up with an entire slot being zero lamport accounts. It definitely is orthogonal to the other pr, so this should definitely be split out and put in or closed independently. Also, seems like we may want a metric on how many of these we actually found at startup. I bet the answer is 0 today. |
The problem we have seen is that with long running skip rewrites, we accumulated all zero lamport storages up to 16K. The first time, I saw this problem happens, was before we fixed shrink to remove single ref zero lamport accounts. Maybe we don't have this problem now after the fix. But, PR2880, motivated from the above problem, is a good fix to have anyway, in my opinion. @jeffwashington Your are right that the additional force shrink in this commit a5d6aac is the other import piece to fix the issue. As said in the comments #2880 (comment), I have written up an analysis and a theory for the problem before on slack to explain why we need "shrink" as well as the "clean" in this PR. Now I repost it here. Consider the following example.
Here is how the clean algorithm works.
In the end 100 wasn't cleaned and won't be visited again unless X was rewritten. With skip rewrite and X being cold, slot 100 will unlikely to be touched again. The new commit that force shrinking all zero slots, will let shrink work on 100 regardless. And thanks for the recent handling of all zeros added to shrink, shrink will see that all accounts in 100 are dead or single_ref_zero_accounts, and it can be dropped. hooray! This explains what happens for slot 276499184 too. Where the first handle_reclaim runs, it only sees 5 accounts are dead out of 545. All force shrink solves the problem to be working because it bypass the shrink productive check and shrink them anyway. And the change to keep track of single ref zero lamports (#3188) will address the shrinking part of this problem." With #3188, shrink will know that Y-U are single-ref-zero accounts and can be shrunk. This make slot 100 to be qualifed for shrinking, which has the same effect as "force shrinking". In summary, we need both clean fix (this PR) and the shrink fix (either #3188 or force shrink a5d6aac) to completely remove those zeros at startup. |
My node restart with this PR crashed ...
|
5de8adf
to
4e53cf6
Compare
I restarted my node. But the good news is that there is no all zero slots from mnt snapshot.
|
I tested it again with a restart on another node that's running skip rewrites. This time it finds 398 all zero slots at startup, and didn't crash.
|
f117a23
to
087bd91
Compare
I made a few more commits to refactor the statup stats, i.e. accumulate the stat for a chunk locally then update the atomic outer stats. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code for handling all-zeros looks good to me
087bd91
to
d7938e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d7938e9
to
4e0c76c
Compare
Rebase and fix conflicts after #3265. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* clean all zero storeage at index gen time * add stats * wait to add zero slot to clean after index flush * pr * remove log * fix rebase --------- Co-authored-by: HaoranYi <[email protected]>
Problem
Split from #3188
We notice there are all zero account storages when we generate index at startup.
We should add them as candidates for "clean".
Summary of Changes
Refactor to use local sum of stats before update the outer atomic statsFixes #