From 4b402b213a4bc968ef8bdb17292b1eb4eefd60ce Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Wed, 3 Jun 2020 20:32:39 +0000 Subject: [PATCH] Enable FDB to be built without RocksDB --- fdbserver/CMakeLists.txt | 15 ++++++++++++--- fdbserver/KeyValueStoreRocksDB.actor.cpp | 13 +++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/fdbserver/CMakeLists.txt b/fdbserver/CMakeLists.txt index 54e88bb820..cc090f279e 100644 --- a/fdbserver/CMakeLists.txt +++ b/fdbserver/CMakeLists.txt @@ -215,8 +215,11 @@ add_library(fdb_sqlite STATIC sqlite/sqliteLimit.h sqlite/sqlite3.amalgamation.c) -set(ROCKSDB_USE_STATIC_LIBS ON) -find_package(RocksDB REQUIRED) +if (SSD_ROCKSDB_EXPERIMENTAL) + add_definitions(-DSSD_ROCKSDB_EXPERIMENTAL) + set(ROCKSDB_USE_STATIC_LIBS ON) + find_package(RocksDB REQUIRED) +endif() # Suppress warnings in sqlite since it's third party if(NOT WIN32) @@ -232,7 +235,13 @@ target_include_directories(fdbserver PRIVATE ${CMAKE_BINARY_DIR}/bindings/c ${CMAKE_CURRENT_BINARY_DIR}/workloads ${CMAKE_CURRENT_SOURCE_DIR}/workloads) -target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite RocksDB) + +if (SSD_ROCKSDB_EXPERIMENTAL) + target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite RocksDB) +else() + target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite) +endif() + if (GPERFTOOLS_FOUND) add_compile_definitions(USE_GPERFTOOLS) target_link_libraries(fdbserver PRIVATE gperftools) diff --git a/fdbserver/KeyValueStoreRocksDB.actor.cpp b/fdbserver/KeyValueStoreRocksDB.actor.cpp index eb3f61f0de..0700b7495c 100644 --- a/fdbserver/KeyValueStoreRocksDB.actor.cpp +++ b/fdbserver/KeyValueStoreRocksDB.actor.cpp @@ -1,11 +1,18 @@ +#ifdef SSD_ROCKSDB_EXPERIMENTAL + #include #include #include "flow/flow.h" #include "fdbrpc/AsyncFileCached.actor.h" #include "fdbserver/CoroFlow.h" + +#endif // SSD_ROCKSDB_EXPERIMENTAL + #include "fdbserver/IKeyValueStore.h" #include "flow/actorcompiler.h" // has to be last include +#ifdef SSD_ROCKSDB_EXPERIMENTAL + namespace { class FlowLogger : public rocksdb::Logger, public FastAllocated { @@ -383,6 +390,12 @@ struct RocksDBKeyValueStore : IKeyValueStore { } // namespace +#endif // SSD_ROCKSDB_EXPERIMENTAL + IKeyValueStore* keyValueStoreRocksDB(std::string const& path, UID logID, KeyValueStoreType storeType, bool checkChecksums, bool checkIntegrity) { +#ifdef SSD_ROCKSDB_EXPERIMENTAL return new RocksDBKeyValueStore(path, logID); +#else + return keyValueStoreSQLite(path, logID, storeType, checkChecksums, checkIntegrity); +#endif // SSD_ROCKSDB_EXPERIMENTAL }