This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 50171fc752911c8b83972bd57d7873f5cbcc3b7c Author: Yingchun Lai <laiyingc...@apache.org> AuthorDate: Sun Jun 30 23:24:04 2024 +0800 KUDU-3371 Add NO_ROCKSDB build option This patch adds a build option 'NO_ROCKSDB'. Now it's possible to disable building 'logr' block manager and linking librocksdb if setting -DNO_ROCKSDB=1 explicitly. By default, NO_ROCKSDB is not set. Change-Id: Ie9cfb5e928d6fb995ac667533a3651cad91010c7 Reviewed-on: http://gerrit.cloudera.org:8080/21560 Tested-by: Alexey Serbin <ale...@apache.org> Reviewed-by: Alexey Serbin <ale...@apache.org> --- CMakeLists.txt | 27 +++++++++++++++------ src/kudu/benchmarks/CMakeLists.txt | 20 ++++++++++++---- src/kudu/client/CMakeLists.txt | 7 ++++-- src/kudu/consensus/CMakeLists.txt | 5 +++- src/kudu/fs/CMakeLists.txt | 14 ++++++++--- src/kudu/fs/block_manager-stress-test.cc | 4 ++++ src/kudu/fs/block_manager-test.cc | 14 ++++++++++- src/kudu/fs/block_manager.h | 7 +++++- src/kudu/fs/data_dirs.cc | 2 ++ src/kudu/fs/dir_manager.cc | 31 ++++++++++++++----------- src/kudu/fs/dir_manager.h | 20 ++++++++++++---- src/kudu/fs/fs_manager-test.cc | 26 +++++++++++++-------- src/kudu/fs/fs_manager.cc | 28 ++++++++++++++-------- src/kudu/fs/fs_report.cc | 6 +++++ src/kudu/fs/fs_report.h | 4 ++++ src/kudu/fs/log_block_manager-test-util.cc | 10 ++++++++ src/kudu/fs/log_block_manager-test.cc | 21 ++++++++++++++++- src/kudu/fs/log_block_manager.cc | 16 +++++++++++++ src/kudu/fs/log_block_manager.h | 8 +++++++ src/kudu/integration-tests/CMakeLists.txt | 6 ++++- src/kudu/integration-tests/ts_recovery-itest.cc | 3 ++- src/kudu/server/CMakeLists.txt | 10 +++++--- src/kudu/tablet/compaction-test.cc | 2 +- src/kudu/tools/CMakeLists.txt | 5 +++- src/kudu/tools/kudu-tool-test.cc | 4 ++++ src/kudu/util/CMakeLists.txt | 16 +++++++++---- 26 files changed, 245 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8a68bb95..0f6201447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1279,12 +1279,19 @@ ADD_THIRDPARTY_LIB(boost_date_time SHARED_LIB "${BOOST_DATE_TIME_SHARED_LIB}") ## rocksdb -find_package(Rocksdb REQUIRED) -include_directories(SYSTEM ${ROCKSDB_INCLUDE_DIR}) -ADD_THIRDPARTY_LIB(rocksdb - STATIC_LIB "${ROCKSDB_STATIC_LIB}" - SHARED_LIB "${ROCKSDB_SHARED_LIB}" - DEPS snappy) +# The 'logr' block manager will be built if not disabled explicitly. +if("${NO_ROCKSDB}" STREQUAL "" OR NOT NO_ROCKSDB) + set(NO_ROCKSDB 0) + find_package(Rocksdb REQUIRED) + include_directories(SYSTEM ${ROCKSDB_INCLUDE_DIR}) + ADD_THIRDPARTY_LIB(rocksdb + STATIC_LIB "${ROCKSDB_STATIC_LIB}" + SHARED_LIB "${ROCKSDB_SHARED_LIB}" + DEPS snappy) +else() + add_definitions(-DNO_ROCKSDB) + set(NO_ROCKSDB 1) +endif() ############################################################ # Enable sized deallocation where supported. @@ -1338,7 +1345,7 @@ if ("${KUDU_USE_ASAN}" OR "${KUDU_USE_TSAN}" OR "${KUDU_USE_UBSAN}") endif() set(KUDU_TEST_LINK_LIBS ${KUDU_MIN_TEST_LIBS}) -# This macro initializes KUDU_MIN_TEST_LIBS to KUDU_MIN_TEST_LIBS and +# This macro initializes KUDU_TEST_LINK_LIBS to KUDU_MIN_TEST_LIBS and # appends the passed list of libraries to the end. This ensures that # KUDU_MIN_TEST_LIBS is linked first. macro(SET_KUDU_TEST_LINK_LIBS) @@ -1346,6 +1353,12 @@ macro(SET_KUDU_TEST_LINK_LIBS) list(APPEND KUDU_TEST_LINK_LIBS ${ARGN}) endmacro() +# This macro appends the passed list of libraries to the end of +# KUDU_TEST_LINK_LIBS. +macro(ADD_KUDU_TEST_LINK_LIBS) + list(APPEND KUDU_TEST_LINK_LIBS ${ARGN}) +endmacro() + # Use "thin archives" for our static libraries. We only use static libraries # internal to our own build, so thin ones are just as good and much smaller. if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") diff --git a/src/kudu/benchmarks/CMakeLists.txt b/src/kudu/benchmarks/CMakeLists.txt index 73b54462c..f33a21dd3 100644 --- a/src/kudu/benchmarks/CMakeLists.txt +++ b/src/kudu/benchmarks/CMakeLists.txt @@ -33,15 +33,21 @@ target_link_libraries(tpch add_executable(tpch1 tpch/tpch1.cc) target_link_libraries(tpch1 ${KUDU_MIN_TEST_LIBS} - tpch - rocksdb) + tpch) +if(NOT NO_ROCKSDB) + target_link_libraries(tpch1 + rocksdb) +endif() # tpch_real_world add_executable(tpch_real_world tpch/tpch_real_world.cc) target_link_libraries(tpch_real_world ${KUDU_MIN_TEST_LIBS} - tpch - rocksdb) + tpch) +if(NOT NO_ROCKSDB) + target_link_libraries(tpch_real_world + rocksdb) +endif() # rle add_executable(rle rle.cc) @@ -61,5 +67,9 @@ endif() # Unit tests ####################################### -SET_KUDU_TEST_LINK_LIBS(tpch rocksdb) +SET_KUDU_TEST_LINK_LIBS(tpch) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb) +endif() ADD_KUDU_TEST(tpch/rpc_line_item_dao-test) diff --git a/src/kudu/client/CMakeLists.txt b/src/kudu/client/CMakeLists.txt index bb5479e13..9b0d12f77 100644 --- a/src/kudu/client/CMakeLists.txt +++ b/src/kudu/client/CMakeLists.txt @@ -280,8 +280,11 @@ endif() SET_KUDU_TEST_LINK_LIBS( itest_util kudu_client - mini_cluster - rocksdb) + mini_cluster) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb) +endif() ADD_KUDU_TEST(client-test NUM_SHARDS 8 PROCESSORS 2 DATA_FILES ../scripts/first_argument.sh) ADD_KUDU_TEST(client-unittest) diff --git a/src/kudu/consensus/CMakeLists.txt b/src/kudu/consensus/CMakeLists.txt index 3fc36c388..5d20b66cc 100644 --- a/src/kudu/consensus/CMakeLists.txt +++ b/src/kudu/consensus/CMakeLists.txt @@ -126,9 +126,12 @@ SET_KUDU_TEST_LINK_LIBS( consensus tserver_proto cfile - rocksdb tablet kudu_util) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb) +endif() ADD_KUDU_TEST(consensus_meta-test) ADD_KUDU_TEST(consensus_meta_manager-stress-test RUN_SERIAL true) diff --git a/src/kudu/fs/CMakeLists.txt b/src/kudu/fs/CMakeLists.txt index 460223f25..2f4a41fe5 100644 --- a/src/kudu/fs/CMakeLists.txt +++ b/src/kudu/fs/CMakeLists.txt @@ -43,8 +43,11 @@ target_link_libraries(kudu_fs fs_proto kudu_util gutil - ranger_kms_client - rocksdb) + ranger_kms_client) +if(NOT NO_ROCKSDB) + target_link_libraries(kudu_fs + rocksdb) +endif() if(NOT NO_TESTS) add_library(kudu_fs_test_util @@ -61,7 +64,12 @@ endif() # Unit tests ####################################### -SET_KUDU_TEST_LINK_LIBS(kudu_fs kudu_fs_test_util rocksdb snappy) +SET_KUDU_TEST_LINK_LIBS(kudu_fs kudu_fs_test_util) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb + snappy) +endif() ADD_KUDU_TEST(block_manager-test) ADD_KUDU_TEST(block_manager-stress-test RUN_SERIAL true) ADD_KUDU_TEST(data_dirs-test) diff --git a/src/kudu/fs/block_manager-stress-test.cc b/src/kudu/fs/block_manager-stress-test.cc index 6a8b66e14..a31d0e7a3 100644 --- a/src/kudu/fs/block_manager-stress-test.cc +++ b/src/kudu/fs/block_manager-stress-test.cc @@ -510,8 +510,12 @@ void BlockManagerStressTest<T>::InjectNonFatalInconsistencies() { // What kinds of BlockManagers are supported? #if defined(__linux__) +#if defined(NO_ROCKSDB) +typedef ::testing::Types<FileBlockManager, LogBlockManagerNativeMeta> BlockManagers; +#else typedef ::testing::Types<FileBlockManager, LogBlockManagerNativeMeta, LogBlockManagerRdbMeta> BlockManagers; +#endif #else typedef ::testing::Types<FileBlockManager> BlockManagers; #endif diff --git a/src/kudu/fs/block_manager-test.cc b/src/kudu/fs/block_manager-test.cc index 3cb093a0b..c4968ff64 100644 --- a/src/kudu/fs/block_manager-test.cc +++ b/src/kudu/fs/block_manager-test.cc @@ -100,7 +100,7 @@ METRIC_DECLARE_gauge_uint64(data_dirs_full); // The LogBlockManager is only supported on Linux, since it requires hole punching. #define RETURN_NOT_LOG_BLOCK_MANAGER() \ do { \ - if (FLAGS_block_manager != "log" && FLAGS_block_manager != "logr") { \ + if (!FsManager::IsLogType(FLAGS_block_manager)) { \ GTEST_SKIP() << "This platform does not use the log block manager by default. " \ "Skipping test."; \ } \ @@ -225,11 +225,13 @@ class BlockManagerTest : public KuduTest { if (basename == kInstanceMetadataFileName) { return Status::OK(); } +#if !defined(NO_ROCKSDB) // Ignore the 'kRocksDBDirName' directory which contains the RocksDB related files. string parent_dir = *SplitPath(dirname).rbegin(); if (parent_dir == kRocksDBDirName) { return Status::OK(); } +#endif if (type == Env::FILE_TYPE) { *num_files += 1; } @@ -419,12 +421,14 @@ void BlockManagerTest<T>::RunMultipathTest(const vector<string>& paths) { // '..', and instance files. ASSERT_EQ(paths.size() * 4, sum); } else { +#if !defined(NO_ROCKSDB) // (numPaths * 2) containers were created, each consisting of 1 file. // Thus, there should be a total of (numPaths * 2) files, ignoring '.', // '..', 'kRocksDBDirName', and instance files. bool is_logr = std::is_same<T, LogBlockManagerRdbMeta>::value; ASSERT_TRUE(is_logr); ASSERT_EQ(paths.size() * 2, sum); +#endif } } @@ -466,8 +470,12 @@ void BlockManagerTest<T>::RunMemTrackerTest() { // What kinds of BlockManagers are supported? #if defined(__linux__) +#if defined(NO_ROCKSDB) +typedef ::testing::Types<FileBlockManager, LogBlockManagerNativeMeta> BlockManagers; +#else typedef ::testing::Types<FileBlockManager, LogBlockManagerNativeMeta, LogBlockManagerRdbMeta> BlockManagers; +#endif #else typedef ::testing::Types<FileBlockManager> BlockManagers; #endif @@ -1325,10 +1333,14 @@ TYPED_TEST(BlockManagerTest, TestBlockTransaction) { // into util/env_posix.cc does not affect RocksDB, updating the metadata stored in the // logr-based block manager succeeds without any errors. if (FLAGS_block_manager == "logr") { +#if defined(NO_ROCKSDB) + ASSERT_TRUE(false); +#else ASSERT_OK(s); ASSERT_EQ(created_blocks.size(), deleted_blocks.size()); ASSERT_EQ(total_blocks_deleted + deleted_blocks.size(), down_cast<Counter*>( entity->FindOrNull(METRIC_block_manager_total_blocks_deleted).get())->value()); +#endif } else { ASSERT_TRUE(s.IsIOError()); ASSERT_TRUE(deleted_blocks.empty()); diff --git a/src/kudu/fs/block_manager.h b/src/kudu/fs/block_manager.h index 380e5b6c4..79cb9268e 100644 --- a/src/kudu/fs/block_manager.h +++ b/src/kudu/fs/block_manager.h @@ -20,6 +20,7 @@ #include <cstddef> #include <cstdint> #include <memory> +#include <set> #include <string> #include <vector> @@ -198,9 +199,13 @@ struct BlockManagerOptions { class BlockManager : public RefCountedThreadSafe<BlockManager> { public: // Lists the available block manager types. - static std::vector<std::string> block_manager_types() { + static std::set<std::string> block_manager_types() { #if defined(__linux__) +#if defined(NO_ROCKSDB) + return { "file", "log" }; +#else return { "file", "log", "logr" }; +#endif #else return { "file" }; #endif diff --git a/src/kudu/fs/data_dirs.cc b/src/kudu/fs/data_dirs.cc index f92d6a7c8..bf967914f 100644 --- a/src/kudu/fs/data_dirs.cc +++ b/src/kudu/fs/data_dirs.cc @@ -204,11 +204,13 @@ std::unique_ptr<Dir> DataDirManager::CreateNewDir( Env* env, DirMetrics* metrics, FsType fs_type, std::string dir, std::unique_ptr<DirInstanceMetadataFile> metadata_file, std::unique_ptr<ThreadPool> pool) { +#if !defined(NO_ROCKSDB) if (FLAGS_block_manager == "logr") { bool newly_created = ContainsKey(created_fs_dir_paths_, dir); return std::make_unique<RdbDir>(env, metrics, fs_type, newly_created, std::move(dir), std::move(metadata_file), std::move(pool)); } +#endif return std::make_unique<Dir>(env, metrics, fs_type, std::move(dir), std::move(metadata_file), std::move(pool)); } diff --git a/src/kudu/fs/dir_manager.cc b/src/kudu/fs/dir_manager.cc index 81d120e9c..520d1d302 100644 --- a/src/kudu/fs/dir_manager.cc +++ b/src/kudu/fs/dir_manager.cc @@ -32,12 +32,14 @@ #include <gflags/gflags_declare.h> #include <glog/logging.h> +#if !defined(NO_ROCKSDB) #include <rocksdb/cache.h> #include <rocksdb/filter_policy.h> #include <rocksdb/options.h> #include <rocksdb/slice_transform.h> #include <rocksdb/status.h> #include <rocksdb/table.h> +#endif #include "kudu/fs/dir_util.h" #include "kudu/fs/fs.pb.h" @@ -54,7 +56,9 @@ #include "kudu/util/random_util.h" #include "kudu/util/scoped_cleanup.h" #include "kudu/util/stopwatch.h" +#if !defined(NO_ROCKSDB) #include "kudu/util/test_util_prod.h" +#endif #include "kudu/util/threadpool.h" using std::set; @@ -72,7 +76,18 @@ DECLARE_int64(fs_data_dirs_reserved_bytes); DECLARE_string(block_manager); namespace kudu { +namespace { +// Wrapper for env_util::DeleteTmpFilesRecursively that is suitable for parallel +// execution on a data directory's thread pool (which requires the return value +// be void). +void DeleteTmpFilesRecursively(Env* env, const string& path) { + WARN_NOT_OK(env_util::DeleteTmpFilesRecursively(env, path), + "Error while deleting temp files"); +} +} // anonymous namespace +namespace fs { +#if !defined(NO_ROCKSDB) Status FromRdbStatus(const rocksdb::Status& s) { switch (s.code()) { case rocksdb::Status::kOk: @@ -95,19 +110,7 @@ Status FromRdbStatus(const rocksdb::Status& s) { return Status::RuntimeError(s.ToString()); } } - -namespace { - -// Wrapper for env_util::DeleteTmpFilesRecursively that is suitable for parallel -// execution on a data directory's thread pool (which requires the return value -// be void). -void DeleteTmpFilesRecursively(Env* env, const string& path) { - WARN_NOT_OK(env_util::DeleteTmpFilesRecursively(env, path), - "Error while deleting temp files"); -} - -} // anonymous namespace -namespace fs { +#endif Dir::Dir(Env* env, DirMetrics* metrics, @@ -205,6 +208,7 @@ int Dir::reserved_bytes() { return FLAGS_fs_data_dirs_reserved_bytes; } +#if !defined(NO_ROCKSDB) shared_ptr<rocksdb::Cache> RdbDir::s_block_cache_; RdbDir::RdbDir(Env* env, DirMetrics* metrics, FsType fs_type, @@ -323,6 +327,7 @@ rocksdb::DB* RdbDir::rdb() { DCHECK(db_); return db_.get(); } +#endif DirManagerOptions::DirManagerOptions(string dir_type, string tid) diff --git a/src/kudu/fs/dir_manager.h b/src/kudu/fs/dir_manager.h index 470f62607..3be84d947 100644 --- a/src/kudu/fs/dir_manager.h +++ b/src/kudu/fs/dir_manager.h @@ -22,7 +22,9 @@ #include <functional> #include <memory> #include <mutex> +#if !defined(NO_ROCKSDB) #include <optional> +#endif #include <set> #include <shared_mutex> #include <string> @@ -30,8 +32,10 @@ #include <unordered_map> #include <vector> +#if !defined(NO_ROCKSDB) #include <gtest/gtest_prod.h> #include <rocksdb/db.h> +#endif #include "kudu/gutil/macros.h" #include "kudu/gutil/ref_counted.h" @@ -41,18 +45,15 @@ #include "kudu/util/random.h" #include "kudu/util/status.h" +#if !defined(NO_ROCKSDB) namespace rocksdb { class Cache; class Status; } // namespace rocksdb +#endif namespace kudu { -// Convert a rocksdb::Status to a kudu::Status. -// NOTE: Keep it here rather than util/status.h because the latter is -// an exported header, but FromRdbStatus() is used only internally. -Status FromRdbStatus(const rocksdb::Status& s); - class Env; class ThreadPool; @@ -197,6 +198,12 @@ class Dir { DISALLOW_COPY_AND_ASSIGN(Dir); }; +#if !defined(NO_ROCKSDB) +// Convert a rocksdb::Status to a kudu::Status. +// NOTE: Keep it here rather than util/status.h because the latter is +// an exported header, but FromRdbStatus() is used only internally. +Status FromRdbStatus(const rocksdb::Status& s); + // Representation of a directory for LogBlockManagerRdbMeta specially. class RdbDir: public Dir { public: @@ -230,6 +237,7 @@ class RdbDir: public Dir { DISALLOW_COPY_AND_ASSIGN(RdbDir); }; +#endif struct DirManagerOptions { public: @@ -355,7 +363,9 @@ class DirManager { std::unique_ptr<ThreadPool> pool) = 0; protected: +#if !defined(NO_ROCKSDB) FRIEND_TEST(LogBlockManagerRdbMetaTest, TestHalfPresentContainer); +#endif // The name to be used by this directory manager for each sub-directory of // each directory root. diff --git a/src/kudu/fs/fs_manager-test.cc b/src/kudu/fs/fs_manager-test.cc index a39d0ad06..b030d1e03 100644 --- a/src/kudu/fs/fs_manager-test.cc +++ b/src/kudu/fs/fs_manager-test.cc @@ -39,8 +39,10 @@ #include <glog/logging.h> #include <glog/stl_logging.h> #include <gtest/gtest.h> +#if !defined(NO_ROCKSDB) #include <rocksdb/db.h> #include <rocksdb/options.h> +#endif #include "kudu/fs/block_manager.h" #include "kudu/fs/data_dirs.h" @@ -222,21 +224,23 @@ class FsManagerTestBase : public KuduTest, INSTANTIATE_TEST_SUITE_P(BlockManagerTypes, FsManagerTestBase, // TODO(yingchun): When --enable_multi_tenancy is set, the data directories are still shared by // all tenants, which will cause some errors when --block_manager=logr. This will be fixed in the -// future as the TODO mentioned in [1]. We can enable all the following test cases when the TODO +// future after the TODO "The new tenant should have its own dd manager instead of sharing" in +// src/kudu/fs/fs_manager.cc is done. We can enable all the following test cases when the TODO // is addressed. -// 1.https://github.com/acelyc111/kudu/blob/master/src/kudu/fs/fs_manager.cc#L1190 // // ::testing::ValuesIn(BlockManager::block_manager_types()), // ::testing::ValuesIn(kEncryptionType)) ::testing::Values( - make_tuple("file", kEncryptionType[0]), - make_tuple("file", kEncryptionType[1]), - make_tuple("file", kEncryptionType[2]), - make_tuple("log", kEncryptionType[0]), - make_tuple("log", kEncryptionType[1]), - make_tuple("log", kEncryptionType[2]), - make_tuple("logr", kEncryptionType[0]), - make_tuple("logr", kEncryptionType[1]))); + make_tuple("file", kEncryptionType[0]), + make_tuple("file", kEncryptionType[1]), + make_tuple("file", kEncryptionType[2]), +#if !defined(NO_ROCKSDB) + make_tuple("logr", kEncryptionType[0]), + make_tuple("logr", kEncryptionType[1]), +#endif + make_tuple("log", kEncryptionType[0]), + make_tuple("log", kEncryptionType[1]), + make_tuple("log", kEncryptionType[2]))); TEST_P(FsManagerTestBase, TestBaseOperations) { fs_manager()->DumpFileSystemTree(std::cout, tenant_id()); @@ -1406,6 +1410,7 @@ TEST_P(FsManagerTestBase, TestFailToStartWithoutEncryptionKeys) { ASSERT_TRUE(fs_manager()->Open().IsIllegalState()); } +#if !defined(NO_ROCKSDB) TEST_P(FsManagerTestBase, TestOpenDirectoryWithRdbMissing) { if (FLAGS_block_manager != "logr") { GTEST_SKIP() << "Skipping 'logr'-specific test"; @@ -1540,6 +1545,7 @@ TEST_P(FsManagerTestBase, TestInitialOpenDirectoryWithRdbPresent) { ASSERT_TRUE(s.IsAlreadyPresent()) << s.ToString(); ASSERT_STR_CONTAINS(s.ToString(), "FSManager roots already exist"); } +#endif class OpenFsTypeTest : public KuduTest, public ::testing::WithParamInterface<std::tuple<string, bool, bool>> { diff --git a/src/kudu/fs/fs_manager.cc b/src/kudu/fs/fs_manager.cc index b6cb50fa4..84675c3c8 100644 --- a/src/kudu/fs/fs_manager.cc +++ b/src/kudu/fs/fs_manager.cc @@ -23,6 +23,7 @@ #include <initializer_list> #include <iostream> #include <mutex> +#include <set> #include <shared_mutex> #include <type_traits> #include <unordered_map> @@ -39,9 +40,9 @@ #include "kudu/fs/file_block_manager.h" #include "kudu/fs/fs.pb.h" #include "kudu/fs/fs_report.h" +#include "kudu/fs/key_provider.h" #include "kudu/fs/log_block_manager.h" #include "kudu/fs/ranger_kms_key_provider.h" -#include "kudu/fs/key_provider.h" #include "kudu/gutil/map-util.h" #include "kudu/gutil/port.h" #include "kudu/gutil/stringprintf.h" @@ -81,19 +82,21 @@ DEFINE_bool(enable_data_block_fsync, true, TAG_FLAG(enable_data_block_fsync, unsafe); #if defined(__linux__) -DEFINE_string(block_manager, "log", "Which block manager to use for storage. " - "Valid options are 'file', 'log' and 'logr'. The file block " - "manager is not suitable for production use due to scaling " - "limitations."); +DEFINE_string(block_manager, "log", "Which block manager to use for storage. Valid options are " + "'file'" +#if defined(NO_ROCKSDB) + "and 'log'" +#else + ", 'log' and 'logr'" +#endif + ". The 'file' block manager is not suitable for production use " + "due to scaling limitations."); #else DEFINE_string(block_manager, "file", "Which block manager to use for storage. " "Only the file block manager is supported for non-Linux systems."); #endif static bool ValidateBlockManagerType(const char* /*flagname*/, const std::string& value) { - for (const std::string& type : kudu::fs::BlockManager::block_manager_types()) { - if (type == value) return true; - } - return false; + return ContainsKey(kudu::fs::BlockManager::block_manager_types(), value); } DEFINE_validator(block_manager, &ValidateBlockManagerType); TAG_FLAG(block_manager, advanced); @@ -179,7 +182,9 @@ using kudu::fs::FsErrorManager; using kudu::fs::FileBlockManager; using kudu::fs::FsReport; using kudu::fs::LogBlockManagerNativeMeta; +#if !defined(NO_ROCKSDB) using kudu::fs::LogBlockManagerRdbMeta; +#endif using kudu::fs::ReadableBlock; using kudu::fs::UpdateInstanceBehavior; using kudu::fs::WritableBlock; @@ -412,10 +417,12 @@ scoped_refptr<BlockManager> FsManager::InitBlockManager(const string& tenant_id) block_manager.reset(new LogBlockManagerNativeMeta( GetEnv(tenant_id), dd_manager(tenant_id), error_manager_, opts_.file_cache, std::move(bm_opts), tenant_id)); +#if !defined(NO_ROCKSDB) } else if (opts_.block_manager_type == "logr") { block_manager.reset(new LogBlockManagerRdbMeta( GetEnv(tenant_id), dd_manager(tenant_id), error_manager_, opts_.file_cache, std::move(bm_opts), tenant_id)); +#endif } else { LOG(FATAL) << "Unknown block_manager_type: " << opts_.block_manager_type; } @@ -799,7 +806,8 @@ void FsManager::UpdateMetadataFormatAndStampUnlock(InstanceMetadataPB* metadata) } bool FsManager::IsLogType(const std::string& block_manager_type) { - return (block_manager_type == "log" || block_manager_type == "logr"); + return block_manager_type != "file" + && ContainsKey(BlockManager::block_manager_types(), block_manager_type); } Status FsManager::AddTenantMetadata(const string& tenant_name, diff --git a/src/kudu/fs/fs_report.cc b/src/kudu/fs/fs_report.cc index b4f7986f0..3d5417c16 100644 --- a/src/kudu/fs/fs_report.cc +++ b/src/kudu/fs/fs_report.cc @@ -252,6 +252,7 @@ LBMPartialRecordCheck::Entry::Entry(string c, int64_t o) repaired(false) { } +#if !defined(NO_ROCKSDB) /////////////////////////////////////////////////////////////////////////////// // LBMCorruptedRdbRecordCheck /////////////////////////////////////////////////////////////////////////////// @@ -280,6 +281,7 @@ LBMCorruptedRdbRecordCheck::Entry::Entry(string c, string k) rocksdb_key(std::move(k)), repaired(false) { } +#endif /////////////////////////////////////////////////////////////////////////////// // FsReport::Stats @@ -330,7 +332,9 @@ void FsReport::MergeFrom(const FsReport& other) { MERGE_ONE_CHECK(malformed_record_check); MERGE_ONE_CHECK(misaligned_block_check); MERGE_ONE_CHECK(partial_record_check); +#if !defined(NO_ROCKSDB) MERGE_ONE_CHECK(corrupted_rdb_record_check); +#endif #undef MERGE_ONE_CHECK } @@ -359,7 +363,9 @@ string FsReport::ToString() const { TOSTRING_ONE_CHECK(malformed_record_check, "malformed LBM records"); TOSTRING_ONE_CHECK(misaligned_block_check, "misaligned LBM blocks"); TOSTRING_ONE_CHECK(partial_record_check, "partial LBM records"); +#if !defined(NO_ROCKSDB) TOSTRING_ONE_CHECK(corrupted_rdb_record_check, "corrupted LBM rdb records"); +#endif #undef TOSTRING_ONE_CHECK return s; diff --git a/src/kudu/fs/fs_report.h b/src/kudu/fs/fs_report.h index fc983d847..2cd5563ab 100644 --- a/src/kudu/fs/fs_report.h +++ b/src/kudu/fs/fs_report.h @@ -173,6 +173,7 @@ struct LBMPartialRecordCheck { std::vector<Entry> entries; }; +#if !defined(NO_ROCKSDB) // Checks for corrupted LBM metadata records in RocksDB. // // Error type: non-fatal and repairable (by removing the records from RocksDB). @@ -192,6 +193,7 @@ struct LBMCorruptedRdbRecordCheck { }; std::vector<Entry> entries; }; +#endif // Results of a Kudu filesystem-wide check. The report contains general // statistics about the filesystem as well as a series of "checks" that @@ -288,7 +290,9 @@ struct FsReport { std::optional<LBMMalformedRecordCheck> malformed_record_check; std::optional<LBMMisalignedBlockCheck> misaligned_block_check; std::optional<LBMPartialRecordCheck> partial_record_check; +#if !defined(NO_ROCKSDB) std::optional<LBMCorruptedRdbRecordCheck> corrupted_rdb_record_check; +#endif }; } // namespace fs diff --git a/src/kudu/fs/log_block_manager-test-util.cc b/src/kudu/fs/log_block_manager-test-util.cc index c2aa8bb89..3fe18a133 100644 --- a/src/kudu/fs/log_block_manager-test-util.cc +++ b/src/kudu/fs/log_block_manager-test-util.cc @@ -28,16 +28,20 @@ #include <gflags/gflags_declare.h> #include <glog/logging.h> +#if !defined(NO_ROCKSDB) #include <rocksdb/db.h> #include <rocksdb/options.h> #include <rocksdb/slice.h> +#endif #include "kudu/fs/block_id.h" #include "kudu/fs/data_dirs.h" #include "kudu/fs/dir_manager.h" #include "kudu/fs/fs.pb.h" #include "kudu/fs/log_block_manager.h" +#if !defined(NO_ROCKSDB) #include "kudu/gutil/casts.h" +#endif #include "kudu/gutil/integral_types.h" #include "kudu/gutil/strings/strcat.h" #include "kudu/gutil/strings/strip.h" @@ -100,6 +104,7 @@ class NativeMetadataLBMCorruptor : public LBMCorruptor { BlockRecordPB* record) override; }; +#if !defined(NO_ROCKSDB) // LBMCorruptor to trace the LogBlockManagerRdbMeta data corruption. class RdbMetadataLBMCorruptor : public LBMCorruptor { public: @@ -135,15 +140,18 @@ class RdbMetadataLBMCorruptor : public LBMCorruptor { // Get the RdbDir for the given container. RdbDir* GetRdbDir(const Container* c) const; }; +#endif unique_ptr<LBMCorruptor> LBMCorruptor::Create( Env* env, DataDirManager* dd_manager, uint32_t rand_seed) { if (FLAGS_block_manager == "log") { return std::make_unique<NativeMetadataLBMCorruptor>(env, dd_manager, rand_seed); } +#if !defined(NO_ROCKSDB) if (FLAGS_block_manager == "logr") { return std::make_unique<RdbMetadataLBMCorruptor>(env, dd_manager, rand_seed); } +#endif return nullptr; } @@ -642,6 +650,7 @@ Status NativeMetadataLBMCorruptor::AppendDeleteRecordInternal( return writer->Append(record); } +#if !defined(NO_ROCKSDB) Status RdbMetadataLBMCorruptor::AppendPartialRecord( const Container* c, const BlockId block_id) { auto* rdb_dir = GetRdbDir(c); @@ -734,6 +743,7 @@ Status RdbMetadataLBMCorruptor::AppendDeleteRecordInternal( string key(LogBlockManagerRdbMeta::ConstructRocksDBKey(id, block_id)); return FromRdbStatus(dir->rdb()->Delete({}, rocksdb::Slice(key))); } +#endif } // namespace fs } // namespace kudu diff --git a/src/kudu/fs/log_block_manager-test.cc b/src/kudu/fs/log_block_manager-test.cc index 2d93d19b6..50070e98e 100644 --- a/src/kudu/fs/log_block_manager-test.cc +++ b/src/kudu/fs/log_block_manager-test.cc @@ -41,11 +41,13 @@ #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> +#if !defined(NO_ROCKSDB) #include <rocksdb/db.h> #include <rocksdb/iterator.h> #include <rocksdb/options.h> #include <rocksdb/slice.h> #include <rocksdb/status.h> +#endif #include "kudu/fs/block_id.h" #include "kudu/fs/block_manager.h" @@ -192,10 +194,14 @@ class LogBlockManagerTest : public KuduTest, env_, dd_manager_.get(), error_manager_, &file_cache_, std::move(opts), fs::kDefaultTenantID)); } +#if !defined(NO_ROCKSDB) CHECK_EQ(FLAGS_block_manager, "logr"); return make_scoped_refptr(new LogBlockManagerRdbMeta( env_, dd_manager_.get(), error_manager_, &file_cache_, std::move(opts), fs::kDefaultTenantID)); +#endif + LOG(FATAL) << "unsupported block manager: " << FLAGS_block_manager; + return nullptr; } Status ReopenBlockManager(const scoped_refptr<MetricEntity>& metric_entity = nullptr, @@ -280,7 +286,9 @@ class LogBlockManagerTest : public KuduTest, ASSERT_TRUE(report.malformed_record_check->entries.empty()); ASSERT_TRUE(report.misaligned_block_check->entries.empty()); ASSERT_TRUE(report.partial_record_check->entries.empty()); +#if !defined(NO_ROCKSDB) ASSERT_TRUE(report.corrupted_rdb_record_check->entries.empty()); +#endif } DataDirGroupPB test_group_pb_; @@ -383,7 +391,12 @@ static void CheckLogMetrics(const scoped_refptr<MetricEntity>& entity, INSTANTIATE_TEST_SUITE_P(EncryptionEnabled, LogBlockManagerTest, ::testing::Combine( ::testing::Values(false, true), - ::testing::Values("log", "logr"))); +#if defined(NO_ROCKSDB) + ::testing::Values("log") +#else + ::testing::Values("log", "logr") +#endif + )); // Parameterize test cases: // +------------+---------------+ @@ -1623,6 +1636,9 @@ TEST_P(LogBlockManagerTest, TestRepairUnpunchedBlocks) { // repair at startup). It's easiest to do this by reopening it; shutdown will // wait for outstanding hole punches. ASSERT_OK(ReopenBlockManager(nullptr, &report, corruptor.get())); +#if defined(NO_ROCKSDB) + { +#else if (FLAGS_block_manager == "logr" && !FLAGS_encrypt_data_at_rest) { // In this case, the data file is too small (zero here), the container will be added to // incomplete_container_check, of course, it will be repaired automatically when bootstrap. @@ -1634,6 +1650,7 @@ TEST_P(LogBlockManagerTest, TestRepairUnpunchedBlocks) { report.incomplete_container_check->entries.clear(); ASSERT_FALSE(env_->FileExists(data_file)); } else { +#endif // File size should be 0 post-repair. ASSERT_OK(env_->GetFileSizeOnDisk(data_file, &file_size_on_disk)); ASSERT_EQ(initial_file_size_on_disk, file_size_on_disk); @@ -2499,6 +2516,7 @@ TEST_P(LogBlockManagerNativeMetaTest, TestHalfPresentContainer) { } } +#if !defined(NO_ROCKSDB) // Parameterize test cases: // +------------+---------------+ // | encryption | block_manager | @@ -2824,6 +2842,7 @@ TEST_P(LogBlockManagerRdbMetaTest, TestHalfPresentContainer) { ASSERT_EQ(1, MetadataEntriesCount(container_name)); } } +#endif } // namespace fs } // namespace kudu diff --git a/src/kudu/fs/log_block_manager.cc b/src/kudu/fs/log_block_manager.cc index 7e0493896..fdf9573d0 100644 --- a/src/kudu/fs/log_block_manager.cc +++ b/src/kudu/fs/log_block_manager.cc @@ -40,12 +40,14 @@ #include <gflags/gflags.h> #include <glog/logging.h> +#if !defined(NO_ROCKSDB) #include <rocksdb/db.h> #include <rocksdb/iterator.h> #include <rocksdb/options.h> #include <rocksdb/slice.h> #include <rocksdb/status.h> #include <rocksdb/write_batch.h> +#endif #include "kudu/fs/block_manager_metrics.h" #include "kudu/fs/data_dirs.h" @@ -120,11 +122,13 @@ DEFINE_uint64(log_container_preallocate_bytes, 32LU * 1024 * 1024, "creating new blocks. Set to 0 to disable preallocation"); TAG_FLAG(log_container_preallocate_bytes, advanced); +#if !defined(NO_ROCKSDB) DEFINE_uint64(log_container_rdb_delete_batch_count, 256, "The batch count for deleting blocks in one operation against RocksDB. It is only " "effective when --block_manager='logr'"); TAG_FLAG(log_container_rdb_delete_batch_count, experimental); TAG_FLAG(log_container_rdb_delete_batch_count, advanced); +#endif DEFINE_double(log_container_excess_space_before_cleanup_fraction, 0.10, "Additional fraction of a log container's calculated size that " @@ -221,7 +225,9 @@ METRIC_DEFINE_gauge_uint64(server, log_block_manager_processed_containers_startu using kudu::fs::internal::LogBlock; using kudu::fs::internal::LogBlockContainer; using kudu::fs::internal::LogBlockContainerNativeMeta; +#if !defined(NO_ROCKSDB) using kudu::fs::internal::LogBlockContainerRdbMeta; +#endif using kudu::fs::internal::LogBlockDeletionTransaction; using kudu::fs::internal::LogWritableBlock; using kudu::pb_util::ReadablePBContainerFile; @@ -905,6 +911,7 @@ class LogBlockContainerNativeMeta final : public LogBlockContainer { DISALLOW_COPY_AND_ASSIGN(LogBlockContainerNativeMeta); }; +#if !defined(NO_ROCKSDB) //////////////////////////////////////////////////////////// // LogBlockContainerRdbMeta //////////////////////////////////////////////////////////// @@ -991,6 +998,7 @@ class LogBlockContainerRdbMeta final : public LogBlockContainer { DISALLOW_COPY_AND_ASSIGN(LogBlockContainerRdbMeta); }; +#endif #define CONTAINER_DISK_FAILURE(status_expr, msg) do { \ Status s_ = (status_expr); \ @@ -1096,7 +1104,9 @@ void LogBlockContainerNativeMeta::CompactMetadata() { report.malformed_record_check.emplace(); report.misaligned_block_check.emplace(); report.partial_record_check.emplace(); +#if !defined(NO_ROCKSDB) report.corrupted_rdb_record_check.emplace(); +#endif LogBlockManager::UntrackedBlockMap live_blocks; LogBlockManager::BlockRecordMap live_block_records; @@ -1886,6 +1896,7 @@ void LogBlockContainer::ContainerDeletionAsync(int64_t offset, int64_t length) { data_dir()->dir())); } +#if !defined(NO_ROCKSDB) Status LogBlockContainerRdbMeta::Create(LogBlockManager* block_manager, Dir* dir, LogBlockContainerRefPtr* container) { @@ -2179,6 +2190,7 @@ Status LogBlockContainerRdbMeta::SyncMetadata() { // } return Status::OK(); } +#endif /////////////////////////////////////////////////////////// // LogBlockCreationTransaction @@ -2380,7 +2392,9 @@ struct LogBlockContainerLoadResult { report.malformed_record_check.emplace(); report.misaligned_block_check.emplace(); report.partial_record_check.emplace(); +#if !defined(NO_ROCKSDB) report.corrupted_rdb_record_check.emplace(); +#endif } }; @@ -3988,6 +4002,7 @@ int64_t LogBlockManager::LookupBlockLimit(int64_t fs_block_size) { return kPerFsBlockSizeBlockLimits.begin()->second; } +#if !defined(NO_ROCKSDB) Status LogBlockManagerRdbMeta::CreateContainer(Dir* dir, LogBlockContainerRefPtr* container) { return LogBlockContainerRdbMeta::Create(this, dir, container); } @@ -4117,6 +4132,7 @@ std::string LogBlockManagerRdbMeta::ConstructRocksDBKey( const std::string& container_id, const BlockId& block_id) { return Substitute("$0.$1", container_id, block_id.ToString()); } +#endif } // namespace fs } // namespace kudu diff --git a/src/kudu/fs/log_block_manager.h b/src/kudu/fs/log_block_manager.h index 352c6ad67..e42ffe6c0 100644 --- a/src/kudu/fs/log_block_manager.h +++ b/src/kudu/fs/log_block_manager.h @@ -58,7 +58,9 @@ namespace internal { class LogBlock; class LogBlockContainer; class LogBlockContainerNativeMeta; +#if !defined(NO_ROCKSDB) class LogBlockContainerRdbMeta; +#endif class LogBlockDeletionTransaction; class LogWritableBlock; struct LogBlockContainerLoadResult; @@ -68,7 +70,9 @@ struct LogBlockManagerMetrics; typedef scoped_refptr<internal::LogBlock> LogBlockRefPtr; typedef scoped_refptr<internal::LogBlockContainer> LogBlockContainerRefPtr; typedef scoped_refptr<internal::LogBlockContainerNativeMeta> LogBlockContainerNativeMetaRefPtr; +#if !defined(NO_ROCKSDB) typedef scoped_refptr<internal::LogBlockContainerRdbMeta> LogBlockContainerRdbMetaRefPtr; +#endif typedef std::unordered_map<std::string, std::vector<BlockRecordPB>> ContainerBlocksByName; typedef std::unordered_map<std::string, LogBlockContainerRefPtr> ContainersByName; @@ -232,7 +236,9 @@ class LogBlockManager : public BlockManager { friend class internal::LogBlockContainer; friend class internal::LogBlockContainerNativeMeta; +#if !defined(NO_ROCKSDB) friend class internal::LogBlockContainerRdbMeta; +#endif friend class internal::LogBlockDeletionTransaction; friend class internal::LogWritableBlock; @@ -588,6 +594,7 @@ class LogBlockManagerNativeMeta : public LogBlockManager { const ContainersByName& containers_by_name) override; }; +#if !defined(NO_ROCKSDB) // All the container's metadata is written into a RocksDB instance which is // shared by all containers in the same data directory. // The metadata records in RocksDB are all of CREATE type, the records are @@ -665,6 +672,7 @@ class LogBlockManagerRdbMeta : public LogBlockManager { static std::string ConstructRocksDBKey(const std::string& container_id, const BlockId& block_id); }; +#endif } // namespace fs } // namespace kudu diff --git a/src/kudu/integration-tests/CMakeLists.txt b/src/kudu/integration-tests/CMakeLists.txt index bed669f9e..9dd934dc8 100644 --- a/src/kudu/integration-tests/CMakeLists.txt +++ b/src/kudu/integration-tests/CMakeLists.txt @@ -55,7 +55,11 @@ add_dependencies(itest_util kudu-tserver) # Tests -SET_KUDU_TEST_LINK_LIBS(itest_util gumbo-parser gumbo-query rocksdb) +SET_KUDU_TEST_LINK_LIBS(itest_util gumbo-parser gumbo-query) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb) +endif() ADD_KUDU_TEST(all_types-itest PROCESSORS 4 NUM_SHARDS 8) diff --git a/src/kudu/integration-tests/ts_recovery-itest.cc b/src/kudu/integration-tests/ts_recovery-itest.cc index 791cc3ceb..4f61cf391 100644 --- a/src/kudu/integration-tests/ts_recovery-itest.cc +++ b/src/kudu/integration-tests/ts_recovery-itest.cc @@ -21,6 +21,7 @@ #include <iterator> #include <memory> #include <ostream> +#include <set> #include <string> #include <thread> #include <type_traits> @@ -243,7 +244,7 @@ TEST_P(TsRecoveryITest, TestTabletRecoveryAfterSegmentDelete) { // Test for KUDU-2202 that ensures that blocks not found in the FS layer but // that are referenced by a tablet will not be reused. TEST_P(TsRecoveryITest, TestNoBlockIDReuseIfMissingBlocks) { - if (FLAGS_block_manager != "log" && FLAGS_block_manager != "logr") { + if (!FsManager::IsLogType(FLAGS_block_manager)) { GTEST_SKIP() << "Missing blocks is currently only supported by the log " "block manager. Exiting early!"; } diff --git a/src/kudu/server/CMakeLists.txt b/src/kudu/server/CMakeLists.txt index 7e178e9e1..51ff605de 100644 --- a/src/kudu/server/CMakeLists.txt +++ b/src/kudu/server/CMakeLists.txt @@ -83,8 +83,12 @@ SET_KUDU_TEST_LINK_LIBS( kudu_curl_util mini_kdc server_process - security_test_util - rocksdb - snappy) + security_test_util) +if(NOT NO_ROCKSDB) + ADD_KUDU_TEST_LINK_LIBS( + rocksdb + snappy) +endif() + ADD_KUDU_TEST(rpc_server-test) ADD_KUDU_TEST(webserver-test) diff --git a/src/kudu/tablet/compaction-test.cc b/src/kudu/tablet/compaction-test.cc index 92d81a98b..0fd17cb46 100644 --- a/src/kudu/tablet/compaction-test.cc +++ b/src/kudu/tablet/compaction-test.cc @@ -1388,7 +1388,7 @@ TEST_F(TestCompaction, TestCompactionFreesDiskSpace) { // Regression test for KUDU-1237, a bug in which empty flushes or compactions // would result in orphaning near-empty cfile blocks on the disk. TEST_F(TestCompaction, TestEmptyFlushDoesntLeakBlocks) { - if (FLAGS_block_manager != "log" && FLAGS_block_manager != "logr") { + if (!FsManager::IsLogType(FLAGS_block_manager)) { GTEST_SKIP() << "Test requires the log block manager"; } diff --git a/src/kudu/tools/CMakeLists.txt b/src/kudu/tools/CMakeLists.txt index c31c564fa..6c8e83280 100644 --- a/src/kudu/tools/CMakeLists.txt +++ b/src/kudu/tools/CMakeLists.txt @@ -142,13 +142,16 @@ set(KUDU_CLI_TOOL_LINK_LIBS kudu_util log master - rocksdb tablet tool_proto transactions tserver ${KUDU_BASE_LIBS} ) +if(NOT NO_ROCKSDB) + list(APPEND KUDU_CLI_TOOL_LINK_LIBS + rocksdb) +endif() # The mini_cluster is used only for tests. if (KUDU_CLI_TEST_TOOL_ENABLED) diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc index 8ed943fde..dde8c65c3 100644 --- a/src/kudu/tools/kudu-tool-test.cc +++ b/src/kudu/tools/kudu-tool-test.cc @@ -4620,6 +4620,7 @@ TEST_F(ToolTest, TestLocalReplicaDelete) { const string& data_dir = JoinPathSegments(tserver_dir, "data"); uint64_t size_before_delete; ASSERT_OK(env_->GetFileSizeOnDiskRecursively(data_dir, &size_before_delete)); +#if !defined(NO_ROCKSDB) const auto ExcludeIgnoredDirIfNeeded = [&] (uint64_t* total_size) { if (FLAGS_block_manager == "logr") { // Exclude the RocksDB data size. @@ -4630,6 +4631,7 @@ TEST_F(ToolTest, TestLocalReplicaDelete) { } }; ExcludeIgnoredDirIfNeeded(&size_before_delete); +#endif NO_FATALS(RunActionStdoutNone(Substitute("local_replica delete $0 --fs_wal_dir=$1 " "--fs_data_dirs=$1 --clean_unsafe", tablet_id, tserver_dir))); @@ -4665,7 +4667,9 @@ TEST_F(ToolTest, TestLocalReplicaDelete) { // indicates that some data has been deleted from disk. uint64_t size_after_delete; ASSERT_OK(env_->GetFileSizeOnDiskRecursively(data_dir, &size_after_delete)); +#if !defined(NO_ROCKSDB) ExcludeIgnoredDirIfNeeded(&size_after_delete); +#endif ASSERT_LT(size_after_delete, size_before_delete); // Since there was only one tablet on the node which was deleted by tool, diff --git a/src/kudu/util/CMakeLists.txt b/src/kudu/util/CMakeLists.txt index 7bd37c5ea..e4887cf1b 100644 --- a/src/kudu/util/CMakeLists.txt +++ b/src/kudu/util/CMakeLists.txt @@ -661,8 +661,11 @@ ADD_KUDU_TEST(compression/compression-test) if(NOT NO_TESTS) target_link_libraries(compression-test cfile - kudu_util_compression - rocksdb) + kudu_util_compression) + if(NOT NO_ROCKSDB) + target_link_libraries(compression-test + rocksdb) + endif() endif() ####################################### @@ -682,9 +685,12 @@ if(NOT NO_TESTS) target_link_libraries(jwt-util-test mini_oidc server_process - jwt_test_certs - rocksdb - snappy) + jwt_test_certs) + if(NOT NO_ROCKSDB) + target_link_libraries(jwt-util-test + rocksdb + snappy) + endif() endif() #######################################