mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-01-06 12:05:51 +00:00
369438f20f
We have a problem with WAL API where in some scenarios, we seem to lose WAL frames that were already applied. However, inspecting the external WAL frame, the sync mechanics work fine and the problem is in SQLite's in-memory state. As it turnws out, the sqlite3PagerWalBeginCommit() function first begins a read transaction and then upgrades it to a write transaction. However, sqlite3PagerWalEndCommit() only ends the write transaction and therefore leaves the pager in READER state. Let's call pager_unlock() to switch to OPEN stte, fixing the issue of disappearing frames.