← Back to context

Comment by ncruces

8 hours ago

To clarify, SQLite does this for local databases in WAL mode, that's what the shared memory WAL index file is for: it allows multiple processes to cooperate and figure out which pages changed since when, which also helps SQLite manage its page cache more efficiently.

Rollback mode needs to drop its page cache whenever there is any change to the database, because what changed – and what didn't – is not stored anywhere.

Confusingly, the read-replica VFS needs to pretend the database is in rollback mode even if it isn't. Otherwise, we'd have to fake a database file, a WAL and a WAL index, instead of just a database.