about summary refs log tree commit homepage
path: root/lib/PublicInbox/Admin.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-08-20 20:24:56 +0000
committerEric Wong <e@yhbt.net>2020-08-20 21:11:24 +0000
commitf344d64066f85dd6737daeb42c94902e1bbfda78 (patch)
tree9a68a2a657a13ec245cfe360031b601a4d9d0c5c /lib/PublicInbox/Admin.pm
parentf62ddb19552b19f398d56193d7cf20cf20b61a04 (diff)
downloadpublic-inbox-f344d64066f85dd6737daeb42c94902e1bbfda78.tar.gz
Since we no longer read document data from Xapian, allow users
to opt-out of storing it.

This breaks compatibility with previous releases of
public-inbox, but gives us a ~1.5% space savings on Xapian
storage (and associated I/O and page cache pressure reduction).
Diffstat (limited to 'lib/PublicInbox/Admin.pm')
-rw-r--r--lib/PublicInbox/Admin.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index f5427af7..b8ead6f7 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -48,13 +48,14 @@ sub resolve_repo_dir {
 sub detect_indexlevel ($) {
         my ($ibx) = @_;
 
-        # brand new or never before indexed inboxes default to full
-        return 'full' unless $ibx->over;
-        delete $ibx->{over}; # don't leave open FD lying around
+        my $over = $ibx->over;
+        my $srch = $ibx->search;
+        delete @$ibx{qw(over search)}; # don't leave open FDs lying around
 
+        # brand new or never before indexed inboxes default to full
+        return 'full' unless $over;
         my $l = 'basic';
-        my $srch = $ibx->search or return $l;
-        delete $ibx->{search}; # don't leave open FD lying around
+        return $l unless $srch;
         if (my $xdb = $srch->xdb) {
                 $l = 'full';
                 my $m = $xdb->get_metadata('indexlevel');
@@ -65,6 +66,7 @@ sub detect_indexlevel ($) {
 $ibx->{inboxdir} has unexpected indexlevel in Xapian: $m
 
                 }
+                $ibx->{-skip_docdata} = 1 if $xdb->get_metadata('skip_docdata');
         }
         $l;
 }