diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-18 09:13:07 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-18 09:14:12 +0000 |
commit | 0961df2523044bf32270909f4983349eccad0153 (patch) | |
tree | 2369df5f34c76f6915fc0ac7444a4beb51ee40b5 /script/public-inbox-compact | |
parent | e7de01f139de8a5f90e9f1349732ebae8e2975f9 (diff) | |
download | public-inbox-0961df2523044bf32270909f4983349eccad0153.tar.gz |
--no-renumber does not allow merging, and merging is not ideal for reindexing, either.
Diffstat (limited to 'script/public-inbox-compact')
-rwxr-xr-x | script/public-inbox-compact | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact index 9f332657..5f18497e 100755 --- a/script/public-inbox-compact +++ b/script/public-inbox-compact @@ -10,6 +10,7 @@ use PublicInbox::InboxWritable; use Cwd 'abs_path'; use File::Temp qw(tempdir); use File::Path qw(remove_tree); +use PublicInbox::Spawn qw(spawn); my $usage = "Usage: public-inbox-compact REPO_DIR\n"; my $dir = shift or die $usage; my $config = PublicInbox::Config->new; @@ -58,10 +59,11 @@ if ($v == 2) { my $new = tempdir('compact-XXXXXXXX', CLEANUP => 1, DIR => $dir); $ibx->with_umask(sub { $v2w->lock_acquire; - my @parts; + my %pids; while (defined(my $dn = readdir($dh))) { if ($dn =~ /\A\d+\z/) { - push @parts, "$old/$dn"; + my $cmd = [ @compact, "$old/$dn", "$new/$dn" ]; + $pids{spawn($cmd)} = join(' ', @$cmd); } elsif ($dn eq '.' || $dn eq '..') { } elsif ($dn =~ /\Aover\.sqlite3/) { } else { @@ -69,9 +71,12 @@ if ($v == 2) { } } close $dh; - die "No Xapian parts found in $old\n" unless @parts; - my $cmd = [@compact, @parts, "$new/0" ]; - PublicInbox::Import::run_die($cmd); + die "No Xapian parts found in $old\n" unless keys %pids; + while (scalar keys %pids) { + my $pid = waitpid(-1, 0); + my $desc = delete $pids{$pid}; + die "$desc failed: $?\n" if $?; + } commit_changes($v2w, $old, $new); }); } elsif ($v == 1) { |