ncruces / go-sqlite3

Go bindings to SQLite using wazero
https://pkg.go.dev/github.com/ncruces/go-sqlite3
MIT License
499 stars 16 forks source link

Litestream compatibility? #42

Closed Koeng101 closed 7 months ago

Koeng101 commented 10 months ago

In the documentation:

To work around this limitation, SQLite is patched to always use EXCLUSIVE locking mode for WAL databases.

This seems to mean software like litestream, which uses taking over the WAL file for backups, wouldn't work. I just wanted to confirm I'm correct about that, so I don't use those two pieces of software together!

ncruces commented 10 months ago

Your intuition is correct: as things stand this driver is not compatible with Litestream.

Supporting WAL in a way that enables (an external process like) Lightstream to work is particularly hard.

gedw99 commented 10 months ago

https://github.com/maxpert/marmot is an alternative from Litestream that uses NATS for storage.

you can easily get it going using embedded nats too: https://github.com/maxpert/marmot/blob/master/stream/embedded_nats.go

Its using github.com/mattn/go-sqlite3: https://github.com/maxpert/marmot/blob/master/db/sqlite.go#L15C3-L15C30

ncruces commented 10 months ago

This again depends on WAL mode, for which current support is less than great.

gedw99 commented 10 months ago

Indeed it does.