From 4ac6be4233fa8e15bc71ee0373f6703265ac05ac Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 22 Dec 2015 10:36:24 +1300 Subject: [PATCH] Refactor to simply chert compaction code slightly --- xapian-core/api/compactor.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/xapian-core/api/compactor.cc b/xapian-core/api/compactor.cc index 597a13f84..6e501edf2 100644 --- a/xapian-core/api/compactor.cc +++ b/xapian-core/api/compactor.cc @@ -389,6 +389,14 @@ Database::compact_(const string & output, unsigned flags, int block_size, #ifdef XAPIAN_HAS_CHERT_BACKEND ChertDatabase::compact(compactor, destdir.c_str(), internals, offset, block_size, compaction, flags, last_docid); + + // Create the version file ("iamchert", etc). + // + // This file contains a UUID, and we want the copy to have a fresh + // UUID since its revision counter is reset to 1. + if (backend == BACKEND_CHERT) { + ChertVersion(destdir).create(); + } #else (void)compactor; throw Xapian::FeatureUnavailableError("Chert backend disabled at build time"); @@ -403,19 +411,6 @@ Database::compact_(const string & output, unsigned flags, int block_size, #endif } - // Create the version file ("iamchert", etc). - // - // This file contains a UUID, and we want the copy to have a fresh - // UUID since its revision counter is reset to 1. - if (backend == BACKEND_CHERT) { -#ifdef XAPIAN_HAS_CHERT_BACKEND - ChertVersion(destdir).create(); -#else - // Handled above. - exit(1); -#endif - } - if (compact_to_stub) { string new_stub_file = destdir; new_stub_file += "/new_stub.tmp"; -- 2.11.4.GIT