Database and WAL file size

Is there a way to force the WAL file to shrink?

My DB has grown to 7.8G, and the db-wal file is over 15G. Based on my limited knowledge of SQLite WAL mechanics, it would seem that the cuplrit is that there is never enough time where the urbackup server isn’t running a backup of some sort for the SQLite to commit all of the data. I have also read that the wal files are simply overwritten, rather than removed and restarted.

I have tried stopping and restarting the urbackup_srv process (Linux) which had no effect.

Server version:

If you have the sqlite shell you can shrink it while UrBackup is shut down.

sqlite3 /var/urbackup/backup_server.db
PRAGMA journal_mode = DELETE;  

Should do the trick. It temporarily switches the journal mode of the database. UrBackup will automatically switch it back to WAL.

Do you think UrBackup should try to shrink the WAL file during nightly cleanups?

This worked perfectly.

As to nightly cleanups - an option for this “as needed” might be great. Or perhaps adding an option to manually compact/repair as a maintenance feature. Certainly convenient to have it as a built-in feature, but not required.

Thanks for your help!