changeset 5057:e6f26be401fa

SQLite: close and delete WAL and SHM files on exit (contribution from Sebastian Höffner)
author Alain Mazy <am@osimis.io>
date Tue, 02 Aug 2022 11:38:31 +0200
parents 191e86305f19
children d4e5ca0c9307
files NEWS OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Jul 14 18:53:24 2022 +0200
+++ b/NEWS	Tue Aug 02 11:38:31 2022 +0200
@@ -10,7 +10,8 @@
 -----------
 
 * DelayedDeletion plugin: Fix leaking of symbols
-
+* SQLite now closes and deletes WAL and SHM files on exit.  This should improve
+  handling of SQLite DB over network drives.
 
 Version 1.11.1 (2022-06-30)
 ===========================
--- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Thu Jul 14 18:53:24 2022 +0200
+++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp	Tue Aug 02 11:38:31 2022 +0200
@@ -1371,6 +1371,8 @@
   void SQLiteDatabaseWrapper::Close()
   {
     boost::mutex::scoped_lock lock(mutex_);
+    // close and delete the WAL when exiting properly -> the DB is stored in a single file (no more -wal and -shm files)
+    db_.Execute("PRAGMA JOURNAL_MODE=DELETE;");
     db_.Close();
   }