]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei/store: do eidx_init before creating R/W lms dbh
authorEric Wong <e@80x24.org>
Wed, 9 Jun 2021 10:03:05 +0000 (10:03 +0000)
committerEric Wong <e@80x24.org>
Wed, 9 Jun 2021 10:03:40 +0000 (10:03 +0000)
Sharing lms->{dbh} with eidx shards appears to be the cause of
the "Issuing rollback() due to DESTROY without explicit
disconnect() of DBD::SQLite::db handle" messages I've been
seeing from "lei up".

lib/PublicInbox/LeiMailSync.pm
lib/PublicInbox/LeiStore.pm

index ec05404ad004fc9740e7aec781fd9ddc96efd539..558988f3d3fe922121c286384ffab2f84f0aa590 100644 (file)
@@ -405,13 +405,12 @@ sub imap_oid {
        $oidbin ? unpack('H*', $oidbin) : undef;
 }
 
-# FIXME: something with "lei <up|q>" is causing uncommitted transaction
-# warnings, not sure what...
+# FIXED? something with "lei <up|q>" is causing uncommitted transaction
+# TODO: remove soon
 sub DESTROY {
        my ($self) = @_;
        my $dbh = delete($self->{dbh}) or return;
        return if $dbh->{ReadOnly};
-       use Carp;
        undef $dbh;
        warn "BUG $$ $0 $self {dbh} OPEN ppid=".getppid.' '.Carp::longmess();
 }
index 0b033e3e3095b8d3a0725ad6a2850daf5b9e9c73..5446873e4e2ebd327033ce9513e66e7388500a14 100644 (file)
@@ -195,6 +195,7 @@ sub remove_eml_vmd { # remove just the VMD
 
 sub _lms_rw ($) {
        my ($self) = @_;
+       my ($eidx, $tl) = eidx_init($self);
        $self->{lms} //= do {
                require PublicInbox::LeiMailSync;
                my $f = "$self->{priv_eidx}->{topdir}/mail_sync.sqlite3";