]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/OverIdx.pm
over+msgmap: do not store filename after DBI->connect
[public-inbox.git] / lib / PublicInbox / OverIdx.pm
index c7f45a6c910a91b98ca3500c0b06ed5e4a8c35c5..ea8da72336d1d13701111f0bf16367eccb544d1e 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 use warnings;
 use base qw(PublicInbox::Over);
 use IO::Handle;
-use DBI qw(:sql_types); # SQL_BLOB
+use DBI;
 use PublicInbox::MID qw/id_compress mids_for_index references/;
 use PublicInbox::Smsg qw(subject_normalized);
 use Compress::Zlib qw(compress);
@@ -23,6 +23,8 @@ sub dbh_new {
        my $dbh = $self->SUPER::dbh_new(1);
 
        # TRUNCATE reduces I/O compared to the default (DELETE)
+       # We do not use WAL since we're optimized for read-only ops,
+       # (and read-only requires SQLite 3.22.0 (2018-01-22)).
        $dbh->do('PRAGMA journal_mode = TRUNCATE');
 
        # 80000 pages (80MiB on SQLite <3.12.0, 320MiB on 3.12.0+)
@@ -307,7 +309,7 @@ VALUES (?,?,?,?,?,?)
        my $n = 0;
        my @v = ($num, $tid, $sid, $ts, $ds);
        foreach (@v) { $sth->bind_param(++$n, $_) }
-       $sth->bind_param(++$n, $ddd, SQL_BLOB);
+       $sth->bind_param(++$n, $ddd);
        $sth->execute;
        $sth = $dbh->prepare_cached(<<'');
 INSERT INTO id2num (id, num) VALUES (?,?)
@@ -429,7 +431,7 @@ sub rollback_lazy {
 sub disconnect {
        my ($self) = @_;
        die "in transaction" if $self->{txn};
-       $self->{dbh} = undef;
+       $self->SUPER::disconnect;
 }
 
 sub create {