# Neon: a versioned quad store that works like git requires a lock

**URL:** <https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305>\
**Category:** FoundationDB Layers\
**Created:** [April 29, 2018, 2:15pm UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305 "2018-04-29T14:15:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amirouche](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/amirouche/32/2096_2.png) [@amirouche](https://forums.foundationdb.org/u/amirouche)\
**Post date:** [April 29, 2018, 2:15pm UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305/1 "2018-04-29T14:15:51Z")

</div>

Héllo,

I created a versioned quad store on top of wiredtiger. The thing is that it requires a lock to work that protects a datastructure that is shared between all threads working against the same branch. In the context of foundations this would me there is distributed lock shared by all clients and a datastructure. What do you think I can use to replicate this lock using foundationdb? I am thinking about using REDIS. Maybe you know better.

The code is at [github](https://github.com/amirouche/neon) with the [documentation](https://github.com/amirouche/neon/blob/master/doc/MOCHA2018/preview/neon-mocha-2018-preview.pdf).

Feel free to give feedback on that idea of this kind of layer. Would you use something like that given it’s a _single writer multiple reader on a branch_ but think that **append only** transactions can be merged in master easily.

If there is no interest in such a layer I will fallback on non-versioned quadstore, that doesn’t require a lock to work properly or maybe I will create the quadstore to get started with Foundation API anway, not sure yet.

---

<div class="post-metadata">

**Author:** ![dave](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/dave/32/89_2.png) [@dave](https://forums.foundationdb.org/u/dave)\
**Post date:** [April 29, 2018, 4:04pm UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305/2 "2018-04-29T16:04:05Z")

</div>

You can certainly make locks in FDB, and furthermore you can do things to the database atomically with releasing the lock, which is pretty vital to making locks async fault tolerant. But you will have to think about what happens when the holder of the lock fails.

You should also consider an optimistic strategy: just go ahead modifying your shared data structure and trust FDB to abort any such modifications that conflict. It’s not necessarily more scalable than locking, you will still be latency bound, but it’s simpler.

---

<div class="post-metadata">

**Author:** ![amirouche](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/amirouche/32/2096_2.png) [@amirouche](https://forums.foundationdb.org/u/amirouche)\
**Post date:** [April 30, 2018, 7:37am UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305/3 "2018-04-30T07:37:35Z")

</div>

> [@dave](#):
>
> just go ahead modifying your shared data structure and trust FDB to abort any such modifications that conflict. It’s not necessarily more scalable than locking, you will still be latency bound, but it’s simpler.

I did not think about that it’s indeed much easier than the lock.

I keep you posted of my progress.

---

<div class="post-metadata">

**Author:** ![amirouche](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/amirouche/32/2096_2.png) [@amirouche](https://forums.foundationdb.org/u/amirouche)\
**Post date:** [May 2, 2018, 5:56pm UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305/4 "2018-05-02T17:56:08Z")

</div>

> [@dave](#):
>
> optimistic strategy

Does it make sens to have create a timeseres database on top of foundationdb?

---

<div class="post-metadata">

**Author:** ![dave](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/dave/32/89_2.png) [@dave](https://forums.foundationdb.org/u/dave)\
**Post date:** [May 5, 2018, 12:43am UTC](https://forums.foundationdb.org/t/neon-a-versioned-quad-store-that-works-like-git-requires-a-lock/305/5 "2018-05-05T00:43:03Z")

</div>

Sure. In fact, Wavefront’s product is at bottom more or less a time series database.
