about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-01-30 07:51:06 +0000
committerEric Wong <e@yhbt.net>2020-01-31 23:00:15 +0000
commiteea47b676127bcdba34fe0c1269b7324dd58d479 (patch)
treed6ea257567da01e10acab963455f44e61334c78a /t
parent31cb75037a757c9388f74283a8b1ecb7c5b65f24 (diff)
downloadpublic-inbox-eea47b676127bcdba34fe0c1269b7324dd58d479.tar.gz
If we're reusing the msgmap from a v1 inbox, we also need to
ensure the highwater mark doesn't get doubled in the v1->v2
conversion by internally triggering the equivalent of
"--reindex" on a fresh v2 inbox.

This was needed to convert an indexed v1 inbox which featured
messages with multiple Message-IDs in it.  Fresh, unindexed
clones of v1 inboxes would not have been affected by this.
Diffstat (limited to 't')
-rw-r--r--t/convert-compact.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/convert-compact.t b/t/convert-compact.t
index 6e4a8268..fc46083b 100644
--- a/t/convert-compact.t
+++ b/t/convert-compact.t
@@ -69,6 +69,13 @@ is(scalar(@xdir), 1, 'got one xapian directory after compact');
 is(((stat($xdir[0]))[2]) & 07777, 0755,
         'sharedRepository respected on v1 compact');
 
+my $hwm = do {
+        my $mm = $ibx->mm;
+        $ibx->cleanup;
+        $mm->num_highwater;
+};
+ok(defined($hwm) && $hwm > 0, "highwater mark set #$hwm");
+
 $cmd = [ '-convert', $ibx->{inboxdir}, "$tmpdir/v2" ];
 ok(run_script($cmd, undef, $rdr), 'convert works');
 @xdir = glob("$tmpdir/v2/xap*/*");
@@ -83,6 +90,7 @@ my $env = { NPROC => 2 };
 ok(run_script($cmd, $env, $rdr), 'v2 compact works');
 $ibx->{inboxdir} = "$tmpdir/v2";
 $ibx->{version} = 2;
+is($ibx->mm->num_highwater, $hwm, 'highwater mark unchanged in v2 inbox');
 
 @xdir = glob("$tmpdir/v2/xap*/*");
 foreach (@xdir) {