Comments (8)
from badger.
from badger.
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.
from badger.
Same also with NewKV
and Close
-- io.Closer
is idiomatic, please follow it.
from badger.
@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).
from badger.
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 :)
from badger.
@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.
from badger.
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.
from badger.
Related Issues (20)
- [BUG]: <Index Init Error giving out of bounds>
- [Documentation]: absent documentation about v4 HOT 3
- [BUG]: return odd keys bytes when scaning with prefix HOT 1
- [QUESTION]: Why badger use WAL? HOT 2
- [QUESTION]: How can I limit the disk size used by Badger or the number of keys that Badger can store through parameter configuration in the program? HOT 4
- Hi,badger-rs, a rust implements version has release [QUESTION]: <Title>
- [BUG]: Panic from a lot of DELs and SETs with very large keys
- [BUG]: when compression is none block cache will cache the table
- [QUESTION]: Batch write is partially committed when badger crashes
- [QUESTION]: Search keys by regular expressions HOT 1
- [BUG]: arm64 inconsistencies HOT 1
- [QUESTION]: Is Badger rsync friendly during db in use ? HOT 3
- How to achieve multiple process sharing and open a db
- [BUG]: compilation fails with `GOOS=aix` (Unix) HOT 1
- Memory crash
- [BUG]: RunValueGC HOT 1
- [FEATURE]: Storing values larger than 2 GB HOT 2
- [BUG]: Panic, help!
- [FEATURE]: <TTL Event>
- update ristretto HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from badger.