Now that we track the num highwater mark it is safe to remove messages
from msgmap that have been previously allocated.  Removing even the
highest numbered article will no longer cause new message numbers to
move backwards.

Signed-off-by: "Eric W. Biederman" <[email protected]>
---
 lib/PublicInbox/V2Writable.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 4dd14331a78f..0396d9f58e55 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -842,7 +842,10 @@ sub unindex_oid {
                        warn "BUG: multiple articles linked to $oid\n",
                                join(',',sort keys %gone), "\n";
                }
-               $self->{unindexed}->{$_}++ foreach keys %gone;
+               foreach my $num (keys %gone) {
+                       $self->{unindexed}->{$_}++;
+                       $self->{mm}->num_delete($num);
+               }
                $self->unindex_oid_remote($oid, $mid);
        }
 }
-- 
2.17.1

--
unsubscribe: [email protected]
archive: https://public-inbox.org/meta/

Reply via email to