Simple database with transaction support? Lassi Kortela (22 Feb 2020 12:00 UTC)
Re: Simple database with transaction support? Amirouche Boubekki (22 Feb 2020 14:33 UTC)
Re: Simple database with transaction support? John Cowan (22 Feb 2020 18:52 UTC)
Re: Simple database with transaction support? Arthur A. Gleckler (24 Feb 2020 05:32 UTC)
Re: Simple database with transaction support? John Cowan (24 Feb 2020 05:32 UTC)

Re: Simple database with transaction support? Amirouche Boubekki 22 Feb 2020 14:33 UTC

Le sam. 22 févr. 2020 à 13:00, Lassi Kortela <xxxxxx@lassi.io> a écrit :
>
> We talked a bit about the backend for api.scheme.org with Arthur, and
> came to the conclusion that SRFI 176/168 would be a good implementation
> strategy.

I am glad you consider srfi 167 and 168.

> Can you recommend a simple key-value store to use as the engine?

See the last paragraph.

> - LevelDB from Google seems simple and widely available; the only
> problem is that it doesn't have transactions and we'd have to write our
> own transaction layer.

There is the facebook fork called RocksDB that is supposed to support
transactions. But I never tried it. I was intimitated by the .h file.

> - FoundationDB looks very fancy - but probably _too_ fancy. We don't
> need to have a distributed system for such a simple application.

It is not only a distributed system, it can work standalone.
I asked the maintainers whether the standalone mode was supported
or if it was only meant for dev setup. They replied that 1/3 of the simulations
we running standalone mode, that it was supported and work.

> An in-process library similar to SQLite could be the ideal choice.
> LevelDB seems like it would fit the bill, except for transactions.

There is three alternatives:

- http://sophia.systems, also at https://github.com/pmwkaa/sophia

- wiredtiger, GPLv3

- the thing I call okvslite, that is the standalone shared library extracted
from sqlite4 project and promoted as merely an extension of sqlite3,
called SQLite LSM extension.

There is two drawbacks to okvslite:

- It is not built by the default sqlite Makefile, you need something like
the following Makefile to build it:

  https://github.com/arew-scheme/arew-scheme/blob/master/patches/MakefileLSM#L1

- It support only a single writer.  I do not know what happens when
multiple threads
or process try to write at the same time.  I only used it, in single
thread context.

Here are Chez Scheme bindings:

  https://github.com/arew-scheme/arew-scheme/blob/master/src/arew/data/base/lsm.scm

The API is straightforward. Like SQLite it support multiple process
accessing the database file.

Feel free to ask more questions.