]> Sergey Matveev's repositories - public-inbox.git/commit
Msgmap.pm: Track the largest value of num ever assigned
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 1 Aug 2018 16:43:39 +0000 (11:43 -0500)
committerEric Wong <e@80x24.org>
Fri, 3 Aug 2018 20:03:49 +0000 (20:03 +0000)
commit5e6d44673ba5e9aaeb6d8e63f27adf542c2760a0
tree33d46fb424fdc89dad277a87d6a4c93ea37a4a9c
parentad2080deb8102a75d2f26b448267c209bea4b4e2
Msgmap.pm: Track the largest value of num ever assigned

Today the only thing that prevents public-inbox not reusing the
message numbers of deleted messages is the sqlite autoincrement magic
and that only works part of the time.  The new incremental indexing
test has revealed areas where today public-inbox does try to reuse
numbers of deleted messages.

Reusing the message numbers of existing messages is a problem because
if a client ever sees messages that are subsequently deleted the
client will not see the new messages with their old numbers.

In practice this is difficult to trigger because it requires the most
recently added message to be removed and have the removal show up in a
separate pull request.  Still it can happen and it should be handled.

Instead of infering the highset number ever used by finding the maximum
number in the message map, track the largest number ever assigned directly.

Update Msgmap to track this value and update the indexers to use this
value.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
lib/PublicInbox/Msgmap.pm
lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/V2Writable.pm