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 <ivancich@redhat.com>
This commit is contained in:
J. Eric Ivancich 2022-05-02 22:23:23 -04:00
parent f8b969785c
commit aba9bb728d
4 changed files with 40 additions and 8 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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)