From ac5a695030be64059fcb1ae826a0f3bfd2ca035b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 May 2019 09:36:46 +0000 Subject: xcpdb: new tool which wraps Xapian's copydatabase(1) copydatabase(1) is an existing Xapian tool which is the recommended way to upgrade existing DBs to the latest Xapian database format (currently "glass" for stable/released versions). Our use of Xapian relies on preserving document IDs, so we'll wrap it like we do xapian-compact(1) and use the "--no-renumber" switch. I could not name the tool "public-inbox-copydatabase" since it would be ambiguous as to which DB it's actually copying. So, I abbreviated the suffix to "xcpdb" (Xapian CoPy DataBase), which I hope is acceptable and unambiguous. --- t/indexlevels-mirror.t | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index d124c755..61053b66 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -18,6 +18,7 @@ foreach my $mod (qw(DBD::SQLite)) { my $path = 'blib/script'; my $index = "$path/public-inbox-index"; +my $xcpdb = "$path/public-inbox-xcpdb"; my $mime = PublicInbox::MIME->create( header => [ @@ -108,6 +109,13 @@ sub import_index_incremental { ok($im->remove($mime), '2nd message removed'); $im->done; + if ($level ne 'basic') { + is(system($xcpdb, $mirror), 0, "v$v xcpdb OK"); + delete $ro_mirror->{$_} for (qw(over search)); + ($nr, $msgs) = $ro_mirror->search->query('m:m@2'); + is($nr, 1, "v$v found m\@2 via Xapian on $level"); + } + # sync the mirror is(system('git', "--git-dir=$fetch_dir", qw(fetch -q)), 0, 'fetch OK'); is(system($index, $mirror), 0, "v$v index mirror again OK"); @@ -120,6 +128,10 @@ sub import_index_incremental { is_deeply([glob("$ibx->{mainrepo}/xap*/?/")], [], 'no Xapian partition directories for v2 basic'); } + if ($level ne 'basic') { + ($nr, $msgs) = $ro_mirror->search->reopen->query('m:m@2'); + is($nr, 0, "v$v m\@2 gone from Xapian in mirror on $level"); + } } # we can probably cull some other tests and put full/medium tests, here @@ -131,4 +143,14 @@ for my $level (qw(basic)) { } } +SKIP: { + require PublicInbox::Search; + PublicInbox::Search::load_xapian() or skip 'Search::Xapian missing', 2; + for my $v (1..2) { + subtest("v$v indexlevel=medium" => sub { + import_index_incremental($v, 'medium'); + }) + } +} + done_testing(); -- cgit v1.2.3-24-ge0c7