]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/IMAPTracker.pm
imaptracker: preserve WAL journal_mode if set by user
[public-inbox.git] / lib / PublicInbox / IMAPTracker.pm
index 102a74ce66b8ec0c1ba52be5200ee37d38dd08de..92f21584842d97d2d6d1d3747596e251ad8719d6 100644 (file)
@@ -29,7 +29,12 @@ sub dbh_new ($) {
                sqlite_use_immediate_transaction => 1,
        });
        $dbh->{sqlite_unicode} = 1;
-       $dbh->do('PRAGMA journal_mode = TRUNCATE');
+
+       # TRUNCATE reduces I/O compared to the default (DELETE).
+       # Allow and preserve user-overridden WAL, but don't force it.
+       my $jm = $dbh->selectrow_array('PRAGMA journal_mode');
+       $dbh->do('PRAGMA journal_mode = TRUNCATE') if $jm ne 'wal';
+
        create_tables($dbh);
        $dbh;
 }