diff --git a/cmake/CompileBoost.cmake b/cmake/CompileBoost.cmake index 6e5dcd75d7..52788e68ce 100644 --- a/cmake/CompileBoost.cmake +++ b/cmake/CompileBoost.cmake @@ -35,7 +35,7 @@ function(compile_boost) endif() # Update the user-config.jam - set(BOOST_ADDITIONAL_COMPILE_OPTIOINS "") + set(BOOST_ADDITIONAL_COMPILE_OPTIONS "") foreach(flag IN LISTS BOOST_COMPILER_FLAGS COMPILE_BOOST_CXXFLAGS) string(APPEND BOOST_ADDITIONAL_COMPILE_OPTIONS "${flag} ") endforeach() @@ -49,8 +49,8 @@ function(compile_boost) include(ExternalProject) set(BOOST_INSTALL_DIR "${CMAKE_BINARY_DIR}/boost_install") ExternalProject_add("${COMPILE_BOOST_TARGET}Project" - URL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2" - URL_HASH SHA256=fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854 + URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2" + URL_HASH SHA256=8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc CONFIGURE_COMMAND ${BOOTSTRAP_COMMAND} ${BOOTSTRAP_ARGS} --with-libraries=${BOOTSTRAP_LIBRARIES} --with-toolset=${BOOST_TOOLSET} BUILD_COMMAND ${B2_COMMAND} link=static ${COMPILE_BOOST_BUILD_ARGS} --prefix=${BOOST_INSTALL_DIR} ${USER_CONFIG_FLAG} install BUILD_IN_SOURCE ON @@ -89,12 +89,12 @@ set(Boost_USE_STATIC_LIBS ON) # Clang and Gcc will have different name mangling to std::call_once, etc. if (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - list(APPEND CMAKE_PREFIX_PATH /opt/boost_1_72_0_clang) - set(BOOST_HINT_PATHS /opt/boost_1_72_0_clang) + list(APPEND CMAKE_PREFIX_PATH /opt/boost_1_78_0_clang) + set(BOOST_HINT_PATHS /opt/boost_1_78_0_clang) message(STATUS "Using Clang version of boost::context") else () - list(APPEND CMAKE_PREFIX_PATH /opt/boost_1_72_0) - set(BOOST_HINT_PATHS /opt/boost_1_72_0) + list(APPEND CMAKE_PREFIX_PATH /opt/boost_1_78_0) + set(BOOST_HINT_PATHS /opt/boost_1_78_0) message(STATUS "Using g++ version of boost::context") endif () @@ -113,7 +113,7 @@ if(WIN32) return() endif() -find_package(Boost 1.77.0 EXACT QUIET COMPONENTS context CONFIG PATHS ${BOOST_HINT_PATHS}) +find_package(Boost 1.78.0 EXACT QUIET COMPONENTS context CONFIG PATHS ${BOOST_HINT_PATHS}) set(FORCE_BOOST_BUILD OFF CACHE BOOL "Forces cmake to build boost and ignores any installed boost") if(Boost_FOUND AND NOT FORCE_BOOST_BUILD) diff --git a/cmake/CompileRocksDB.cmake b/cmake/CompileRocksDB.cmake index 7f27d11c81..4634e57e7c 100644 --- a/cmake/CompileRocksDB.cmake +++ b/cmake/CompileRocksDB.cmake @@ -1,6 +1,6 @@ # FindRocksDB -find_package(RocksDB 6.22.1) +find_package(RocksDB 6.27.3) include(ExternalProject) @@ -22,6 +22,7 @@ if (RocksDB_FOUND) -DWITH_SNAPPY=OFF -DWITH_ZLIB=OFF -DWITH_ZSTD=OFF + -DWITH_LIBURING=${WITH_LIBURING} -DWITH_TSAN=${USE_TSAN} -DWITH_ASAN=${USE_ASAN} -DWITH_UBSAN=${USE_UBSAN} @@ -36,8 +37,8 @@ if (RocksDB_FOUND) ${BINARY_DIR}/librocksdb.a) else() ExternalProject_Add(rocksdb - URL https://github.com/facebook/rocksdb/archive/v6.22.1.tar.gz - URL_HASH SHA256=2df8f34a44eda182e22cf84dee7a14f17f55d305ff79c06fb3cd1e5f8831e00d + URL https://github.com/facebook/rocksdb/archive/refs/tags/v6.27.3.tar.gz + URL_HASH SHA256=ee29901749b9132692b26f0a6c1d693f47d1a9ed8e3771e60556afe80282bf58 CMAKE_ARGS -DUSE_RTTI=1 -DPORTABLE=${PORTABLE_ROCKSDB} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} @@ -52,6 +53,7 @@ else() -DWITH_SNAPPY=OFF -DWITH_ZLIB=OFF -DWITH_ZSTD=OFF + -DWITH_LIBURING=${WITH_LIBURING} -DWITH_TSAN=${USE_TSAN} -DWITH_ASAN=${USE_ASAN} -DWITH_UBSAN=${USE_UBSAN} diff --git a/cmake/FDBComponents.cmake b/cmake/FDBComponents.cmake index e21a921877..a31d386688 100644 --- a/cmake/FDBComponents.cmake +++ b/cmake/FDBComponents.cmake @@ -162,6 +162,8 @@ endif() ################################################################################ set(SSD_ROCKSDB_EXPERIMENTAL ON CACHE BOOL "Build with experimental RocksDB support") +set(PORTABLE_ROCKSDB ON CACHE BOOL "Compile RocksDB in portable mode") # Set this to OFF to compile RocksDB with `-march=native` +set(WITH_LIBURING OFF CACHE BOOL "Build with liburing enabled") # Set this to ON to include liburing # RocksDB is currently enabled by default for GCC but does not build with the latest # Clang. if (SSD_ROCKSDB_EXPERIMENTAL AND GCC) diff --git a/cmake/Finduring.cmake b/cmake/Finduring.cmake new file mode 100644 index 0000000000..8cb14cb27e --- /dev/null +++ b/cmake/Finduring.cmake @@ -0,0 +1,26 @@ +# - Find liburing +# +# uring_INCLUDE_DIR - Where to find liburing.h +# uring_LIBRARIES - List of libraries when using uring. +# uring_FOUND - True if uring found. + +find_path(uring_INCLUDE_DIR + NAMES liburing.h) +find_library(uring_LIBRARIES + NAMES liburing.a liburing) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(uring + DEFAULT_MSG uring_LIBRARIES uring_INCLUDE_DIR) + +mark_as_advanced( + uring_INCLUDE_DIR + uring_LIBRARIES) + +if(uring_FOUND AND NOT TARGET uring::uring) + add_library(uring::uring UNKNOWN IMPORTED) + set_target_properties(uring::uring PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${uring_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${uring_LIBRARIES}") +endif() diff --git a/fdbserver/CMakeLists.txt b/fdbserver/CMakeLists.txt index 5af8b2729d..4dea381051 100644 --- a/fdbserver/CMakeLists.txt +++ b/fdbserver/CMakeLists.txt @@ -33,7 +33,7 @@ set(FDBSERVER_SRCS DBCoreState.h DiskQueue.actor.cpp EncryptKeyProxyInterface.h - EncryptKeyProxy.actor.cpp + EncryptKeyProxy.actor.cpp fdbserver.actor.cpp FDBExecHelper.actor.cpp FDBExecHelper.actor.h @@ -295,14 +295,15 @@ add_library(fdb_sqlite STATIC if (WITH_ROCKSDB_EXPERIMENTAL) add_definitions(-DSSD_ROCKSDB_EXPERIMENTAL) - # Set this to 0 if you want to compile RocksDB with `-march=native`. - set(PORTABLE_ROCKSDB 1) include(CompileRocksDB) # CompileRocksDB sets `lz4_LIBRARIES` to be the shared lib, we want to link # statically, so find the static library here. find_library(lz4_STATIC_LIBRARIES NAMES liblz4.a REQUIRED) + if (WITH_LIBURING) + find_package(uring) + endif() endif() # Suppress warnings in sqlite since it's third party @@ -322,8 +323,15 @@ target_include_directories(fdbserver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/workloads) if (WITH_ROCKSDB_EXPERIMENTAL) add_dependencies(fdbserver rocksdb) - target_include_directories(fdbserver PRIVATE ${ROCKSDB_INCLUDE_DIR}) - target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite ${ROCKSDB_LIBRARIES} ${lz4_STATIC_LIBRARIES}) + if(WITH_LIBURING) + target_include_directories(fdbserver PRIVATE ${ROCKSDB_INCLUDE_DIR} ${uring_INCLUDE_DIR}) + target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite ${ROCKSDB_LIBRARIES} ${uring_LIBRARIES} ${lz4_STATIC_LIBRARIES}) + target_compile_definitions(fdbserver PRIVATE BOOST_ASIO_HAS_IO_URING=1 BOOST_ASIO_DISABLE_EPOLL=1) + else() + target_include_directories(fdbserver PRIVATE ${ROCKSDB_INCLUDE_DIR}) + target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite ${ROCKSDB_LIBRARIES} ${lz4_STATIC_LIBRARIES}) + target_compile_definitions(fdbserver PRIVATE) + endif() else() target_link_libraries(fdbserver PRIVATE fdbclient fdb_sqlite) endif() diff --git a/fdbserver/KeyValueStoreRocksDB.actor.cpp b/fdbserver/KeyValueStoreRocksDB.actor.cpp index 976905d386..21bc074231 100644 --- a/fdbserver/KeyValueStoreRocksDB.actor.cpp +++ b/fdbserver/KeyValueStoreRocksDB.actor.cpp @@ -11,6 +11,11 @@ #include #include #include +#if defined __has_include +#if __has_include() +#include +#endif +#endif #include "fdbclient/SystemData.h" #include "fdbserver/CoroFlow.h" #include "flow/flow.h" @@ -29,12 +34,12 @@ #ifdef SSD_ROCKSDB_EXPERIMENTAL -// Enforcing rocksdb version to be 6.22.1 or greater. -static_assert(ROCKSDB_MAJOR >= 6, "Unsupported rocksdb version. Update the rocksdb to 6.22.1 version"); -static_assert(ROCKSDB_MAJOR == 6 ? ROCKSDB_MINOR >= 22 : true, - "Unsupported rocksdb version. Update the rocksdb to 6.22.1 version"); -static_assert((ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 22) ? ROCKSDB_PATCH >= 1 : true, - "Unsupported rocksdb version. Update the rocksdb to 6.22.1 version"); +// Enforcing rocksdb version to be 6.27.3 or greater. +static_assert(ROCKSDB_MAJOR >= 6, "Unsupported rocksdb version. Update the rocksdb to 6.27.3 version"); +static_assert(ROCKSDB_MAJOR == 6 ? ROCKSDB_MINOR >= 27 : true, + "Unsupported rocksdb version. Update the rocksdb to 6.27.3 version"); +static_assert((ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 27) ? ROCKSDB_PATCH >= 3 : true, + "Unsupported rocksdb version. Update the rocksdb to 6.27.3 version"); namespace { using rocksdb::BackgroundErrorReason;