Well done. I am curious, though, if you tried implementing this as a sqlite VFS. That would allow it to be more plug-n-play with existing software that already talks to sqlite.
I suppose you would have had to hack up something to map offset ranges into key/value pairs, but at a high level, it seems feasible.
I built one recently. We have a SQLite VFS built on top of Zookeeper for doing metadata-like stuff. We can pull between 1000-100000 reads per seconds out of it.
I realize that this is a total abuse of what Zookeeper does, and how it is supposed to work, but hey, this is a solution that's _simple_ and _correct_.
I looked up SQLite VFS. That's pretty interesting, though I am not sure if rqlite has sufficient control over that low a layer in the system, due to the way rqlite is built.
I was really just curious if you had looked at it and ruled it out. Pretty sure it would be a different approach not compatible with the way rqlite works. At the VFS level, you're only seeing the reads/writes/locks to the data file...no visibility to the sql.
If you implement a VFS, you have to either implement the WAL subsystem yourself, which isn't pluggable at the moment, or go with journaling mode, which is kinda meh.
>>If you implement a VFS, you have to either implement the WAL subsystem yourself
It's pluggable in the sense that it maps the the shared memory calls for WAL to your calls. But yeah, figuring out how to emulate shared memory across a cluster is on the implementer.
Is this a potential way to work around the single-writer nature of SQLite? It's probably the main limitation I hit when using SQLite, which otherwise fits a lot of jobs very well. Obviously you would not want to use it for situations where there is contention, but SQLite locks the whole database even if you are writing to completely separate tables.
Stupid question: What if I want the databases to be built with optional extensions (like the json extension)? Is there a way to deal with such scenario?
I'm not really sure I follow you. But if it requires compiling other stuff into the source code, probably not. The SQLite source is built along with the SQLite Go layer, without that control AFAIK.
I suppose you would have had to hack up something to map offset ranges into key/value pairs, but at a high level, it seems feasible.