-
Notifications
You must be signed in to change notification settings - Fork 683
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
forknet: Drop unneeded columns in the fork-network command #12921
Conversation
I tested it with this branch. That adds a script at To test it I ran: $ python3 tests/sanity/forknet_bug.py
$ bash pytest/tests/sanity/forknet_run.sh ~/nearcore/target/debug/neard ~/.near/test0_finished/ /tmp/fork-after Then checkout $ bash pytest/tests/sanity/forknet_run.sh ~/nearcore/target/debug/neard ~/.near/test0_finished/ /tmp/fork-before Then check there is no diff between these files: $ diff /tmp/fork-before/init-db-values.txt /tmp/fork-after/init-db-values.txt
$ diff /tmp/fork-before/finalize-post-db-values.txt /tmp/fork-after/finalize-post-db-values.txt |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12921 +/- ##
==========================================
+ Coverage 70.48% 70.50% +0.02%
==========================================
Files 851 851
Lines 174917 175032 +115
Branches 174917 175032 +115
==========================================
+ Hits 123285 123415 +130
+ Misses 46518 46482 -36
- Partials 5114 5135 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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
core/store/src/opener.rs
Outdated
let (_hot_db, _hot_snapshot, _cold_db, _cold_snapshot) = | ||
opener.open_dbs(Mode::ReadWriteExisting)?; |
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.
let (_hot_db, _hot_snapshot, _cold_db, _cold_snapshot) = | |
opener.open_dbs(Mode::ReadWriteExisting)?; | |
let _ = opener.open_dbs(Mode::ReadWriteExisting)?; |
nit
fork-network finalize
deletes data in every column except the ones we need to start the network, but it does it with a delete DB transaction. This only logically deletes the values, but does not free up the disk space, which will only happen after a compaction. So here we remove the columns by callingdrop_cf()
on the unnecessary columns, which actually removes the sst files and frees up the space. This will reduce the size of images used for forknet by quite a bit.