From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 24E6E1FAE4 for ; Wed, 28 Feb 2018 23:42:08 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 03/21] v2/ui: retry DB reopens in a few more places Date: Wed, 28 Feb 2018 23:41:44 +0000 Message-Id: <20180228234202.8839-4-e@80x24.org> In-Reply-To: <20180228234202.8839-1-e@80x24.org> References: <20180228234202.8839-1-e@80x24.org> List-Id: Relying more on Xapian requires retrying reopens in more places to ensure it does not fall down and show errors to the user. --- lib/PublicInbox/Inbox.pm | 8 +++++--- lib/PublicInbox/Search.pm | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index f000a95..54a6eb3 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -254,9 +254,11 @@ sub msg_by_mid ($$;$) { my ($self, $mid, $ref) = @_; my $srch = search($self) or return msg_by_path($self, mid2path($mid), $ref); - my $smsg = $srch->lookup_skeleton($mid) or return; - $smsg->load_expand; - msg_by_smsg($self, $smsg, $ref); + my $smsg; + $srch->retry_reopen(sub { + $smsg = $srch->lookup_skeleton($mid) and $smsg->load_expand; + }); + $smsg ? msg_by_smsg($self, $smsg, $ref) : undef; } 1; diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index b20b2cc..1df87d0 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -185,7 +185,7 @@ sub query { sub get_thread { my ($self, $mid, $opts) = @_; - my $smsg = eval { $self->lookup_skeleton($mid) }; + my $smsg = retry_reopen($self, sub { lookup_skeleton($self, $mid) }); return { total => 0, msgs => [] } unless $smsg; my $qtid = Search::Xapian::Query->new('G' . $smsg->thread_id); @@ -216,6 +216,7 @@ sub retry_reopen { if (ref($@) eq 'Search::Xapian::DatabaseModifiedError') { reopen($self); } else { + warn "ref: ", ref($@), "\n"; die; } } -- EW