about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
authorEric W. Biederman <ebiederm@xmission.com>2018-07-17 17:06:17 -0500
committerEric Wong <e@80x24.org>2018-07-18 10:15:06 +0000
commit6aa50771d12af52baad214923afd49417f6d8909 (patch)
tree7a570ee05f6afb005a85821f3d0e5054a4df8383 /lib/PublicInbox
parent8f5147a8860908a7dc582310681f05c016cfbb30 (diff)
Decrement regen_down when visiting messages that appear in %D that we
know will later be deleted.  This ensures consistent message numbers are
generated no matter which commit number is on top.  Allowing deletes to
propagage separately from the messages they delete without causing

The v2 trees already do this and when the indexes are deleted and
rebuilt they maintain they commit numbers.

Add a v1 version of the v2reindex test to verify that reindexing is
working properly on v1 as well as v2.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'lib/PublicInbox')
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 107cd345..0e0796c1 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -561,7 +561,12 @@ sub read_log {
         while (defined($line = <$log>)) {
                 if ($line =~ /$addmsg/o) {
                         my $blob = $1;
-                        delete $D{$blob} and next;
+                        if (delete $D{$blob}) {
+                                if (defined $self->{regen_down}) {
+                                        $self->{regen_down}--;
+                                }
+                                next;
+                        }
                         my $mime = do_cat_mail($git, $blob, \$bytes) or next;
                         batch_adjust(\$max, $bytes, $batch_cb, $latest);
                         $add_cb->($self, $mime, $bytes, $blob);