losfair / mvsqlite

Distributed, MVCC SQLite that runs on FoundationDB.
https://github.com/losfair/mvsqlite/wiki
Apache License 2.0
1.36k stars 39 forks source link

Pessimistic write locks #3

Closed losfair closed 1 year ago

losfair commented 1 year ago

Turns out that the commit hook is called before the page cache is flushed to VFS - so we can't really use it to do the commit.

Instead, in this PR a mechanism for pessimistic write locks is implemented. Exclusive transactions that are not mvcc_aware will acquire a lock. If there is already conflict at this stage, a database is locked error is returned. This is a best-effort behavior to match SQLite's standard behavior.

Fixes https://github.com/losfair/mvsqlite/issues/2.