From c7380dad6bb9eab26641c5ec2707431ed573de3c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 May 2019 09:37:00 +0000 Subject: compact: reuse infrastructure from xcpdb 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. --- script/public-inbox-compact | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'script/public-inbox-compact') 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+ 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); } -- cgit v1.2.3-24-ge0c7