diff options
author | Eric Wong <e@80x24.org> | 2019-05-23 09:37:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-23 17:43:50 +0000 |
commit | 0e41e076145c51f21151e29d64bd66cd3534d3ba (patch) | |
tree | 8003cdbfe10cd573792e944fb41074e9cc8e6343 /lib/PublicInbox/Xapcmd.pm | |
parent | c7380dad6bb9eab26641c5ec2707431ed573de3c (diff) | |
download | public-inbox-0e41e076145c51f21151e29d64bd66cd3534d3ba.tar.gz |
Allow users to specify the --blocksize <B>, --no-full, --fuller options for xapian-compact(1) for fine-tuning compact behavior for low-traffic/inactive inboxes. We also won't support --multipass, since it doesn't seem compatible with our requirement to use --no-renumber. We also won't support --single-file, since it only seems intended for totally dead inboxes; and it doesn't seem worth the support overhead when "totally dead" turns out to be a misdiagnosis.
Diffstat (limited to 'lib/PublicInbox/Xapcmd.pm')
-rw-r--r-- | lib/PublicInbox/Xapcmd.pm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index 488c6165..74abf999 100644 --- a/lib/PublicInbox/Xapcmd.pm +++ b/lib/PublicInbox/Xapcmd.pm @@ -13,6 +13,7 @@ use File::Basename qw(dirname); # support testing with dev versions of Xapian which installs # commands with a version number suffix (e.g. "xapian-compact-1.5") our $XAPIAN_COMPACT = $ENV{XAPIAN_COMPACT} || 'xapian-compact'; +our @COMPACT_OPT = qw(quiet|q blocksize|b=s no-full|n fuller|F); sub commit_changes ($$$) { my ($ibx, $tmp, $opt) = @_; @@ -213,13 +214,19 @@ sub compact ($$) { defined(my $dfd = $opt->{$fd}) or next; $rdr->{$fd} = $dfd; } - if ($pr) { - $pr->("$pfx compacting...\n"); - $rdr->{1} = fileno($w) if pipe($r, $w); - } + $rdr->{1} = fileno($w) if $pr && pipe($r, $w); # we rely on --no-renumber to keep docids synched to NNTP - my $cmd = [ $XAPIAN_COMPACT, '--no-renumber', $src, $dst ]; + my $cmd = [ $XAPIAN_COMPACT, '--no-renumber' ]; + for my $sw (qw(no-full fuller)) { + push @$cmd, "--$sw" if $opt->{$sw}; + } + for my $sw (qw(blocksize)) { + defined(my $v = $opt->{$sw}) or next; + push @$cmd, "--$sw", $v; + } + $pr->("$pfx `".join(' ', @$cmd)."'\n") if $pr; + push @$cmd, $src, $dst; my $pid = spawn($cmd, undef, $rdr); if ($pr) { close $w or die "close: \$w: $!"; |