Git Product home page Git Product logo

kvs's People

Contributors

weezy20 avatar

Watchers

 avatar

kvs's Issues

In memory index needs better guarantees

Currently for get tries to fetch all values that are in memory (store.map). This map is built via either replaying all log commands or by loading a pre-built map from disk. The latter requires better guarantees in relation to the disk log that it was built against. Having an empty map or a plain different map that doesn't reflect the current status of the database log issued by KvStore::open indicates a problem, the wrong values will be loaded into memory.

The following suggestions would need an implementation:

  1. Make the memory map load values from the same on-disk memory index as in the path specified by KvStore::open. If one doesn't exist, create one in the same location so as to maintain consistency. Also, the file name should be generated deterministically based on the current hash of the db log file so as to compute the file path of the on-disk in memory index (even though we already know it's going to be in the same place as the database), just to guarantee that it's the file we want.
  2. The hash of the current on-disk memory index should be stored somewhere to identify it as being the correct memory index that was generated during the time of a replay of log commands. This could mean either using a third file to maintain these integrity checks or some other mechanism. I prefer this option as it's simpler to understand and possibly implement.
  3. Optimize the two steps away if the cost of hashing and doing these lookups outweigh the benefit gained, for example, if the db log is small enough that it's cheaper to replay them to build the in memory index, do that!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.