* [PATCH 0/6] make Search::Xapian optional for v2, NNTP, etc
@ 2019-05-15 6:33 4% Eric Wong
2019-05-15 6:33 7% ` [PATCH 5/6] searchidx: do not create empty Xapian partitions for basic Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-05-15 6:33 UTC (permalink / raw)
To: meta
Search::Xapian is missing from CentOS 7 and probably other
distros; so make it optional as all of our NNTP and a large
chunk of our WWW functionality doesn't rely on it, anymore.
Xapian databases is also the most expensive in terms of space
for indexing overhead, so indexlevel=basic users may appreciate
not having to install Xapian at all.
This has passed all test profiles (ci/profiles.sh) on Debian 9
and FreeBSD 11.2 (x86-64); but I haven't dogfooded it enough
to be comfortable having it in 'master'... and I might not be
online much the next few days in case something goes sideways
on public-inbox.org.
The following changes since commit 2d51a2accd28465c915f91ab48c7e52a81d87a68:
tests: get rid of unnecessary Cwd module use (2019-05-14 04:00:10 +0000)
are available in the Git repository at:
https://80x24.org/public-inbox.git xap-optional
for you to fetch changes up to d0e8bfd866ed1e924e8d9f551939eecbea4920ef:
admin: improve warnings and errors for missing modules (2019-05-15 06:15:34 +0000)
----------------------------------------------------------------
Eric Wong (6):
inbox: add ->over method to ease access
nntp: use Inbox->over directly
www: use Inbox->over where appropriate
lazy load Xapian and make it optional for v2
searchidx: do not create empty Xapian partitions for basic
admin: improve warnings and errors for missing modules
INSTALL | 2 +-
TODO | 2 -
ci/deps.perl | 7 +--
ci/profiles.sh | 3 +-
lib/PublicInbox/Admin.pm | 60 ++++++++++++++++++++
lib/PublicInbox/Feed.pm | 11 ++--
lib/PublicInbox/Inbox.pm | 40 +++++++++-----
lib/PublicInbox/Mbox.pm | 25 +++++----
lib/PublicInbox/NNTP.pm | 40 +++++++-------
lib/PublicInbox/OverIdx.pm | 13 ++++-
lib/PublicInbox/Search.pm | 125 +++++++++++++++++-------------------------
lib/PublicInbox/SearchIdx.pm | 57 +++++++++++++------
lib/PublicInbox/SearchMsg.pm | 14 +++++
lib/PublicInbox/SearchView.pm | 13 +++--
lib/PublicInbox/View.pm | 53 ++++++++----------
lib/PublicInbox/WWW.pm | 39 +++++--------
script/public-inbox-index | 43 ++++++++++-----
script/public-inbox-init | 8 ++-
script/public-inbox-purge | 48 +++++++++++++---
t/admin.t | 2 +-
t/cgi.t | 16 ++++--
t/indexlevels-mirror.t | 22 ++++++--
t/nntp.t | 2 +-
t/nntpd.t | 15 +++--
t/over.t | 3 +-
t/psgi_bad_mids.t | 3 +-
t/psgi_scan_all.t | 4 +-
t/psgi_search.t | 4 +-
t/purge.t | 2 +-
t/search-thr-index.t | 5 +-
t/search.t | 11 ++--
t/v1reindex.t | 3 +-
t/v2reindex.t | 5 +-
t/v2writable.t | 2 +-
t/view.t | 1 +
t/watch_maildir_v2.t | 4 +-
36 files changed, 432 insertions(+), 275 deletions(-)
^ permalink raw reply [relevance 4%]
* [PATCH 5/6] searchidx: do not create empty Xapian partitions for basic
2019-05-15 6:33 4% [PATCH 0/6] make Search::Xapian optional for v2, NNTP, etc Eric Wong
@ 2019-05-15 6:33 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-15 6:33 UTC (permalink / raw)
To: meta
No point in leaving a mess of empty directories when Xapian
doesn't load.
---
lib/PublicInbox/SearchIdx.pm | 7 ++++++-
t/indexlevels-mirror.t | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 135b5eb..f96f0d0 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -110,7 +110,12 @@ sub _xdb_acquire {
if ($self->{creat}) {
require File::Path;
$self->lock_acquire;
- File::Path::mkpath($dir);
+
+ # don't create empty Xapian directories if we don't need Xapian
+ my $is_part = defined($self->{partition});
+ if (!$is_part || ($is_part && need_xapian($self))) {
+ File::Path::mkpath($dir);
+ }
}
return unless defined $flag;
$self->{xdb} = Search::Xapian::WritableDatabase->new($dir, $flag);
diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t
index cac7050..3dd4323 100644
--- a/t/indexlevels-mirror.t
+++ b/t/indexlevels-mirror.t
@@ -116,6 +116,11 @@ sub import_index_incremental {
is($nr, 1, '2nd message gone from mirror');
is_deeply([map { $_->{mid} } @$msgs], ['m@1'],
'message unavailable in mirror');
+
+ if ($v == 2 && $level eq 'basic') {
+ is_deeply([glob("$ibx->{mainrepo}/xap*/?/")], [],
+ 'no Xapian partition directories for v2 basic');
+ }
}
# we can probably cull some other tests and put full/medium tests, here
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-15 6:33 4% [PATCH 0/6] make Search::Xapian optional for v2, NNTP, etc Eric Wong
2019-05-15 6:33 7% ` [PATCH 5/6] searchidx: do not create empty Xapian partitions for basic Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).