about summary refs log tree commit homepage
path: root/script/public-inbox-compact
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-23 09:37:00 +0000
committerEric Wong <e@80x24.org>2019-05-23 17:43:50 +0000
commitc7380dad6bb9eab26641c5ec2707431ed573de3c (patch)
tree39f97521df166ace6abb6b7140a1b6b82d1b2793 /script/public-inbox-compact
parented52051030b89985a1ec032ed4acc74912b0dd80 (diff)
downloadpublic-inbox-c7380dad6bb9eab26641c5ec2707431ed573de3c.tar.gz
Since -xcpdb is a superset of -compact, we can reuse much of
that code used for driving compact.

For compact (only), this is slightly less memory efficient since
it requires an extra process per-partition, but we get to prefix
the output with the partition name for more readable output.
Diffstat (limited to 'script/public-inbox-compact')
-rwxr-xr-xscript/public-inbox-compact6
1 files changed, 4 insertions, 2 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact
index 709fb92a..4f58d5af 100755
--- a/script/public-inbox-compact
+++ b/script/public-inbox-compact
@@ -3,14 +3,16 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 use PublicInbox::InboxWritable;
 use PublicInbox::Xapcmd;
 use PublicInbox::Admin;
 PublicInbox::Admin::require_or_die('-index');
 my $usage = "Usage: public-inbox-compact REPO_DIR\n";
+my $opt = { compact => 1, -coarse_lock => 1 };
+GetOptions($opt, qw(quiet|q)) or die "bad command-line args\n$usage";
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV) or die $usage;
 foreach (@ibxs) {
         my $ibx = PublicInbox::InboxWritable->new($_);
-        # we rely on --no-renumber to keep docids synched to NNTP
-        PublicInbox::Xapcmd::run($ibx, [qw(xapian-compact --no-renumber)]);
+        PublicInbox::Xapcmd::run($ibx, 'compact', $opt);
 }