-
Notifications
You must be signed in to change notification settings - Fork 493
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
blockdb: bound max deleted blocks per blockdb sync #5910
blockdb: bound max deleted blocks per blockdb sync #5910
Conversation
19082af
to
11db893
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5910 +/- ##
==========================================
+ Coverage 55.14% 55.97% +0.83%
==========================================
Files 478 478
Lines 67602 67612 +10
==========================================
+ Hits 37280 37848 +568
+ Misses 27757 27201 -556
+ Partials 2565 2563 -2 ☔ View full report in Codecov by Sentry. |
From my testing, this looks good. algod remains available, and it sheds 10,000 rounds at a time, though it takes about 26 seconds per batch. This means that for going archival -> non-archival it would take about a day to completely cut through 35 million rounds. I think this is acceptable, since it remains responsive in the mean time. |
I think this means that since a sync takes 26 seconds or so, we will only be calling sync every 8 rounds or so. If that's the case, I don't see any point in even going as high as 10,000. If we do 1,000 I guess we might be syncing fast enough to sync almost every round. And 8 rounds or so of 1,000 deletions is nearly as good as doing 10,000 rounds every 26 seconds. It'll still clean up in about a day. Keep in mind, I may be misunderstanding how sync works. I had thought we wrote a block every round. |
My intuition is bigger batches should take a bit less overall time than smaller batches because of the index update. Not sure tho if there any optimizations in sqlite for sequential removal from indices. |
Summary
If a node switches from Archival to non-archival then the blockdb cleanup can take a long time blocking the blockdb in a write tx. This PR addresses this by scoping max blocks deleted per sync op.
Test Plan
Added a unit test.
Additionally fixed a data race seen in TestVotersReloadFromDiskAfterOneStateProofCommitted.