Can we use a disk snapshot for SQLite?

I’m using Render with Strapi for a CMS. Strapi is using an SQLite database stored on a persisted Render disk.

The documentation for “Disk Snapshots” says:

Relying on a disk snapshot to restore a database is not recommended. Restoring a disk snapshot will likely result in corrupted or lost database data.

I tested restoring using a snapshot and it worked fine.

From looking over the documentation for SQLite, it appears a database file can become corrupted if there is transaction in progress during a backup.

But, if I’m understanding this correctly, SQLite can repair a corrupted database file if any temp journal/wal files were also backed up:

1.3. Deleting a hot journal:

SQLite normally stores all content in a single disk file. However, while performing a transaction, information necessary to recover the database following a crash or power failure is stored in auxiliary journal files. Such journal files are described as “hot”. The journal files have the same name as the original database file with the addition of -journal or -wal suffix.

SQLite must see the journal files to recover from a crash or power failure. If the hot journal files are moved, deleted, or renamed after a crash or power failure, then automatic recovery will not work and the database may go corrupt.”

Do Render snapshots back up the journal/wal files? Will using Render snapshots for an SQLite be a reliable way to restore the database?

We would certainly capture all files that exist on the disk - obviously, you’ve seen our documentation around disks but they are limited to other features as well as detailed at https://render.com/docs/disks#application-considerations

Regards,

John B

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.