-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add option for datastore read rehashing #2904
Conversation
a5ef1d8
to
39adcb3
Compare
@@ -23,6 +23,7 @@ var log = logging.Logger("blockstore") | |||
var BlockPrefix = ds.NewKey("blocks") | |||
|
|||
var ValueTypeMismatch = errors.New("The retrieved value is not a Block") | |||
var ErrHashMismatch = errors.New("Block on disk has different hash than expected.") |
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.
- the block isn't neccessarily on disk, that's up to the datastore, isn't it? ;)
- IIRC no dot at the end. @RichardLitt dug up conventions for go error messages the other day
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.
yeah, right
Would be good to have an explicit default value for this in repo/config/init.go |
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
39adcb3
to
a84c859
Compare
bs := bstore.NewBlockstore(n.Repo.Datastore()) | ||
n.Blockstore, err = bstore.WriteCached(bs, kSizeBlockstoreWriteCache) | ||
|
||
rcfg, err := n.Repo.Config() |
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.
I can't comment on non-changed lines, so here: the other n.Repo.Config()
in this function can probably be removed.
The error handling is a bit off here too. You're throwing away the error from bstore.WriteCached()
, and you can omit the == nil
check if you just move that thing to after the usual != nil
check.
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.
I've screwed up here, the err != nil
check should be after 134.
Then latter I am checking for err == nil
as we are requesting con-fig only in case of online more.
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
c04c1dc
to
174ab12
Compare
@lgierth thanks for looking at it, I made really stupid mistake there with error handling. |
lets add a test where we purposely mess with the values in the blocks directory on disk and try to read the data through ipfs. |
@@ -0,0 +1,37 @@ | |||
#!/bin/sh | |||
# | |||
# Copyright (c) 2016 Mike Pfister |
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.
Who is Mike?
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.
Someone credited in t0083
. 😄
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
e7f4f69
to
dead777
Compare
circleCI seems to be taking a break, LGTM |
@Kubuxu what was the actual bug resolved here? i think 2256 is incorrect |
It was #2259 |
rehash bool | ||
} | ||
|
||
func (bs *blockstore) RuntimeHashing(enabled bool) { |
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.
- this is not a clear name, because there is runtime hashing regardless
- use:
HashOnRead
Resolves #2256
Enabled using
Datastore.HashOnRead: true
in IPFS config.