Skip to content

Commit

Permalink
Fix sanitize tests errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed May 21, 2024
1 parent 6db7663 commit 74db0ae
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ elseif (ENABLE_THINLTO)
endif ()

# Always prefer llvm tools when using clang. For instance, we cannot use GNU ar when llvm LTO is enabled
find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-11" "llvm-ar-12" "llvm-ar-13" "llvm-ar-14" "llvm-ar-15" "llvm-ar-16")
find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-13" "llvm-ar-14" "llvm-ar-15" "llvm-ar-16" "llvm-ar-17")

if (LLVM_AR_PATH)
message(STATUS "Using llvm-ar: ${LLVM_AR_PATH}.")
Expand All @@ -220,7 +220,7 @@ else ()
message(WARNING "Cannot find llvm-ar. System ar will be used instead. It does not work with ThinLTO.")
endif ()

find_program (LLVM_RANLIB_PATH NAMES "llvm-ranlib" "llvm-ranlib-11" "llvm-ranlib-12" "llvm-ranlib-13" "llvm-ranlib-14" "llvm-ranlib-15" "llvm-ranlib-16")
find_program (LLVM_RANLIB_PATH NAMES "llvm-ranlib" "llvm-ranlib-13" "llvm-ranlib-14" "llvm-ranlib-15" "llvm-ranlib-16" "llvm-ranlib-17")

if (LLVM_RANLIB_PATH)
message(STATUS "Using llvm-ranlib: ${LLVM_RANLIB_PATH}.")
Expand Down
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ target_link_libraries(rk_common_io PUBLIC ${NURAFT_LIBRARY})
add_library (rk_malloc OBJECT Common/malloc.cpp)
set_source_files_properties(Common/malloc.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin")

if (((SANITIZE STREQUAL "thread") OR (SANITIZE STREQUAL "address")))
add_library (rk_new_delete STATIC Common/new_delete.cpp)
target_link_libraries (rk_new_delete PRIVATE rk_common_io jemalloc)
endif()
add_library (rk_new_delete STATIC Common/new_delete.cpp)
target_link_libraries (rk_new_delete PRIVATE rk_common_io jemalloc)

add_subdirectory(ZooKeeper)
add_subdirectory(Common/Config)
Expand Down
4 changes: 2 additions & 2 deletions src/Service/tests/gtest_raft_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ TEST(RaftLog, writeAt)
{
String log_dir(LOG_DIR + "/9");
cleanDirectory(log_dir);
ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true);
ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true, FsyncMode::FSYNC);

UInt64 term = 1;
String key("/ck");
Expand Down Expand Up @@ -330,7 +330,7 @@ TEST(RaftLog, compact)
String log_dir(LOG_DIR + "/10");
cleanDirectory(log_dir);
ptr<NuRaftFileLogStore> file_store
= cs_new<NuRaftFileLogStore>(log_dir, true, FsyncMode::FSYNC_PARALLEL, 1000, static_cast<UInt32>(200), static_cast<UInt32>(3));
= cs_new<NuRaftFileLogStore>(log_dir, true, FsyncMode::FSYNC, 1000, static_cast<UInt32>(200), static_cast<UInt32>(3));

UInt64 term = 1;
String key("/ck/table/table1");
Expand Down
4 changes: 2 additions & 2 deletions src/Service/tests/gtest_raft_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TEST(RaftPerformance, appendLogPerformance)
String log_dir(LOG_DIR + "/50");
cleanDirectory(log_dir);

ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true);
ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true, FsyncMode::FSYNC);
int key_bytes = 256;
int value_bytes = 1024;

Expand Down Expand Up @@ -81,7 +81,7 @@ TEST(RaftPerformance, appendLogThread)
String log_dir(LOG_DIR + "/51");
cleanDirectory(log_dir);
//auto log_store = LogSegmentStore::getInstance(log_dir, true);
ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true);
ptr<NuRaftFileLogStore> file_store = cs_new<NuRaftFileLogStore>(log_dir, true, FsyncMode::FSYNC);
//ASSERT_EQ(log_store->init(), 0);
int key_bytes = 256;
int value_bytes = 1024;
Expand Down
4 changes: 2 additions & 2 deletions src/Service/tests/gtest_raft_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void createSnapshotWithFuzzyLog(bool async_snapshot)
KeeperResponsesQueue queue;
RaftSettingsPtr setting_ptr = RaftSettings::getDefault();
setting_ptr->async_snapshot = async_snapshot;
ptr<NuRaftFileLogStore> store = cs_new<NuRaftFileLogStore>(log_dir);
ptr<NuRaftFileLogStore> store = cs_new<NuRaftFileLogStore>(log_dir, false, FsyncMode::FSYNC);

std::mutex new_session_id_callback_mutex;
std::unordered_map<int64_t, ptr<std::condition_variable>> new_session_id_callback;
Expand Down Expand Up @@ -764,7 +764,7 @@ void createSnapshotWithFuzzyLog(bool async_snapshot)
std::this_thread::sleep_for(std::chrono::milliseconds(200));

KeeperResponsesQueue ano_queue;
ptr<NuRaftFileLogStore> ano_store = cs_new<NuRaftFileLogStore>(log_dir);
ptr<NuRaftFileLogStore> ano_store = cs_new<NuRaftFileLogStore>(log_dir, false, FsyncMode::FSYNC);

NuRaftStateMachine ano_machine(
ano_queue, setting_ptr, snap_dir, log_dir, 10, 3, new_session_id_callback_mutex, new_session_id_callback, ano_store);
Expand Down

0 comments on commit 74db0ae

Please sign in to comment.