losfair / mvsqlite

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

Online DDL - stage 1 #80

Closed losfair closed 1 year ago

losfair commented 1 year ago

Related: https://github.com/losfair/mvsqlite/issues/70

This PR implements a restricted form of online DDL. It permits concurrent read-only DML when a schema migration task is in progress.

Currently you can already do non-blocking DDL with regular transactions, but that has a few limitations:

This PR introduces single-writer lock, which when enabled permits only a single writer, the schema migration task, to write to the database. All other tasks see the latest consistent snapshot before the lock.

losfair commented 1 year ago

It works, but still needs a careful review for correctness.

So much concurrency here.