From 57a78bd34aefa8f3f559363f62224099a9dc011b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 18 Jun 2019 08:59:10 +0200 Subject: [PATCH] cmake: Do not build with rocksdb by default --- CHANGELOG.md | 1 + cmake/EthOptions.cmake | 3 ++- libdevcore/CMakeLists.txt | 12 +++++++----- libdevcore/DBFactory.cpp | 9 ++++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b942fc45a4..01c5afd03ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Changed: [#5602](https://github.com/ethereum/aleth/pull/5602) Better predicting external IP address and UDP port. - Changed: [#5605](https://github.com/ethereum/aleth/pull/5605) Network logging bugfixes and improvements and add warpcap log channel. - Changed: [#5628](https://github.com/ethereum/aleth/pull/5628) Don't try to endlessly reconnect to official Ethereum bootnodes. +- Changed: [#5632](https://github.com/ethereum/aleth/pull/5632) RocksDB support is disabled by default. Enable with `-DROCKSB=ON` CMake option. - Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet. - Fixed: [#5581](https://github.com/ethereum/aleth/pull/5581) Fixed finding neighbour nodes in Discovery. - Fixed: [#5599](https://github.com/ethereum/aleth/pull/5600) Prevent aleth from attempting concurrent connection to node which results in disconnect of original connection. diff --git a/cmake/EthOptions.cmake b/cmake/EthOptions.cmake index 311a644e6f4..9306f211445 100644 --- a/cmake/EthOptions.cmake +++ b/cmake/EthOptions.cmake @@ -13,6 +13,7 @@ macro(configure_project) option(PARANOID "Enable additional checks when validating transactions (deprecated)" OFF) option(MINIUPNPC "Build with UPnP support" OFF) option(FASTCTEST "Enable fast ctest" OFF) + option(ROCKSDB "Build with rocksdb as optional database implementation" OFF) if(MINIUPNPC) message(WARNING @@ -71,7 +72,7 @@ macro(print_config) message("--------------------------------------------------------------- features") message("-- EVM_OPTIMIZE Enable VM optimizations ${EVM_OPTIMIZE}") message("-- FATDB Full database exploring ${FATDB}") - message("-- DB Database implementation LEVELDB") + message("-- ROCKSDB RocksDB as optional DB implementation ${ROCKSDB}") message("-- PARANOID - ${PARANOID}") message("-- MINIUPNPC - ${MINIUPNPC}") message("------------------------------------------------------------- components") diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index a15ba4dc05d..60743b2b62e 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -39,8 +39,6 @@ add_library( OverlayDB.h RLP.cpp RLP.h - RocksDB.cpp - RocksDB.h SHA3.cpp SHA3.h StateCacheDB.cpp @@ -68,6 +66,10 @@ hunter_add_package(leveldb) find_package(leveldb CONFIG REQUIRED) target_link_libraries(devcore PRIVATE leveldb::leveldb) -hunter_add_package(rocksdb) -find_package(RocksDB CONFIG REQUIRED) -target_link_libraries(devcore PRIVATE RocksDB::rocksdb) +if(ROCKSDB) + hunter_add_package(rocksdb) + find_package(RocksDB CONFIG REQUIRED) + target_sources(devcore PRIVATE RocksDB.cpp RocksDB.h) + target_link_libraries(devcore PRIVATE RocksDB::rocksdb) + target_compile_definitions(devcore PRIVATE ALETH_ROCKSDB) +endif() \ No newline at end of file diff --git a/libdevcore/DBFactory.cpp b/libdevcore/DBFactory.cpp index 239465c20e1..2426bde5ed4 100644 --- a/libdevcore/DBFactory.cpp +++ b/libdevcore/DBFactory.cpp @@ -18,10 +18,13 @@ #include "DBFactory.h" #include "FileSystem.h" #include "LevelDB.h" -#include "RocksDB.h" #include "MemoryDB.h" #include "libethcore/Exceptions.h" +#if ALETH_ROCKSDB +#include "RocksDB.h" +#endif + namespace dev { namespace db @@ -48,7 +51,9 @@ struct DBKindTableEntry /// so linear search only to parse command line arguments is not a problem. DBKindTableEntry dbKindsTable[] = { {DatabaseKind::LevelDB, "leveldb"}, +#if ALETH_ROCKSDB {DatabaseKind::RocksDB, "rocksdb"}, +#endif {DatabaseKind::MemoryDB, "memorydb"}, }; @@ -154,9 +159,11 @@ std::unique_ptr DBFactory::create(DatabaseKind _kind, fs::path con case DatabaseKind::LevelDB: return std::unique_ptr(new LevelDB(_path)); break; +#if ALETH_ROCKSDB case DatabaseKind::RocksDB: return std::unique_ptr(new RocksDB(_path)); break; +#endif case DatabaseKind::MemoryDB: // Silently ignore path since the concept of a db path doesn't make sense // when using an in-memory database