-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
KV parameters verification. #29
Conversation
badger/kv.go
Outdated
return nil, y.Wrapf(err, "Incorrect Dir parameter") | ||
} | ||
if !dirExists { | ||
return nil, y.Errorf("Directory '%s' does not exist.", opt.Dir) |
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.
Use %q
instead of '%s'
badger/kv.go
Outdated
return nil, y.Errorf("Directory '%s' does not exist.", opt.Dir) | ||
} | ||
if !(opt.ValueLogFileSize <= 2<<30 && opt.ValueLogFileSize >= 1<<20) { | ||
return nil, y.Errorf("ValueLogFileSize should be between 1MB and 1GB") |
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.
Replace should
with must
as you are handling this as a fatal issue.
Reviewed 5 of 5 files at r1. badger/kv.go, line 125 at r1 (raw file): Previously, dolmen (Olivier Mengué) wrote…
Address the comment above. Also, predefine this error using var, and just reuse them. That way, a user can check the error returned against the var, instead of having to do string matching. both of these above errors can be ErrInvalidDir. badger/kv.go, line 198 at r1 (raw file):
Does Replay return any error? If it can, we should handle it here. In fact, if you look carefully at all the y.Checkf, you should be able to find the ones which are being directly called from the API. Make all those return errors using errors.Wrapf and the likes. I did that just now for value log opening and closing. Comments from Reviewable |
Review status: 2 of 5 files reviewed at latest revision, 3 unresolved discussions. badger/kv.go, line 125 at r1 (raw file): Previously, manishrjain (Manish R Jain) wrote…
Added type instead of var in order to pass the error message up. badger/kv.go, line 128 at r1 (raw file): Previously, dolmen (Olivier Mengué) wrote…
Done. badger/kv.go, line 198 at r1 (raw file): Previously, manishrjain (Manish R Jain) wrote…
Leaving this for you. Comments from Reviewable |
Reviewed 1 of 3 files at r2, 2 of 2 files at r3. badger/kv.go, line 120 at r3 (raw file):
ErrValueLogSize Comments from Reviewable |
Merged. |
Resolves #23
This change is