about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-25 03:02:47 +0000
committerEric Wong <e@yhbt.net>2020-08-26 06:10:52 +0000
commit5f6a0d2342323541e44ff2f1e7329053d0263800 (patch)
treeec2243f42f3aebcacd08be07bc1b2dd06267092a /t
parent793dcb03635e167143c9df6897999f4698a5133c (diff)
downloadpublic-inbox-5f6a0d2342323541e44ff2f1e7329053d0263800.tar.gz
WAL actually seems to have ideal locking characteristics given
concurrency problems I'm experiencing with --reindex running
in parallel with expensive read-only SQLite queries:
<https://public-inbox.org/meta/20200825001204.GA840@dcvr/>

Unfortunately, we cannot blindly use WAL while preserving
compatibility with existing setups nor our guarantees that
read-only daemons are indeed "read-only".

However, respect an user's the choice to set WAL on their
own if they're comfortable with giving -nntpd/-httpd/-imapd
processes write permission to the directory storing SQLite DBs.
Diffstat (limited to 't')
-rw-r--r--t/over.t10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/over.t b/t/over.t
index 07672aa7..8bf64ecb 100644
--- a/t/over.t
+++ b/t/over.t
@@ -65,4 +65,14 @@ isnt($over->max, 0, 'max is non-zero');
 
 $over->rollback_lazy;
 
+# L<perldata/"Version Strings">
+my $v = eval 'v'.$over->{dbh}->{sqlite_version};
+SKIP: {
+        skip("no WAL in SQLite version $v < 3.7.0", 1) if $v lt v3.7.0;
+        $over->{dbh}->do('PRAGMA journal_mode = WAL');
+        $over = PublicInbox::OverIdx->new("$tmpdir/over.sqlite3");
+        is($over->connect->selectrow_array('PRAGMA journal_mode'), 'wal',
+                'WAL journal_mode not clobbered if manually set');
+}
+
 done_testing();