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-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.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EADEF1FA01 for ; Tue, 12 Oct 2021 11:47:05 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/9] search: delete QueryParser along with DB handle Date: Tue, 12 Oct 2021 11:46:59 +0000 Message-Id: <20211012114705.383-4-e@80x24.org> In-Reply-To: <20211012114705.383-1-e@80x24.org> References: <20211012114705.383-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Xapian::QueryParser is attached to the Xapian::Database, so holding onto the QueryParser was preventing us from releasing DB handles if a query was performed. --- lib/PublicInbox/Search.pm | 2 +- t/extsearch.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 17e202e1..dd6d3710 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -253,7 +253,7 @@ sub cleanup_shards { my $nr = grep(/\A[0-9]+\z/, readdir($dh)) or return warn("$xpfx has no shards\n"); # true return reopen($self) if $nr == ($self->{nshard} // -1); - delete($self->{xdb}); + delete @$self{qw(xdb qp)}; undef; } diff --git a/t/extsearch.t b/t/extsearch.t index 1b6235ba..8190de17 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -176,7 +176,7 @@ if ('inbox edited') { is($mset->size, 1, 'new message found'); $mset = $es->mset('b:"test message"'); is($mset->size, 1, 'old message found'); - delete @$es{qw(git over xdb)}; # fork preparation + delete @$es{qw(git over xdb qp)}; # fork preparation my $pi_cfg = PublicInbox::Config->new; $pi_cfg->fill_all;