about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-30 01:20:42 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-30 01:21:01 +0000
commit126e7c54da66ff58e20e76879decc91a075eeba1 (patch)
treef8cdbfaaf976c4d723da66423b6944a24faa49e1
parent33244ea82ffd35f40ac82d81a857005587842454 (diff)
downloadpublic-inbox-126e7c54da66ff58e20e76879decc91a075eeba1.tar.gz
By supporting purge and allowing users to delete git partitions,
we can open up ourselves to gaps and un-reindexible data.  Let
that be.
-rw-r--r--lib/PublicInbox/V2Writable.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 6394d300..269b028f 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -552,7 +552,7 @@ sub reindex_oid {
                 $num = $$regen--;
                 die "BUG: ran out of article numbers\n" if $num <= 0;
                 my $mm = $self->{skel}->{mm};
-                foreach my $mid (@$mids) {
+                foreach my $mid (reverse @$mids) {
                         if ($mm->mid_set($num, $mid) == 1) {
                                 $mid0 = $mid;
                                 last;
@@ -560,7 +560,11 @@ sub reindex_oid {
                 }
                 if (!defined($mid0)) {
                         my $id = '<' . join('> <', @$mids) . '>';
-                        warn "Message-Id $id unusable for $num\n";
+                        warn "Message-ID $id unusable for $num\n";
+                        foreach my $mid (@$mids) {
+                                defined(my $n = $mm->num_for($mid)) or next;
+                                warn "#$n previously mapped for <$mid>\n";
+                        }
                 }
         }
 
@@ -661,8 +665,17 @@ sub reindex {
                 }
                 delete $self->{reindex_pipe};
         }
+        my $gaps;
+        if ($regen && $$regen != 0) {
+                warn "W: leftover article number ($$regen)\n";
+                $gaps = 1;
+        }
         my ($min, $max) = $mm_tmp->minmax;
-        defined $max and die "leftover article numbers at $min..$max\n";
+        if (defined $max) {
+                warn "W: leftover article numbers at $min..$max\n";
+                $gaps = 1;
+        }
+        warn "W: were old git partitions deleted?\n" if $gaps;
         my @d = sort keys %$D;
         if (@d) {
                 warn "BUG: ", scalar(@d)," unseen deleted messages marked\n";