Skip to content

Commit

Permalink
[fix][cmake] Upgrade RocksDB to 9.1.1.
Browse files Browse the repository at this point in the history
Signed-off-by: Ketor <[email protected]>
  • Loading branch information
ketor authored and rock-git committed Apr 28, 2024
1 parent d49794d commit 39e0308
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 15 deletions.
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ elseif(${VECTORIZATION_INSTRUCTION_SET} STREQUAL "avx512")
endif()

include(CheckCXXCompilerFlag)
if (NOT CMAKE_CXX_STANDARD)
message(STATUS "CMAKE_CXX_STANDARD is not set, will set to 17")
set(CMAKE_CXX_STANDARD 17)
else()
set(ALLOWED_CXX_STANDARDS 17 20 23)
set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS ${ALLOWED_CXX_STANDARDS})
list(FIND ALLOWED_CXX_STANDARDS ${CMAKE_CXX_STANDARD} POSITION)
if (POSITION LESS 0)
message(FATAL_ERROR "Invalid CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}. "
"Must be one of: ${ALLOWED_CXX_STANDARDS}")
endif()
endif()

if (CMAKE_CXX_STANDARD EQUAL 23)
check_cxx_compiler_flag("-std=c++23" COMPILER_SUPPORTS_CXX23)
if(COMPILER_SUPPORTS_CXX23)
Expand All @@ -134,7 +147,6 @@ elseif(CMAKE_CXX_STANDARD EQUAL 20)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++20 support. Please use a different C++ compiler.")
endif()
else()
message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD} change to c++17")
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
if(COMPILER_SUPPORTS_CXX17)
set(CMAKE_CXX_STANDARD 17)
Expand Down
1 change: 1 addition & 0 deletions cmake/braft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SET(BRAFT_LIBRARIES "${BRAFT_INSTALL_DIR}/lib/libbraft.a" CACHE FILEPATH "braft


set(prefix_path "${THIRD_PARTY_PATH}/install/brpc|${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/glog|${THIRD_PARTY_PATH}/install/leveldb")
message(STATUS "braft search prefix_path in ${prefix_path}")

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -DUSE_BTHREAD_MUTEX)

