about summary refs log tree commit homepage
path: root/script/public-inbox-compact
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-07-30 12:18:55 +0000
committerEric Wong <e@80x24.org>2021-07-31 00:14:20 +0000
commitdd80dcaa1e46543893de533938a1651639f91f10 (patch)
tree5adc2105b766957782d9d876f4c7914e9bf89c38 /script/public-inbox-compact
parentb38ffe92ee5ccb5eb4e5892e8cafba85303cadfc (diff)
downloadpublic-inbox-dd80dcaa1e46543893de533938a1651639f91f10.tar.gz
Since extindex uses Xapian shards in a similar way to
v2 inboxes, we'll support -xcpdb (reshard+upgrade) and
-compact all the same to give admins tuning+upgrade
options.
Diffstat (limited to 'script/public-inbox-compact')
-rwxr-xr-xscript/public-inbox-compact16
1 files changed, 10 insertions, 6 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact
index ab1d1e5e..6e34aaeb 100755
--- a/script/public-inbox-compact
+++ b/script/public-inbox-compact
@@ -4,9 +4,9 @@
 use strict;
 use v5.10.1;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-my $opt = { compact => 1, -coarse_lock => 1 };
+my $opt = { compact => 1, -coarse_lock => 1, -eidx_ok => 1 };
 my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
-usage: public-inbox-compact INBOX_DIR
+usage: public-inbox-compact <INBOX_DIR|EXTINDEX_DIR>
 
   Compact Xapian DBs in an inbox
 
@@ -29,9 +29,13 @@ PublicInbox::Admin::progress_prepare($opt);
 
 require PublicInbox::InboxWritable;
 require PublicInbox::Xapcmd;
-my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt);
-unless (@ibxs) { print STDERR $help; exit 1 }
-foreach (@ibxs) {
-        my $ibx = PublicInbox::InboxWritable->new($_);
+my $cfg = PublicInbox::Config->new;
+my ($ibxs, $eidxs) = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
+unless ($ibxs) { print STDERR $help; exit 1 }
+for my $ibx (@$ibxs) {
+        $ibx = PublicInbox::InboxWritable->new($ibx);
         PublicInbox::Xapcmd::run($ibx, 'compact', $opt);
 }
+for my $eidx (@$eidxs) {
+        PublicInbox::Xapcmd::run($eidx, 'compact', $opt);
+}