From 750b0b636858f33a42f2513291dfcacfd44a7450 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 22 Sep 2017 20:51:35 +1200 Subject: [PATCH] Remove deprecated compaction API --- xapian-core/api/compactor.cc | 50 --- xapian-core/docs/deprecation.rst | 16 +- xapian-core/include/xapian/compactor.h | 91 +---- xapian-core/tests/.gitignore | 1 - xapian-core/tests/Makefile.am | 1 - xapian-core/tests/api_compactold.cc | 586 --------------------------------- 6 files changed, 9 insertions(+), 736 deletions(-) delete mode 100644 xapian-core/tests/api_compactold.cc diff --git a/xapian-core/api/compactor.cc b/xapian-core/api/compactor.cc index 7923240e6..9c8517f34 100644 --- a/xapian-core/api/compactor.cc +++ b/xapian-core/api/compactor.cc @@ -76,59 +76,9 @@ class CmpByFirstUsed { namespace Xapian { -class Compactor::Internal : public Xapian::Internal::intrusive_base { - friend class Compactor; - - string destdir_compat; - size_t block_size; - unsigned flags; - - vector srcdirs_compat; - - public: - Internal() : block_size(8192), flags(FULL) { } -}; - -Compactor::Compactor() : internal(new Compactor::Internal()) { } - Compactor::~Compactor() { } void -Compactor::set_block_size(size_t block_size) -{ - internal->block_size = block_size; -} - -void -Compactor::set_flags_(unsigned flags, unsigned mask) -{ - internal->flags = (internal->flags & mask) | flags; -} - -void -Compactor::set_destdir(const string & destdir) -{ - internal->destdir_compat = destdir; -} - -void -Compactor::add_source(const string & srcdir) -{ - internal->srcdirs_compat.push_back(srcdir); -} - -void -Compactor::compact() -{ - Xapian::Database src; - for (auto srcdir : internal->srcdirs_compat) { - src.add_database(Xapian::Database(srcdir)); - } - src.compact(internal->destdir_compat, internal->flags, - internal->block_size, *this); -} - -void Compactor::set_status(const string & table, const string & status) { (void)table; diff --git a/xapian-core/docs/deprecation.rst b/xapian-core/docs/deprecation.rst index 5702e31ed..be06e3381 100644 --- a/xapian-core/docs/deprecation.rst +++ b/xapian-core/docs/deprecation.rst @@ -219,14 +219,6 @@ Deprecated Remove Feature name Upgrade suggestion and com out, probably during the 1.4.x release series. There's some further thoughts at https://trac.xapian.org/ticket/3#comment:8 ---------- ------ ----------------------------------- ------------------------------------------------------------------------ -1.3.4 1.5.0 ``Xapian::Compactor`` methods Use the ``Xapian::Database::compact()`` method instead. The - ``set_block_size()``, ``Xapian::Compactor`` class is now just a subclassable functor class to - ``set_renumber()``, allow access to progress messages and control over merging of user - ``set_multipass()``, metadata. - ``set_compaction_level()``, - ``set_destdir()``, ``add_source()` - and ``compact()``. ----------- ------ ----------------------------------- ------------------------------------------------------------------------ 1.3.5 1.5.0 ``Xapian::PostingSource`` public Use the respective getter and setter methods instead, added in 1.3.5 and variables 1.2.23. ---------- ------ ----------------------------------- ------------------------------------------------------------------------ @@ -510,6 +502,14 @@ Removed Feature name Upgrade suggestion and comments ``set_max_wildcard_expansion(n)`` is ``set_max_expansion(n, Xapian::Query::WILDCARD_LIMIT_ERROR, Xapian::QueryParser::FLAG_WILDCARD)`` +------- ----------------------------------- ---------------------------------------------------------------------------------- +1.5.0 ``Xapian::Compactor`` methods Use the ``Xapian::Database::compact()`` method instead. The + ``set_block_size()``, ``Xapian::Compactor`` class is now just a subclassable functor class to + ``set_renumber()``, allow access to progress messages and control over merging of user + ``set_multipass()``, metadata. + ``set_compaction_level()``, + ``set_destdir()``, ``add_source()` + and ``compact()``. ======= =================================== ================================================================================== diff --git a/xapian-core/include/xapian/compactor.h b/xapian-core/include/xapian/compactor.h index 3b774707c..d30318a1f 100644 --- a/xapian-core/include/xapian/compactor.h +++ b/xapian-core/include/xapian/compactor.h @@ -28,8 +28,6 @@ #endif #include -#include -#include #include #include @@ -41,9 +39,6 @@ class Database; */ class XAPIAN_VISIBILITY_DEFAULT Compactor { public: - /// Class containing the implementation. - class Internal; - /** Compaction level. */ typedef enum { /** Don't split items unnecessarily. */ @@ -55,94 +50,10 @@ class XAPIAN_VISIBILITY_DEFAULT Compactor { FULLER = 2 } compaction_level; - private: - /// @internal Reference counted internals. - Xapian::Internal::intrusive_ptr internal; - - void set_flags_(unsigned flags, unsigned mask = 0); - - public: - Compactor(); + Compactor() {} virtual ~Compactor(); - /** Set the block size to use for tables in the output database. - * - * @param block_size The block size to use. Valid block sizes are - * currently powers of two between 2048 and 65536, - * with the default being 8192, but the valid - * sizes and default may change in the future. - */ - XAPIAN_DEPRECATED(void set_block_size(size_t block_size)); - - /** Set whether to preserve existing document id values. - * - * @param renumber The default is true, which means that document ids will - * be renumbered - currently by applying the same offset - * to all the document ids in a particular source - * database. - * - * If false, then the document ids must be unique over all - * source databases. Currently the ranges of document ids - * in each source must not overlap either, though this - * restriction may be removed in the future. - */ - XAPIAN_DEPRECATED(void set_renumber(bool renumber)) { - set_flags_(renumber ? 0 : DBCOMPACT_NO_RENUMBER, - ~unsigned(DBCOMPACT_NO_RENUMBER)); - } - - /** Set whether to merge postlists in multiple passes. - * - * @param multipass If true and merging more than 3 databases, - * merge the postlists in multiple passes, which is generally faster but - * requires more disk space for temporary files. By default we don't do - * this. - */ - XAPIAN_DEPRECATED(void set_multipass(bool multipass)) { - set_flags_(multipass ? DBCOMPACT_MULTIPASS : 0, - ~unsigned(DBCOMPACT_MULTIPASS)); - } - - /** Set the compaction level. - * - * @param compaction Available values are: - * - Xapian::Compactor::STANDARD - Don't split items unnecessarily. - * - Xapian::Compactor::FULL - Split items whenever it saves space - * (the default). - * - Xapian::Compactor::FULLER - Allow oversize items to save more space - * (not recommended if you ever plan to update the compacted database). - */ - XAPIAN_DEPRECATED(void set_compaction_level(compaction_level compaction)) { - set_flags_(compaction, ~unsigned(STANDARD|FULL|FULLER)); - } - - /** Set where to write the output. - * - * @deprecated Use Database::compact(destdir[, compactor]) instead. - * - * @param destdir Output path. This can be the same as an input if that - * input is a stub database (in which case the database(s) - * listed in the stub will be compacted to a new database - * and then the stub will be atomically updated to point - * to this new database). - */ - XAPIAN_DEPRECATED(void set_destdir(const std::string & destdir)); - - /** Add a source database. - * - * @deprecated Use Database::compact(destdir[, compactor]) instead. - * - * @param srcdir The path to the source database to add. - */ - XAPIAN_DEPRECATED(void add_source(const std::string & srcdir)); - - /** Perform the actual compaction/merging operation. - * - * @deprecated Use Database::compact(destdir[, compactor]) instead. - */ - XAPIAN_DEPRECATED(void compact()); - /** Update progress. * * Subclass this method if you want to get progress updates during diff --git a/xapian-core/tests/.gitignore b/xapian-core/tests/.gitignore index ac57c3d39..6e03d8412 100644 --- a/xapian-core/tests/.gitignore +++ b/xapian-core/tests/.gitignore @@ -33,7 +33,6 @@ /api_collated.h /api_collated.stamp /api_compact.h -/api_compactold.h /api_db.h /api_generated.cc /api_generated.h diff --git a/xapian-core/tests/Makefile.am b/xapian-core/tests/Makefile.am index 9019bc077..421f8abf1 100644 --- a/xapian-core/tests/Makefile.am +++ b/xapian-core/tests/Makefile.am @@ -97,7 +97,6 @@ collated_apitest_sources = \ api_cluster.cc \ api_collapse.cc \ api_compact.cc \ - api_compactold.cc \ api_db.cc \ api_generated.cc \ api_geospatial.cc \ diff --git a/xapian-core/tests/api_compactold.cc b/xapian-core/tests/api_compactold.cc deleted file mode 100644 index 71a42f1b0..000000000 --- a/xapian-core/tests/api_compactold.cc +++ /dev/null @@ -1,586 +0,0 @@ -/** @file api_compactold.cc - * @brief Tests of old compaction API - */ -/* Copyright (C) 2009,2010,2011,2012,2013,2015 Olly Betts - * Copyright (C) 2010 Richard Boulton - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include - -#include "api_compactold.h" - -#define XAPIAN_DEPRECATED(X) X -#include - -#include "apitest.h" -#include "dbcheck.h" -#include "filetests.h" -#include "str.h" -#include "testsuite.h" -#include "testutils.h" - -#include -#include - -#include "unixcmds.h" - -using namespace std; - -static void -make_sparse_db(Xapian::WritableDatabase &db, const string & s) -{ - // Need non-const pointer for strtoul(), but data isn't modified. - char * p = const_cast(s.c_str()); - - while (*p) { - bool del = (*p == '!'); - if (del) ++p; - Xapian::docid first = strtoul(p, &p, 10); - Xapian::docid last = first; - if (*p == '-') { - last = strtoul(p + 1, &p, 10); - } - if (*p && *p != ' ') { - tout << p - s.c_str() << endl; - FAIL_TEST("Bad sparse db spec (expected space): " << s); - } - if (first > last) { - FAIL_TEST("Bad sparse db spec (first > last): " << s); - } - - do { - if (del) { - db.delete_document(first); - } else { - Xapian::Document doc; - string id = str(first); - doc.set_data(id); - doc.add_term("Q" + str(first)); - doc.add_term(string(first % 7 + 1, char((first % 26) + 'a'))); - db.replace_document(first, doc); - } - } while (first++ < last); - - if (*p == '\0') break; - ++p; - } - - db.commit(); -} - -static void -check_sparse_uid_terms(const string & path) -{ - Xapian::Database db(path); - Xapian::TermIterator t; - for (t = db.allterms_begin("Q"); t != db.allterms_end("Q"); ++t) { - Xapian::docid did = atoi((*t).c_str() + 1); - Xapian::PostingIterator p = db.postlist_begin(*t); - TEST_EQUAL(*p, did); - } -} - -DEFINE_TESTCASE(compactoldnorenumber1, generated) { - string a = get_database_path("compactnorenumber1a", make_sparse_db, - "5-7 24 76 987 1023-1027 9999 !9999"); - string a_uuid; - { - Xapian::Database db(a); - a_uuid = db.get_uuid(); - } - string b = get_database_path("compactnorenumber1b", make_sparse_db, - "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, - "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, - "3000 999999 !999999"); - - string out = get_named_writable_database_path("compactnorenumber1out"); - - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(a); - compact.compact(); - } - - check_sparse_uid_terms(out); - - { - TEST(!dir_exists(out + "/donor")); - Xapian::Database db(out); - // xapian-compact should change the UUID of the database, but didn't - // prior to 1.0.18/1.1.4. - string out_uuid = db.get_uuid(); - TEST_NOT_EQUAL(a_uuid, out_uuid); - TEST_EQUAL(out_uuid.size(), 36); - TEST_NOT_EQUAL(out_uuid, "00000000-0000-0000-0000-000000000000"); - - // White box test - ensure that the donor database is removed. - TEST(!dir_exists(out + "/donor")); - } - - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(a); - compact.add_source(c); - compact.compact(); - } - check_sparse_uid_terms(out); - { - // Check that xapian-compact is producing a consistent database. Also, - // regression test - xapian 1.1.4 set lastdocid to 0 in the output - // database. - Xapian::Database outdb(out); - dbcheck(outdb, 24, 9999); - } - - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(d); - compact.add_source(a); - compact.add_source(c); - compact.compact(); - } - check_sparse_uid_terms(out); - - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(c); - compact.add_source(a); - compact.add_source(d); - compact.compact(); - } - check_sparse_uid_terms(out); - - // Should fail. - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(a); - compact.add_source(b); - TEST_EXCEPTION(Xapian::InvalidOperationError, compact.compact()); - } - - // Should fail. - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(b); - compact.add_source(a); - TEST_EXCEPTION(Xapian::InvalidOperationError, compact.compact()); - } - - // Should fail. - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(a); - compact.add_source(b); - compact.add_source(d); - TEST_EXCEPTION(Xapian::InvalidOperationError, compact.compact()); - } - - // Should fail. - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(d); - compact.add_source(b); - compact.add_source(a); - TEST_EXCEPTION(Xapian::InvalidOperationError, compact.compact()); - } - - // Should fail. - rm_rf(out); - { - Xapian::Compactor compact; - compact.set_renumber(false); - compact.set_destdir(out); - compact.add_source(b); - compact.add_source(a); - compact.add_source(d); - TEST_EXCEPTION(Xapian::InvalidOperationError, compact.compact()); - } - - return true; -} - -// Test use of compact to merge two databases. -DEFINE_TESTCASE(compactoldmerge1, glass) { - string indbpath = get_database_path("apitest_simpledata"); - string outdbpath = get_named_writable_database_path("compactmerge1out"); - rm_rf(outdbpath); - - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(indbpath); - compact.add_source(indbpath); - compact.compact(); - - Xapian::Database indb(get_database("apitest_simpledata")); - Xapian::Database outdb(outdbpath); - - TEST_EQUAL(indb.get_doccount() * 2, outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -static void -make_multichunk_db(Xapian::WritableDatabase &db, const string &) -{ - int count = 10000; - - Xapian::Document doc; - doc.add_term("a"); - while (count) { - db.add_document(doc); - --count; - } - - db.commit(); -} - -// Test use of compact on a database which has multiple chunks for a term. -// This is a regression test for ticket #427 -DEFINE_TESTCASE(compactoldmultichunks1, generated) { - string indbpath = get_database_path("compactmultichunks1in", - make_multichunk_db, ""); - string outdbpath = get_named_writable_database_path("compactmultichunks1out"); - rm_rf(outdbpath); - - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(indbpath); - compact.compact(); - - Xapian::Database indb(indbpath); - Xapian::Database outdb(outdbpath); - - TEST_EQUAL(indb.get_doccount(), outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -// Test compacting from a stub database directory. -DEFINE_TESTCASE(compactoldstub1, glass) { - const char * stubpath = ".stub/compactstub1"; - const char * stubpathfile = ".stub/compactstub1/XAPIANDB"; - mkdir(".stub", 0755); - mkdir(stubpath, 0755); - ofstream stub(stubpathfile); - TEST(stub.is_open()); - stub << "auto ../../" << get_database_path("apitest_simpledata") << endl; - stub << "auto ../../" << get_database_path("apitest_simpledata2") << endl; - stub.close(); - - string outdbpath = get_named_writable_database_path("compactstub1out"); - rm_rf(outdbpath); - - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(stubpath); - compact.compact(); - - Xapian::Database indb(stubpath); - Xapian::Database outdb(outdbpath); - - TEST_EQUAL(indb.get_doccount(), outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -// Test compacting from a stub database file. -DEFINE_TESTCASE(compactoldstub2, glass) { - const char * stubpath = ".stub/compactstub2"; - mkdir(".stub", 0755); - ofstream stub(stubpath); - TEST(stub.is_open()); - stub << "auto ../" << get_database_path("apitest_simpledata") << endl; - stub << "auto ../" << get_database_path("apitest_simpledata2") << endl; - stub.close(); - - string outdbpath = get_named_writable_database_path("compactstub2out"); - rm_rf(outdbpath); - - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(stubpath); - compact.compact(); - - Xapian::Database indb(stubpath); - Xapian::Database outdb(outdbpath); - - TEST_EQUAL(indb.get_doccount(), outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -// Test compacting a stub database file to itself. -DEFINE_TESTCASE(compactoldstub3, glass) { - const char * stubpath = ".stub/compactstub3"; - mkdir(".stub", 0755); - ofstream stub(stubpath); - TEST(stub.is_open()); - stub << "auto ../" << get_database_path("apitest_simpledata") << endl; - stub << "auto ../" << get_database_path("apitest_simpledata2") << endl; - stub.close(); - - Xapian::doccount in_docs; - { - Xapian::Database indb(stubpath); - in_docs = indb.get_doccount(); - } - - Xapian::Compactor compact; - compact.set_destdir(stubpath); - compact.add_source(stubpath); - compact.compact(); - - Xapian::Database outdb(stubpath); - - TEST_EQUAL(in_docs, outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -// Test compacting a stub database directory to itself. -DEFINE_TESTCASE(compactoldstub4, glass) { - const char * stubpath = ".stub/compactstub4"; - const char * stubpathfile = ".stub/compactstub4/XAPIANDB"; - mkdir(".stub", 0755); - mkdir(stubpath, 0755); - ofstream stub(stubpathfile); - TEST(stub.is_open()); - stub << "auto ../../" << get_database_path("apitest_simpledata") << endl; - stub << "auto ../../" << get_database_path("apitest_simpledata2") << endl; - stub.close(); - - Xapian::doccount in_docs; - { - Xapian::Database indb(stubpath); - in_docs = indb.get_doccount(); - } - - Xapian::Compactor compact; - compact.set_destdir(stubpath); - compact.add_source(stubpath); - compact.compact(); - - Xapian::Database outdb(stubpath); - - TEST_EQUAL(in_docs, outdb.get_doccount()); - dbcheck(outdb, outdb.get_doccount(), outdb.get_doccount()); - - return true; -} - -static void -make_all_tables(Xapian::WritableDatabase &db, const string &) -{ - Xapian::Document doc; - doc.add_term("foo"); - db.add_document(doc); - db.add_spelling("foo"); - db.add_synonym("bar", "pub"); - db.add_synonym("foobar", "foo"); - - db.commit(); -} - -static void -make_missing_tables(Xapian::WritableDatabase &db, const string &) -{ - Xapian::Document doc; - doc.add_term("foo"); - db.add_document(doc); - - db.commit(); -} - -DEFINE_TESTCASE(compactoldmissingtables1, generated) { - string a = get_database_path("compactmissingtables1a", - make_all_tables); - string b = get_database_path("compactmissingtables1b", - make_missing_tables); - - string out = get_named_writable_database_path("compactmissingtables1out"); - rm_rf(out); - - Xapian::Compactor compact; - compact.set_destdir(out); - compact.add_source(a); - compact.add_source(b); - compact.compact(); - - { - Xapian::Database db(out); - TEST_NOT_EQUAL(db.spellings_begin(), db.spellings_end()); - TEST_NOT_EQUAL(db.synonym_keys_begin(), db.synonym_keys_end()); - // FIXME: arrange for input b to not have a termlist table. -// TEST_EXCEPTION(Xapian::FeatureUnavailableError, db.termlist_begin(1)); - } - - return true; -} - -static void -make_all_tables2(Xapian::WritableDatabase &db, const string &) -{ - Xapian::Document doc; - doc.add_term("bar"); - db.add_document(doc); - db.add_spelling("bar"); - db.add_synonym("bar", "baa"); - db.add_synonym("barfoo", "barbar"); - db.add_synonym("foofoo", "barfoo"); - - db.commit(); -} - -/// Adds coverage for merging synonym table. -DEFINE_TESTCASE(compactoldmergesynonym1, generated) { - string a = get_database_path("compactmergesynonym1a", - make_all_tables); - string b = get_database_path("compactmergesynonym1b", - make_all_tables2); - - string out = get_named_writable_database_path("compactmergesynonym1out"); - rm_rf(out); - - Xapian::Compactor compact; - compact.set_destdir(out); - compact.add_source(a); - compact.add_source(b); - compact.compact(); - - { - Xapian::Database db(out); - - Xapian::TermIterator i = db.spellings_begin(); - TEST_NOT_EQUAL(i, db.spellings_end()); - TEST_EQUAL(*i, "bar"); - ++i; - TEST_NOT_EQUAL(i, db.spellings_end()); - TEST_EQUAL(*i, "foo"); - ++i; - TEST_EQUAL(i, db.spellings_end()); - - i = db.synonym_keys_begin(); - TEST_NOT_EQUAL(i, db.synonym_keys_end()); - TEST_EQUAL(*i, "bar"); - ++i; - TEST_NOT_EQUAL(i, db.synonym_keys_end()); - TEST_EQUAL(*i, "barfoo"); - ++i; - TEST_NOT_EQUAL(i, db.synonym_keys_end()); - TEST_EQUAL(*i, "foobar"); - ++i; - TEST_NOT_EQUAL(i, db.synonym_keys_end()); - TEST_EQUAL(*i, "foofoo"); - ++i; - TEST_EQUAL(i, db.synonym_keys_end()); - } - - return true; -} - -DEFINE_TESTCASE(compactoldempty1, glass) { - string empty_dbpath = get_database_path(string()); - string outdbpath = get_named_writable_database_path("compactempty1out"); - rm_rf(outdbpath); - - { - // Compacting an empty database tried to divide by zero in 1.3.0. - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(empty_dbpath); - compact.compact(); - - Xapian::Database outdb(outdbpath); - TEST_EQUAL(outdb.get_doccount(), 0); - dbcheck(outdb, 0, 0); - } - - { - // Check compacting two empty databases together. - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(empty_dbpath); - compact.add_source(empty_dbpath); - compact.compact(); - - Xapian::Database outdb(outdbpath); - TEST_EQUAL(outdb.get_doccount(), 0); - dbcheck(outdb, 0, 0); - } - - return true; -} - -DEFINE_TESTCASE(compactoldmultipass1, glass) { - string outdbpath = get_named_writable_database_path("compactmultipass1"); - rm_rf(outdbpath); - - string a = get_database_path("compactnorenumber1a", make_sparse_db, - "5-7 24 76 987 1023-1027 9999 !9999"); - string b = get_database_path("compactnorenumber1b", make_sparse_db, - "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, - "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, - "3000 999999 !999999"); - - Xapian::Compactor compact; - compact.set_destdir(outdbpath); - compact.add_source(a); - compact.add_source(b); - compact.add_source(c); - compact.add_source(d); - compact.set_multipass(true); - compact.compact(); - - Xapian::Database outdb(outdbpath); - dbcheck(outdb, 29, 1041); - - return true; -} -- 2.11.4.GIT