From: Eric Wong (Contractor, The Linux Foundation) Date: Mon, 26 Mar 2018 19:09:08 +0000 (+0000) Subject: v2writable: warn on unseen deleted files X-Git-Tag: v1.1.0-pre1~122 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=f1e830d8fea4f22e12012d97f3619d54a3c3c08c v2writable: warn on unseen deleted files It would be a bug to have deleted files marked but not seen in our histories. --- diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index b04e6fbf..01ec98ac 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -495,7 +495,7 @@ sub mark_deleted { my $mids = mids($mime->header_obj); my $cid = content_id($mime); foreach my $mid (@$mids) { - $D->{$mid.$cid} = 1; + $D->{"$mid\0$cid"} = 1; } } @@ -513,7 +513,7 @@ sub reindex_oid { my $num = -1; my $del = 0; foreach my $mid (@$mids) { - $del += (delete $D->{$mid.$cid} || 0); + $del += (delete $D->{"$mid\0$cid"} || 0); my $n = $mm_tmp->num_for($mid); if (defined $n && $n > $num) { $mid0 = $mid; @@ -633,6 +633,14 @@ sub reindex { } my ($min, $max) = $mm_tmp->minmax; defined $max and die "leftover article numbers at $min..$max\n"; + my @d = sort keys %$D; + if (@d) { + warn "BUG: ", scalar(@d)," unseen deleted messages marked\n"; + foreach (@d) { + my ($mid, undef) = split(/\0/, $_, 2); + warn "<$mid>\n"; + } + } } 1;