Enable FDB to be built without RocksDB

This commit is contained in:
Daniel Smith 2020-06-03 20:32:39 +00:00
parent dfd44da02c
commit 4b402b213a
2 changed files with 25 additions and 3 deletions

View File

@ -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)

View File

@ -1,11 +1,18 @@
#ifdef SSD_ROCKSDB_EXPERIMENTAL
#include <rocksdb/env.h>
#include <rocksdb/db.h>
#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<FlowLogger> {
@ -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
}