]> Sergey Matveev's repositories - public-inbox.git/commitdiff
xcpdb: use destination shard as progress prefix
authorEric Wong <e@80x24.org>
Wed, 12 Jun 2019 08:10:04 +0000 (08:10 +0000)
committerEric Wong <e@80x24.org>
Fri, 14 Jun 2019 01:31:13 +0000 (01:31 +0000)
For M:N resharding, we'll want to display the number from
the new shard number.

lib/PublicInbox/Xapcmd.pm

index 7204a911a2f4ffbd1df7fdd2afe2c171de08e0f0..5d8c35f4e750a5bcdac94a2ee7f703fed7e4776d 100644 (file)
@@ -198,10 +198,11 @@ sub cpdb_retryable ($$) {
 }
 
 sub progress_pfx ($) {
-       my @p = split('/', $_[0]);
+       my ($wip) = @_; # tempdir v2: ([0-9])+-XXXXXXXX
+       my @p = split('/', $wip);
 
        # return "xap15/0" for v2, or "xapian15" for v1:
-       ($p[-1] =~ /\A[0-9]+\z/) ? "$p[-2]/$p[-1]" : $p[-1];
+       ($p[-1] =~ /\A([0-9]+)/) ? "$p[-2]/$1" : $p[-1];
 }
 
 # xapian-compact wrapper
@@ -268,7 +269,7 @@ sub cpdb ($$) {
        my ($it, $end);
        my ($nr, $tot, $fmt); # progress output
        my $pr = $opt->{-progress};
-       my $pfx = $opt->{-progress_pfx} = progress_pfx($old);
+       my $pfx = $opt->{-progress_pfx} = progress_pfx($new);
 
        do {
                eval {