Skip to content
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

Return disk errors back to client #28

Closed
whyrusleeping opened this issue May 15, 2017 · 8 comments
Closed

Return disk errors back to client #28

whyrusleeping opened this issue May 15, 2017 · 8 comments
Assignees

Comments

@whyrusleeping
Copy link

I was looking at trying this out as it seems like it might fit a good usecase for me, but i'm not sure exactly how it should be used. Specifically, there doesnt seem to be any sort of error handling, what happens when things go wrong? A Set call can't always succeed, how will i know when it doesnt?

@barakmich
Copy link

Same also with NewKV and Close -- io.Closer is idiomatic, please follow it.

@manishrjain
Copy link
Contributor

manishrjain commented May 15, 2017

@whyrusleeping : The rationale that some of these operations return no error is that unless we are unable to write to disk, there's no reason for the Set to fail (in which case it would log.Fatal, because there's not much you could do if you can't write to disk). It's a blind write. The only operations which can fail are CAS ops, which check the previous state.

Though, I see the point that given this is a library, that choice of log.Fatal isn't one we should make. @ashwin95r is working to send disk errors back (and not log.Fatal).

@manishrjain manishrjain changed the title Error handling? Return disk errors back to client May 16, 2017
@whyrusleeping
Copy link
Author

Yeah, definitely don't want to be doing log.Fatals in lower layers of the app. Let us know when you've got that wired up through, i'm really excited to work with badger :)

@manishrjain
Copy link
Contributor

manishrjain commented May 16, 2017

@ashwin95r and I looked at the code again. Even if we change Set to return an error back, there's nothing much a user can do about it, because this relates to a file system failure. One can't just change the directory Badger is pointing to; because it would then stop working.

Similarly, Get can only fail if we're unable to read stuff off disk (which would cause lot more issues than just a request failure, because LSM trees do lot of things in the background). All of these are permanent failures; so I see little benefit in returning these to the user.

We could add io.Closer interface, if that's of any value. It would just return nil.

@whyrusleeping
Copy link
Author

whyrusleeping commented May 16, 2017 via email

@whyrusleeping
Copy link
Author

whyrusleeping commented May 16, 2017 via email

@awfm9
Copy link

awfm9 commented May 22, 2017

It does not make sense to panic in the library. When saying it has to be a fatal error, you are ignoring that the consuming application might be doing a whole host of other things unrelated to writing to a K/V store. Bubbling up the errors to the user of the API and letting him decide what to do about it is definitely the way to go.

@manishrjain
Copy link
Contributor

This is a duplicate of #23, which I just addressed. Have another look at the public APIs, and feel free to reopen if I missed some API, or you expect to see something more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants