From aba9bb728d20c44f12a9aec685376257fd39e3ab Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Mon, 2 May 2022 22:23:23 -0400 Subject: [PATCH] rgw: allow Arrow Flight to be built and linked into ceph components Arrow Flight integration is triggered by defining WITH_RADOSGW_ARROW_FLIGHT=ON with the cmake invocation. For now this assumes that grpc-plugins is installed on the system and won't be built internally. Signed-off-by: J. Eric Ivancich --- CMakeLists.txt | 1 + cmake/modules/BuildArrow.cmake | 24 ++++++++++++++++++++++++ cmake/modules/Findc-ares.cmake | 19 +++++++++++++------ src/CMakeLists.txt | 4 ++-- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 683c806cbcf..3aab8c8a453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -439,6 +439,7 @@ option(WITH_RADOSGW_DBSTORE "DBStore backend for Rados Gateway" ON) option(WITH_RADOSGW_MOTR "CORTX-Motr backend for Rados Gateway" OFF) option(WITH_RADOSGW_DAOS "DAOS backend for RADOS Gateway" OFF) option(WITH_RADOSGW_SELECT_PARQUET "Support for s3 select on parquet objects" ON) +option(WITH_RADOSGW_ARROW_FLIGHT "Build arrow flight when not using system-provided arrow" OFF) option(WITH_SYSTEM_ARROW "Use system-provided arrow" OFF) option(WITH_SYSTEM_UTF8PROC "Use system-provided utf8proc" OFF) diff --git a/cmake/modules/BuildArrow.cmake b/cmake/modules/BuildArrow.cmake index 45ebb697446..691108a40c5 100644 --- a/cmake/modules/BuildArrow.cmake +++ b/cmake/modules/BuildArrow.cmake @@ -42,6 +42,15 @@ function(build_arrow) list(APPEND arrow_CMAKE_ARGS -DARROW_WITH_SNAPPY=ON) # required list(APPEND arrow_INTERFACE_LINK_LIBRARIES snappy::snappy) + if(WITH_RADOSGW_ARROW_FLIGHT) + message("building arrow flight; make sure grpc-plugins is installed on the system") + list(APPEND arrow_CMAKE_ARGS + -DARROW_FLIGHT=ON -DARROW_WITH_RE2=OFF) + find_package(gRPC REQUIRED) + find_package(Protobuf REQUIRED) + find_package(c-ares 1.13.0 QUIET REQUIRED) + endif(WITH_RADOSGW_ARROW_FLIGHT) + list(APPEND arrow_CMAKE_ARGS -DARROW_WITH_ZLIB=ON) # required list(APPEND arrow_INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) @@ -102,6 +111,11 @@ function(build_arrow) set(arrow_BYPRODUCTS ${arrow_LIBRARY}) list(APPEND arrow_BYPRODUCTS ${parquet_LIBRARY}) + if(WITH_RADOSGW_ARROW_FLIGHT) + set(arrow_flight_LIBRARY "${arrow_LIBRARY_DIR}/libarrow_flight.a") + list(APPEND arrow_BYPRODUCTS ${arrow_flight_LIBRARY}) + endif(WITH_RADOSGW_ARROW_FLIGHT) + if(CMAKE_MAKE_PROGRAM MATCHES "make") # try to inherit command line arguments passed by parent "make" job set(make_cmd $(MAKE)) @@ -140,4 +154,14 @@ function(build_arrow) set_target_properties(Arrow::Parquet PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION "${parquet_LIBRARY}") + + if(WITH_RADOSGW_ARROW_FLIGHT) + add_library(Arrow::Flight STATIC IMPORTED) + add_dependencies(Arrow::Flight arrow_ext) + target_link_libraries(Arrow::Flight INTERFACE Arrow::Arrow gRPC::grpc++) + set_target_properties(Arrow::Flight PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${arrow_INCLUDE_DIR}" # flight is accessed via "arrow/flight" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${arrow_flight_LIBRARY}") + endif(WITH_RADOSGW_ARROW_FLIGHT) endfunction() diff --git a/cmake/modules/Findc-ares.cmake b/cmake/modules/Findc-ares.cmake index 56311c7c3eb..93554ed2814 100644 --- a/cmake/modules/Findc-ares.cmake +++ b/cmake/modules/Findc-ares.cmake @@ -21,12 +21,19 @@ find_package_handle_standard_args(c-ares c-ares_LIBRARY VERSION_VAR c-ares_VERSION) -if(c-ares_FOUND AND NOT (TARGET c-ares::cares)) - add_library(c-ares::cares UNKNOWN IMPORTED GLOBAL) - set_target_properties(c-ares::cares PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${c-ares_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${c-ares_LIBRARY}") +if(c-ares_FOUND) + if(NOT TARGET c-ares::cares) + add_library(c-ares::cares UNKNOWN IMPORTED GLOBAL) + set_target_properties(c-ares::cares PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${c-ares_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${c-ares_LIBRARY}") + endif() + # to be compatible with old Seastar add_library(c-ares::c-ares ALIAS c-ares::cares) + + if(NOT TARGET c-ares::c-ares) + add_library(c-ares::c-ares ALIAS c-ares::cares) + endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 42972391210..a8e427c3eeb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -907,8 +907,8 @@ if(WITH_RADOSGW) include(BuildArrow) build_arrow() - endif() - endif() + endif(WITH_SYSTEM_ARROW) + endif(WITH_RADOSGW_SELECT_PARQUET) add_subdirectory(libkmip) add_subdirectory(rgw)