From 8876c2699b654100cc591a9c0a4e5f8c7a647d6a Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 29 Mar 2018 09:49:32 +1300 Subject: [PATCH] Fix --disable-remote-backend to disable replication The changes to handle this for glass have been backported, but equivalent changes were needed for chert. --- xapian-core/backends/chert/Makefile.mk | 6 +++++- xapian-core/backends/chert/chert_database.cc | 14 ++++++++++++-- xapian-core/backends/databasereplicator.cc | 4 ++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/xapian-core/backends/chert/Makefile.mk b/xapian-core/backends/chert/Makefile.mk index 1a66970ca..9914d75cb 100644 --- a/xapian-core/backends/chert/Makefile.mk +++ b/xapian-core/backends/chert/Makefile.mk @@ -41,7 +41,6 @@ lib_src +=\ backends/chert/chert_compact.cc\ backends/chert/chert_cursor.cc\ backends/chert/chert_database.cc\ - backends/chert/chert_databasereplicator.cc\ backends/chert/chert_dbcheck.cc\ backends/chert/chert_dbstats.cc\ backends/chert/chert_document.cc\ @@ -60,4 +59,9 @@ lib_src +=\ backends/chert/chert_values.cc\ backends/chert/chert_version.cc +if BUILD_BACKEND_REMOTE +lib_src += \ + backends/chert/chert_databasereplicator.cc +endif + endif diff --git a/xapian-core/backends/chert/chert_database.cc b/xapian-core/backends/chert/chert_database.cc index 8f6871611..bc2b2dca9 100644 --- a/xapian-core/backends/chert/chert_database.cc +++ b/xapian-core/backends/chert/chert_database.cc @@ -530,7 +530,7 @@ void ChertDatabase::send_whole_database(RemoteConnection & conn, double end_time) { LOGCALL_VOID(DB, "ChertDatabase::send_whole_database", conn | end_time); - +#ifdef XAPIAN_HAS_REMOTE_BACKEND // Send the current revision number in the header. string buf; string uuid = get_uuid(); @@ -560,6 +560,10 @@ ChertDatabase::send_whole_database(RemoteConnection & conn, double end_time) conn.send_file(REPL_REPLY_DB_FILEDATA, fd, end_time); } } +#else + (void)conn; + (void)end_time; +#endif } void @@ -569,7 +573,7 @@ ChertDatabase::write_changesets_to_fd(int fd, ReplicationInfo * info) { LOGCALL_VOID(DB, "ChertDatabase::write_changesets_to_fd", fd | revision | need_whole_db | info); - +#ifdef XAPIAN_HAS_REMOTE_BACKEND int whole_db_copies_left = MAX_DB_COPIES_PER_CONVERSATION; chert_revision_number_t start_rev_num = 0; string start_uuid = get_uuid(); @@ -685,6 +689,12 @@ ChertDatabase::write_changesets_to_fd(int fd, } } conn.send_message(REPL_REPLY_END_OF_CHANGES, string(), 0.0); +#else + (void)fd; + (void)revision; + (void)need_whole_db; + (void)info; +#endif } void diff --git a/xapian-core/backends/databasereplicator.cc b/xapian-core/backends/databasereplicator.cc index 6c3d6e216..4c6f72ae0 100644 --- a/xapian-core/backends/databasereplicator.cc +++ b/xapian-core/backends/databasereplicator.cc @@ -52,7 +52,11 @@ DatabaseReplicator::open(const string & path) #ifdef XAPIAN_HAS_CHERT_BACKEND if (file_exists(path + "/iamchert")) { +# ifdef XAPIAN_HAS_REMOTE_BACKEND return new ChertDatabaseReplicator(path); +# else + throw FeatureUnavailableError("Replication disabled"); +# endif } #endif -- 2.11.4.GIT