From review findings:
- Moving a later snapshot of a database onto a new base could fail after
the database itself moved; the checkpoint then released the lock on the
new base and left db.base stale, so the next checkpoint wrote the wrong
base. The database's base is now set as soon as it moves, each later
snapshot moves on its own, and the lock is released by the file
registry once nothing reads the base.
- sqlite3_overlay_rebase returned SQLITE_BUSY once a transaction had
written pages, so a database in such a transaction never moved onto the
base its checkpoint wrote. Rebasing keeps every byte the overlay reads
as it was, so it is allowed then; a database closed meanwhile stays put.
- Without Web Locks, cleanup deleted bases that were still being written.
It now leaves empty bases alone until they are an hour old.
- The OPFS busy error named the error instead of the file.
Tests cover each, plus random changes, VACUUM to other page sizes and
overlapping checkpoints compared with a plain database.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KLDRgnFpp8Nwe1tz9TpbDC