Expand Down
1 change: 1 addition & 0 deletions cmake/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SET(BRPC_LIBRARIES "${BRPC_INSTALL_DIR}/lib/libbrpc.a" CACHE FILEPATH "brpc libr

# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args
set(prefix_path "${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/openssl|${THIRD_PARTY_PATH}/install/protobuf|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/glog|${THIRD_PARTY_PATH}/install/leveldb")
message(STATUS "brpc search prefix_path in ${prefix_path}")

# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF
ExternalProject_Add(
Expand Down
1 change: 0 additions & 1 deletion cmake/faiss-mkl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ elseif(${VECTORIZATION_INSTRUCTION_SET} STREQUAL "avx512")
SET(FAISS_OPT_LEVEL avx512)
SET(FAISS_LIBRARIES "${FAISS_INSTALL_DIR}/lib/libfaiss_avx512.a" CACHE FILEPATH "faiss library." FORCE)
else()
message(STATUS "faiss use generic instruction set")
SET(FAISS_OPT_LEVEL generic)
SET(FAISS_LIBRARIES "${FAISS_INSTALL_DIR}/lib/libfaiss.a" CACHE FILEPATH "faiss library." FORCE)
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ELSE (WIN32)
ENDIF (WIN32)

set(prefix_path "${THIRD_PARTY_PATH}/install/gflags")
message(STATUS "glog search prefix_path in ${prefix_path}")

SET(gflags_BUILD_STATIC_LIBS ON)

Expand Down
3 changes: 3 additions & 0 deletions cmake/leveldb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ SET(LEVELDB_INSTALL_DIR ${THIRD_PARTY_PATH}/install/leveldb)
SET(LEVELDB_INCLUDE_DIR "${LEVELDB_INSTALL_DIR}/include" CACHE PATH "leveldb include directory." FORCE)
SET(LEVELDB_LIBRARIES "${LEVELDB_INSTALL_DIR}/lib/libleveldb.a" CACHE FILEPATH "leveldb library." FORCE)

set(prefix_path "${THIRD_PARTY_PATH}/install/snappy")
message(STATUS "leveldb search prefix_path in ${prefix_path}")

ExternalProject_Add(
extern_leveldb
${EXTERNAL_PROJECT_LOG_ARGS}
Expand Down
3 changes: 2 additions & 1 deletion cmake/rocksdb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ SET(ROCKSDB_INCLUDE_DIR "${ROCKSDB_INSTALL_DIR}/include" CACHE PATH "rocksdb inc
SET(ROCKSDB_LIBRARIES "${ROCKSDB_INSTALL_DIR}/lib/librocksdb.a" CACHE FILEPATH "rocksdb library." FORCE)

set(prefix_path "${THIRD_PARTY_PATH}/install/snappy|${THIRD_PARTY_PATH}/install/zlib|${THIRD_PARTY_PATH}/install/lz4|${THIRD_PARTY_PATH}/install/zstd|${THIRD_PARTY_PATH}/install/gflags")
message(STATUS "rocksdb search prefix_path in ${prefix_path}")

# To avoid rocksdb PROTABLE options on old arch machine when build using docker
set(ROCKSDB_PROTABLE_OPTION "0" CACHE STRING "An option for rocksdb PROTABLE, default 0")
message(STATUS "Rocksdb protable option(ROCKSDB_PROTABLE_OPTION): ${ROCKSDB_PROTABLE_OPTION}")
message(STATUS "rocksdb protable option: ${ROCKSDB_PROTABLE_OPTION}")

ExternalProject_Add(
extern_rocksdb
Expand Down
1 change: 1 addition & 0 deletions cmake/snappy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SET(SNAPPY_INCLUDE_DIR "${SNAPPY_INSTALL_DIR}/include" CACHE PATH "snappy includ
SET(SNAPPY_LIBRARIES "${SNAPPY_INSTALL_DIR}/lib/libsnappy.a" CACHE FILEPATH "snappy library." FORCE)

set(prefix_path "${THIRD_PARTY_PATH}/install/gflags")
message(STATUS "snappy search prefix_path in ${prefix_path}")

ExternalProject_Add(
extern_snappy
Expand Down
2 changes: 1 addition & 1 deletion contrib/braft
Submodule braft updated 1 files
+4 −1 CMakeLists.txt
2 changes: 1 addition & 1 deletion contrib/brpc
Submodule brpc updated 92 files
+1 −1 .github/workflows/ci-linux.yml
+54 −3 .github/workflows/ci-macos.yml
+38 −0 .github/workflows/cifuzz.yml
+3 −0 .gitignore
+1 −0 BUILD.bazel
+48 −5 CMakeLists.txt
+4 −3 Makefile
+1 −1 RELEASE_VERSION
+29 −0 community/cases.md
+1 −1 community/newcommitter_cn.md
+87 −3 config_brpc.sh
+1 −1 docs/en/bvar_c++.md
+8 −8 docs/en/streaming_rpc.md
+141 −0 example/rpcz_echo_c++/CMakeLists.txt
+96 −0 example/rpcz_echo_c++/client.cpp
+33 −0 example/rpcz_echo_c++/echo.proto
+171 −0 example/rpcz_echo_c++/server.cpp
+1 −1 package/rpm/brpc.spec
+1 −0 src/brpc/builtin/common.cpp
+1 −0 src/brpc/builtin/common.h
+61 −19 src/brpc/builtin/hotspots_service.cpp
+10 −0 src/brpc/builtin/hotspots_service.h
+2 −1 src/brpc/builtin/pprof_perl.cpp
+17 −2 src/brpc/builtin/rpcz_service.cpp
+2 −0 src/brpc/builtin_service.proto
+7 −5 src/brpc/controller.cpp
+0 −3 src/brpc/details/health_check.cpp
+1 −0 src/brpc/errno.proto
+1 −1 src/brpc/esp_message.h
+2 −2 src/brpc/event_dispatcher.h
+2 −2 src/brpc/event_dispatcher_epoll.cpp
+2 −2 src/brpc/event_dispatcher_kqueue.cpp
+12 −0 src/brpc/global.cpp
+4 −4 src/brpc/memcache.h
+1 −1 src/brpc/nshead_message.h
+6 −0 src/brpc/pb_compat.h
+6 −4 src/brpc/policy/baidu_rpc_protocol.cpp
+10 −3 src/brpc/policy/streaming_rpc_protocol.cpp
+8 −0 src/brpc/protocol.cpp
+4 −4 src/brpc/redis.h
+2 −2 src/brpc/serialized_request.h
+113 −41 src/brpc/socket.cpp
+86 −7 src/brpc/socket.h
+66 −14 src/brpc/span.cpp
+13 −1 src/brpc/span.h
+1 −0 src/brpc/span.proto
+38 −14 src/brpc/stream.cpp
+6 −3 src/brpc/stream.h
+8 −3 src/brpc/stream_impl.h
+14 −3 src/bthread/bthread.cpp
+10 −1 src/bthread/bthread.h
+81 −0 src/bthread/bthread_once.cpp
+33 −20 src/bthread/butex.cpp
+62 −63 src/bthread/fd.cpp
+1 −0 src/bthread/id.cpp
+148 −13 src/bthread/list_of_abafree_id.h
+1 −1 src/bthread/mutex.cpp
+61 −0 src/bthread/singleton_on_bthread_once.h
+1 −1 src/bthread/task_control.h
+17 −7 src/bthread/task_group.cpp
+1 −1 src/bthread/task_group.h
+23 −0 src/bthread/types.h
+7 −0 src/bthread/unstable.h
+2 −2 src/butil/containers/doubly_buffered_data.h
+1 −1 src/butil/containers/mpsc_queue.h
+140 −6 src/butil/endpoint.cpp
+5 −0 src/butil/endpoint.h
+5 −0 src/butil/fd_utility.cpp
+3 −0 src/butil/fd_utility.h
+46 −5 src/butil/iobuf.cpp
+316 −0 src/butil/iobuf_profiler.cpp
+169 −0 src/butil/iobuf_profiler.h
+10 −4 src/butil/logging.cc
+88 −0 src/butil/memory/scope_guard.h
+2 −2 src/bvar/default_variables.cpp
+6 −2 src/json2pb/json_to_pb.cpp
+6 −2 src/json2pb/pb_to_json.cpp
+1 −0 test/BUILD.bazel
+2 −0 test/CMakeLists.txt
+2 −1 test/Makefile
+46 −0 test/abalist_unittest.cc
+1 −1 test/brpc_alpn_protocol_unittest.cpp
+214 −1 test/brpc_socket_unittest.cpp
+83 −18 test/brpc_streaming_rpc_unittest.cpp
+171 −0 test/bthread_butex_multi_tag_unittest.cpp
+39 −0 test/bthread_fd_unittest.cpp
+52 −0 test/bthread_key_unittest.cpp
+136 −0 test/bthread_once_unittest.cpp
+46 −5 test/bthread_unittest.cpp
+56 −0 test/endpoint_unittest.cpp
+20 −15 test/scope_guard_unittest.cc
+41 −0 tools/print_gcc_version.sh
2 changes: 1 addition & 1 deletion contrib/hdf5
Submodule hdf5 updated 1834 files
2 changes: 1 addition & 1 deletion contrib/libbacktrace
Submodule libbacktrace updated 4 files
+25 −16 Makefile.am
+110 −76 Makefile.in
+62 −18 configure
+17 −6 configure.ac
2 changes: 1 addition & 1 deletion contrib/openblas
2 changes: 1 addition & 1 deletion contrib/openssl
Submodule openssl updated 672 files
2 changes: 1 addition & 1 deletion contrib/rapidjson
2 changes: 1 addition & 1 deletion contrib/rocksdb
Submodule rocksdb updated 684 files
2 changes: 1 addition & 1 deletion contrib/zstd
Submodule zstd updated 155 files
4 changes: 2 additions & 2 deletions src/engine/rocks_raw_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ butil::Status Checkpoint::Create(const std::string& dirpath, const std::vector<s

status = checkpoint->CreateCheckpoint(dirpath);
if (!status.ok()) {
GetDB()->EnableFileDeletions(false);
GetDB()->EnableFileDeletions();
DINGO_LOG(ERROR) << fmt::format("[rocksdb] export column family checkpoint failed, error: {}.", status.ToString());
delete checkpoint;
return butil::Status(status.code(), status.ToString());
Expand All @@ -228,7 +228,7 @@ butil::Status Checkpoint::Create(const std::string& dirpath, const std::vector<s
meta_datas.push_back(meta_data);
}

status = GetDB()->EnableFileDeletions(false);
status = GetDB()->EnableFileDeletions();
if (!status.ok()) {
DINGO_LOG(ERROR) << fmt::format("[rocksdb] enable file deletion failed, error: {}.", status.ToString());
return butil::Status(status.code(), status.ToString());
Expand Down

0 comments on commit 39e0308

Please sign in to comment.