about summary refs log tree commit homepage
path: root/t/v2writable.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 23:29:37 +0000
committerEric Wong <e@80x24.org>2019-06-24 23:45:01 +0000
commit2752bc2b24d1e2c96c18b5f18372fc25e0ffc1fa (patch)
treec02e1d2e1ffc203d7a92ad94c3da9eb20e9d0e89 /t/v2writable.t
parentf4f0a3be0864721d90f9557ffe1c513b0289a74b (diff)
downloadpublic-inbox-2752bc2b24d1e2c96c18b5f18372fc25e0ffc1fa.tar.gz
"INSERT OR IGNORE" still bumps the auto-increment counter in
SQLite, which causes gaps to appear in NNTP article numbering.

This bug appeared in v2 repos where V2Writable may call ->add
repeatedly on the same message.  This bug is apparent with
public-inbox-watch and work-in-progress IMAP watchers which may
rescan and (attempt to) reinsert the same message on mailbox
changes.

Most uses of public-inbox-mda were not affected, unless the
same message is actually delivered multiple times to the mda.
v1 is not affected, either, since deduplication is only based
on Message-ID and msgmap never sees the duplicate.

Reported-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 't/v2writable.t')
-rw-r--r--t/v2writable.t2
1 files changed, 2 insertions, 0 deletions
diff --git a/t/v2writable.t b/t/v2writable.t
index 88df2d64..8f32fbe5 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -118,6 +118,8 @@ if ('ensure git configs are correct') {
         $mime->header_set('References', '<zz-mid@b>');
         ok($im->add($mime), 'message with multiple Message-ID');
         $im->done;
+        my ($total, undef) = $ibx->over->recent;
+        is($ibx->mm->num_highwater, $total, 'got expected highwater value');
         my $srch = $ibx->search;
         my $mset1 = $srch->reopen->query('m:abcde@1', { mset => 1 });
         is($mset1->size, 1, 'message found by first MID');