From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 70C4A2007E for ; Tue, 27 Oct 2020 07:54:56 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 18/52] v2writable: checkpoint: account for lack of {mm} Date: Tue, 27 Oct 2020 07:54:19 +0000 Message-Id: <20201027075453.19163-19-e@80x24.org> In-Reply-To: <20201027075453.19163-1-e@80x24.org> References: <20201027075453.19163-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: ExtSearchIdx will not have Msgmap, since it may index non email blobs in the future (it'll still be usable with IMAP, but not NNTP). --- lib/PublicInbox/V2Writable.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index f8b7abe1..867e4d2b 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -609,10 +609,11 @@ sub checkpoint ($;$) { } my $shards = $self->{idx_shards}; if ($shards) { - my $dbh = $self->{mm}->{dbh}; + my $mm = $self->{mm}; + my $dbh = $mm->{dbh} if $mm; # SQLite msgmap data is second in importance - $dbh->commit; + $dbh->commit if $dbh; # SQLite overview is third $self->{oidx}->commit_lazy; @@ -632,11 +633,12 @@ sub checkpoint ($;$) { # last_commit is special, don't commit these until # Xapian shards are done: - $dbh->begin_work; + $dbh->begin_work if $dbh; set_last_commits($self); - $dbh->commit; - - $dbh->begin_work; + if ($dbh) { + $dbh->commit; + $dbh->begin_work; + } } $self->{total_bytes} += $self->{transact_bytes}; $self->{transact_bytes} = 0;