Remove unbundled nuraft support

This commit is contained in:
Azat Khuzhin 2022-01-17 21:45:54 +03:00
parent 96efe17844
commit 5c32f6dd3e
8 changed files with 32 additions and 43 deletions

View File

@ -518,7 +518,6 @@ include (cmake/find/odbc.cmake)
include (cmake/find/nanodbc.cmake)
include (cmake/find/sqlite.cmake)
include (cmake/find/libpqxx.cmake)
include (cmake/find/nuraft.cmake)
include (cmake/find/yaml-cpp.cmake)
include (cmake/find/nlp.cmake)
include (cmake/find/filelog.cmake)

View File

@ -1,24 +0,0 @@
option(ENABLE_NURAFT "Enable NuRaft" ${ENABLE_LIBRARIES})
if (NOT ENABLE_NURAFT)
return()
endif()
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/NuRaft/src")
message (WARNING "submodule contrib/NuRaft is missing. to fix try run: \n git submodule update --init")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal NuRaft library")
set (USE_NURAFT 0)
return()
endif ()
if (NOT OS_FREEBSD)
set (USE_NURAFT 1)
set (NURAFT_LIBRARY nuraft)
set (NURAFT_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/NuRaft/include")
message (STATUS "Using NuRaft=${USE_NURAFT}: ${NURAFT_INCLUDE_DIR} : ${NURAFT_LIBRARY}")
else()
set (USE_NURAFT 0)
message (STATUS "Using internal NuRaft library on FreeBSD and Darwin is not supported")
endif()

View File

@ -200,10 +200,7 @@ if (USE_LIBPQXX)
add_subdirectory (libpqxx-cmake)
endif()
if (USE_NURAFT)
add_subdirectory (nuraft-cmake)
endif()
add_subdirectory(fast_float-cmake)
if (USE_NLP)

View File

@ -1,3 +1,15 @@
set(ENABLE_NURAFT_DEFAULT ${ENABLE_LIBRARIES})
if (OS_FREEBSD)
set(ENABLE_NURAFT_DEFAULT OFF)
message (STATUS "Using internal NuRaft library on FreeBSD and Darwin is not supported")
endif()
option(ENABLE_NURAFT "Enable NuRaft" ${ENABLE_NURAFT_DEFAULT})
if (NOT ENABLE_NURAFT)
message(STATUS "Not using NuRaft")
return()
endif()
set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/NuRaft")
set(SRCS
@ -29,23 +41,25 @@ set(SRCS
)
add_library(nuraft ${SRCS})
add_library(_nuraft ${SRCS})
if(NOT TARGET OpenSSL::Crypto)
target_compile_definitions(nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1 SSL_LIBRARY_NOT_FOUND=1)
target_compile_definitions(_nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1 SSL_LIBRARY_NOT_FOUND=1)
else()
target_compile_definitions(nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1)
target_compile_definitions(_nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1)
endif()
target_include_directories (nuraft SYSTEM PRIVATE "${LIBRARY_DIR}/include/libnuraft")
target_include_directories (_nuraft SYSTEM PRIVATE "${LIBRARY_DIR}/include/libnuraft")
# for some reason include "asio.h" directly without "boost/" prefix.
target_include_directories (nuraft SYSTEM PRIVATE "${ClickHouse_SOURCE_DIR}/contrib/boost/boost")
target_include_directories (_nuraft SYSTEM PRIVATE "${ClickHouse_SOURCE_DIR}/contrib/boost/boost")
target_link_libraries (nuraft PRIVATE boost::headers_only boost::coroutine)
target_link_libraries (_nuraft PRIVATE boost::headers_only boost::coroutine)
if(TARGET OpenSSL::Crypto)
target_link_libraries (nuraft PRIVATE OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries (_nuraft PRIVATE OpenSSL::Crypto OpenSSL::SSL)
endif()
target_include_directories (nuraft SYSTEM PUBLIC "${LIBRARY_DIR}/include")
target_include_directories (_nuraft SYSTEM PUBLIC "${LIBRARY_DIR}/include")
add_library(ch_contrib::nuraft ALIAS _nuraft)

View File

@ -53,9 +53,9 @@ option (ENABLE_CLICKHOUSE_KEEPER "ClickHouse alternative to ZooKeeper" ${ENABLE_
option (ENABLE_CLICKHOUSE_KEEPER_CONVERTER "Util allows to convert ZooKeeper logs and snapshots into clickhouse-keeper snapshot" ${ENABLE_CLICKHOUSE_ALL})
if (NOT USE_NURAFT)
if (NOT ENABLE_NURAFT)
# RECONFIGURE_MESSAGE_LEVEL should not be used here,
# since USE_NURAFT is set to OFF for FreeBSD and Darwin.
# since ENABLE_NURAFT is set to OFF for FreeBSD and Darwin.
message (STATUS "clickhouse-keeper and clickhouse-keeper-converter will not be built (lack of NuRaft)")
set(ENABLE_CLICKHOUSE_KEEPER OFF)
set(ENABLE_CLICKHOUSE_KEEPER_CONVERTER OFF)

View File

@ -241,7 +241,7 @@ add_object_library(clickhouse_processors_merges_algorithms Processors/Merges/Alg
add_object_library(clickhouse_processors_queryplan Processors/QueryPlan)
add_object_library(clickhouse_processors_queryplan_optimizations Processors/QueryPlan/Optimizations)
if (USE_NURAFT)
if (TARGET ch_contrib::nuraft)
add_object_library(clickhouse_coordination Coordination)
endif()
@ -352,8 +352,8 @@ if (USE_KRB5)
dbms_target_link_libraries(PRIVATE ${KRB5_LIBRARY})
endif()
if (USE_NURAFT)
dbms_target_link_libraries(PUBLIC ${NURAFT_LIBRARY})
if (TARGET ch_contrib::nuraft)
dbms_target_link_libraries(PUBLIC ch_contrib::nuraft)
endif()
if(RE2_INCLUDE_DIR)

View File

@ -25,3 +25,6 @@ endif()
if (TARGET ch_contrib::hdfs)
set(USE_HDFS 1)
endif()
if (TARGET ch_contrib::nuraft)
set(USE_NURAFT 1)
endif()

View File

@ -34,7 +34,7 @@ if (NOT DEFINED ENABLE_UTILS OR ENABLE_UTILS)
add_subdirectory (keeper-bench)
add_subdirectory (graphite-rollup)
if (USE_NURAFT)
if (TARGET ch_contrib::nuraft)
add_subdirectory (keeper-data-dumper)
endif ()