From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E90341FAEC for ; Tue, 27 Mar 2018 11:11:34 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 08/11] v2writable: warn on unseen deleted files Date: Tue, 27 Mar 2018 11:11:29 +0000 Message-Id: <20180327111132.20681-9-e@80x24.org> In-Reply-To: <20180327111132.20681-1-e@80x24.org> References: <20180327111132.20681-1-e@80x24.org> List-Id: It would be a bug to have deleted files marked but not seen in our histories. --- lib/PublicInbox/V2Writable.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index b04e6fb..01ec98a 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; -- EW