From b50c9d74f346533c57173204fb8232a207d48626 Mon Sep 17 00:00:00 2001 From: Wesley Shillingford Date: Tue, 24 Sep 2019 17:06:46 +0100 Subject: [PATCH] Set NANO_ROCKSDB define even when set to OFF (#2313) --- CMakeLists.txt | 5 ++--- nano/node/cli.cpp | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5144ed8f..551b235e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,9 +42,8 @@ if (${NANO_TIMED_LOCKS} GREATER 0) add_definitions (-DNANO_TIMED_LOCKS=${NANO_TIMED_LOCKS}) endif () -if (NANO_ROCKSDB) - add_definitions (-DNANO_ROCKSDB=1) -endif () +add_definitions (-DNANO_ROCKSDB=$) + option(NANO_ASAN_INT "Enable ASan+UBSan+Integer overflow" OFF) option(NANO_ASAN "Enable ASan+UBSan" OFF) option(NANO_TSAN "Enable TSan" OFF) diff --git a/nano/node/cli.cpp b/nano/node/cli.cpp index 7c5d6362..b4951cc8 100644 --- a/nano/node/cli.cpp +++ b/nano/node/cli.cpp @@ -243,16 +243,19 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map { // Note that these throw on failure std::cout << "Finalizing" << std::endl; -#ifdef NANO_ROCKSDB - nano::remove_all_files_in_dir (backup_path); - nano::move_all_files_to_dir (source_path, backup_path); - nano::move_all_files_to_dir (vacuum_path, source_path); - boost::filesystem::remove_all (vacuum_path); -#else - boost::filesystem::remove (backup_path); - boost::filesystem::rename (source_path, backup_path); - boost::filesystem::rename (vacuum_path, source_path); -#endif + if (using_rocksdb) + { + nano::remove_all_files_in_dir (backup_path); + nano::move_all_files_to_dir (source_path, backup_path); + nano::move_all_files_to_dir (vacuum_path, source_path); + boost::filesystem::remove_all (vacuum_path); + } + else + { + boost::filesystem::remove (backup_path); + boost::filesystem::rename (source_path, backup_path); + boost::filesystem::rename (vacuum_path, source_path); + } std::cout << "Vacuum completed" << std::endl; } else