-
Notifications
You must be signed in to change notification settings - Fork 53
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
Implement container db folder cleanup on startup #746
Conversation
WASM runtime size check:Compared to target branchdancebox runtime: 1412 KB (no changes) ✅ flashbox runtime: 832 KB (no changes) ✅ dancelight runtime: 2008 KB (no changes) ✅ container chain template simple runtime: 1088 KB (no changes) ✅ container chain template frontier runtime: 1388 KB (no changes) ✅ |
Coverage Report@@ Coverage Diff @@
## master tomasz-db-folder-cleanup +/- ##
============================================================
- Coverage 65.47% 65.34% -0.13%
Files 310 310
+ Lines 54041 54174 +133
============================================================
+ Hits 35379 35395 +16
+ Misses 18662 18779 +117
|
What happens if I stop it while it is syncing a chain (2000) but is assigned to another one (2001), then I boot it up again and we are still in the same situation? would I remove 2000? |
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.
looks good from a code perspective!
"assigned" means "current or next", so obviously it won't be removed |
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 looks good.
Container database folders are normally removed when the collator gets unassigned. However, if the collator stops the node right before being unassigned, and then starts it later, the container db will not be removed. The db will be removed the next time the collator is assigned and unassigned from that container chain, which may never happen.
To fix this edge case, this PR introduces a new db folder cleanup functionality. When the node starts, it will check the container folders and delete all of them except the ones it is assigned to as a collator. This check is only performed once, the first time a finalized block is imported.