-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
speed up closeWhatNotInList #12114
speed up closeWhatNotInList #12114
Conversation
looks good. but seems we have corner-case: we don't know "is download of file finished or not". i think it's possible to open some file (like .idx). i feel - it's possible to open .idx file - which was bad (metadata section was not downloaded) - and still get non-nil object in this case (no error may happen - if validation will not catch it). In all other cases i think your fix will work. |
find a way to cover the corner case: |
Unfortunately this check won't work. The torrent lib truncates the mmap to its full size on initiation so it can randomly write to the full extent. So this will always be true once the download starts. We have added a callback from the downloader when download completes - which can be used to know when the file is downloaded:
Making this call available to the snapshot code is part of a bigger refactor. |
Thx for reminding. Will try implementing the callback and other possible alternatives. |
sorry for late reply, on vacation last week. i implement the hash comparison to check if file is fully downloaded.
but where to do hash comparison is still under consideration |
another idea is to create commitment file for segment/index after download finished.
|
This PR conducts file hashing function during rebuild, which is quite expensive. Also above corner case is still unsolved cause getting file hash and reopen file are not atomic. So I prepared another PR #12245 according to this quote:
|
do not reopen(achieved by RPCDaemon and Erigon: don't open files at startup if download is not finished (StageSnapshots == 0) #12332 and seg: don't reopen files #12362, so remove relevant code here)