-
Notifications
You must be signed in to change notification settings - Fork 993
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
use sandbox folder for txhashset validation on state sync #2685
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
15825f5
use sandbox folder for txhashset validation on state sync
garyyu 5533bc1
rustfmt
garyyu dd7af4a
use temp directory as the sandbox instead actual db_root txhashset dir
garyyu 5851288
rustfmt
garyyu 61b08f1
move txhashset overwrite to the end of full validation
garyyu 5db4341
fix travis-ci test
garyyu eb4adef
rustfmt
garyyu 2a6182b
fix: hashset have 2 folders including txhashset and header
garyyu 6dcd64a
rustfmt
garyyu 87a927d
(1)switch to rebuild_header_mmr instead of copy the sandbox header mm…
garyyu 7213ac9
minor improve on sandbox_dir
garyyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We can just pass either
root_dir
orsandbox_dir
as the first param and we don't need to handle the precedence rule here.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.
Thanks @antiochp for the review.
You have
header/header_head
andheader/sync_head/
reading on thisopen()
function, butheader/
is at same level astxhashset/
so surely it doesn't exist in sandbox folder.That's why I keep this first
root_dir
param.Could you explain more about why we need put
header\
also into thesandbox
folder?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.
Ah, perhaps that
rebuild
did the job :-)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.
but then what's the best to handle this
header/
folder insandbox
?rebuild_header_mmr()
again after moving thetxhashset/
folderWhich one do you prefer? Is the
rebuild_header_mmr()
a fast or slow processing?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.
Tried with
moving the header/ folder
, but see a lot ofCorrupted storage
log which could be caused by not-atomic processing on store duringtxhashset_write
processing?Switch to
rebuild_header_mmr()
solution now.And regarding the speed, the
rebuilding
spent 10 seconds on my slow mac air for current main chain height. not bad.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.
Ahh ok.
The original intent was to keep the
header
dir out thetxhashset
dir to make it more explicit what originated fromtxhashset.zip
and what was purely built locally.Maybe we consider making the sandbox dir a couple of levels deep?
So we can have something like -
Would this work?
I don't see any reasons why we would not be able to copy across both the
txhashset
dir and theheader
dir on successful validation.A txhashset will have file references to files under both these dirs so we'd need to be careful with ordering.
i.e. copy them across then reopen the newly updated txhashset.
Edit:
rebuild_header_mmr
would work but we should not need to do this. Its not based on data fromtxhashset.zip
so is effectively wasted effort as we simply read the headers from the db and rebuild the header MMR a second time this way.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.
@antiochp I don't know why, I tried the
header
dir moving on 2a6182b, but there were a lot ofCorrupted storage
logs. So I switch torebuild_header_mmr
solution.