diff options
author | Eric Wong <e@yhbt.net> | 2020-08-27 12:17:00 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-08-27 22:33:43 +0000 |
commit | 1e3c53a422b8d23cff961e43f77ea0a835cdef78 (patch) | |
tree | 62e2e3fa4b7eaceae213ef1aafe5a7f040c2ea30 | |
parent | 43b66634d508a1cd81023b5d567abae3804420c4 (diff) | |
download | public-inbox-1e3c53a422b8d23cff961e43f77ea0a835cdef78.tar.gz |
It's no problem for most users to enable WAL, here, since there's only a single process doing both reading and writing (unlike the read-only daemons). However, WAL doesn't work on network filesystems, so it can't be enabled by default.
-rw-r--r-- | lib/PublicInbox/IMAPTracker.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/IMAPTracker.pm b/lib/PublicInbox/IMAPTracker.pm index 102a74ce..92f21584 100644 --- a/lib/PublicInbox/IMAPTracker.pm +++ b/lib/PublicInbox/IMAPTracker.pm @@ -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; } |