tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.54k stars 252 forks source link

Improve local cache and prefer local reads #1545

Closed avinassh closed 2 months ago

avinassh commented 2 months ago

Till now, DurableWAL used Storage Server for finding page versions. If the local cache's max_frame_no is same as storage server's and if a txn's max_frame_no is less or same as cache's max_frame_no, then all reads and writes can proceed using local data itself. Do note that writes from a stale primary will be rejected anyways, since we handle conflicts at Storage Server.

Currently, there is no replication built and it assumes a single primary writer. So, after write, it updates the local cache. In the future PRs, I will add replication.

What's changed:

What's next: