From 3e894f400e588246f529dd4fb1257e19e63a17ed Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 May 2019 09:36:58 +0000 Subject: xcpdb: show re-indexing progress Emit information about reindexing git revision ranges when used with xcpdb. Additionally, distinguish Xapian copy output from v2 git epoch counting by increasing directory context info. For now, v1 batches batches are emitted. v2 indexing is still missing progress reporting for batches, as the data structures for reindexing would benefit from a refactoring, first. This does not currently affect the use of public-inbox-index, but may in the future. --- lib/PublicInbox/V2Writable.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/V2Writable.pm') diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 1ee19b21..1170f32c 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -777,6 +777,9 @@ sub reindex_oid { $git->cleanup; $mm_tmp->atfork_prepare; $self->done; # release lock + + # TODO: print progress info, here + # allow -watch or -mda to write... $self->idx_init; # reacquire lock $mm_tmp->atfork_parent; @@ -844,6 +847,7 @@ $range sub index_prepare { my ($self, $opts, $epoch_max, $ranges) = @_; + my $pr = $opts->{-progress}; my $regen_max = 0; my $head = $self->{-inbox}->{ref_head} || 'refs/heads/master'; for (my $i = $epoch_max; $i >= 0; $i--) { @@ -858,10 +862,14 @@ sub index_prepare { $ranges->[$i] = $range; # can't use 'rev-list --count' if we use --diff-filter + $pr->("$i.git counting changes\n\t$range ... ") if $pr; + my $n = 0; my $fh = $git->popen(qw(log --pretty=tformat:%H --no-notes --no-color --no-renames --diff-filter=AM), $range, '--', 'm'); - ++$regen_max while <$fh>; + ++$n while <$fh>; + $pr->("$n\n") if $pr; + $regen_max += $n; } \$regen_max; } -- cgit v1.2.3-24-ge0c7