From 4fc503c0fcfa7b592a0fcf75e36b8e1e05b8df15 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Thu, 21 May 2020 05:28:35 -0400 Subject: [PATCH 01/12] HBASE-23105: Update Folly and Wangle, requiring Fizz to be downloaded HBASE-24622: Download DoubleConversion and CyrusSasl hbase-24621: Update to C++17 ( and fix build failures as a result of this ) --- .gitignore | 3 + CMakeLists.txt | 65 +++++++++++------ cmake/BuildTests.cmake | 13 ++-- cmake/DownloadBoost.cmake | 1 + cmake/DownloadCyrusSasl.cmake | 37 ++++++++++ cmake/DownloadDoubleConversion.cmake | 34 +++++++++ cmake/DownloadFizz.cmake | 41 +++++++++++ cmake/DownloadFolly.cmake | 39 +++++------ cmake/DownloadProject.cmake | 4 +- cmake/DownloadWangle.cmake | 35 +++++----- cmake/FindKrb5.cmake | 9 ++- cmake/ProtobufGen.cmake | 1 + .../local/FindDoubleConversion.cmake | 28 ++++++++ .../system}/FindDoubleConversion.cmake | 2 +- cmake/fizz/local/FindFizz.cmake | 31 ++++++++ cmake/folly/local/FindFolly.cmake | 5 +- cmake/patches/fizz.v2020.05.18.00.cmake | 18 +++++ cmake/patches/zookeeper.3.4.14.buf | 4 ++ cmake/patches/zookeeper.3.4.14.cli | 4 ++ cmake/sasl2/local/FindSasl2.cmake | 36 ++++++++++ cmake/{ => sasl2/system}/FindSasl2.cmake | 0 .../client/async-batch-rpc-retrying-caller.h | 4 +- include/hbase/client/async-client-scanner.h | 1 - include/hbase/client/async-connection.h | 22 +++--- .../async-rpc-retrying-caller-factory.h | 1 - .../client/async-scan-rpc-retrying-caller.h | 1 - .../hbase/client/async-table-result-scanner.h | 2 +- include/hbase/client/configuration.h | 24 +++---- .../hbase/client/hbase-configuration-loader.h | 2 +- include/hbase/client/location-cache.h | 12 ++-- .../hbase/client/raw-scan-result-consumer.h | 1 - include/hbase/client/request-converter.h | 1 + include/hbase/client/scan-result-cache.h | 2 +- include/hbase/connection/client-dispatcher.h | 2 +- include/hbase/connection/connection-factory.h | 16 ++--- include/hbase/connection/connection-pool.h | 4 +- include/hbase/connection/rpc-client.h | 6 +- include/hbase/connection/rpc-connection.h | 4 +- include/hbase/connection/rpc-test-server.h | 2 +- include/hbase/utils/optional.h | 5 +- .../client/async-batch-rpc-retrying-caller.cc | 15 ++-- src/hbase/client/async-client-scanner.cc | 14 ++-- src/hbase/client/async-connection.cc | 6 +- src/hbase/client/async-rpc-retrying-caller.cc | 10 +-- .../client/async-scan-rpc-retrying-caller.cc | 6 +- src/hbase/client/configuration.cc | 70 +++++++++---------- .../client/hbase-configuration-loader.cc | 23 +++--- src/hbase/client/location-cache.cc | 28 ++++---- src/hbase/client/meta-utils.cc | 2 +- src/hbase/client/raw-async-table.cc | 18 ++--- src/hbase/client/table.cc | 21 ++---- src/hbase/connection/connection-factory.cc | 8 +-- src/hbase/connection/connection-pool.cc | 6 +- src/hbase/connection/pipeline.cc | 2 +- src/hbase/connection/rpc-client.cc | 10 +-- src/hbase/connection/rpc-test-server.cc | 2 + src/hbase/examples/load-client.cc | 2 +- src/hbase/examples/simple-client.cc | 2 +- src/hbase/serde/rpc-serde.cc | 2 +- src/hbase/test-util/mini-cluster-util.cc | 1 + src/hbase/test-util/mini-cluster.cc | 1 - src/hbase/utils/user-util.cc | 2 +- src/test/async-batch-rpc-retrying-test.cc | 27 +++---- src/test/async-rpc-retrying-test.cc | 32 ++++----- src/test/bytes-util-test.cc | 3 +- src/test/client-test.cc | 2 +- src/test/concurrent-map-test.cc | 3 +- src/test/connection-pool-test.cc | 2 +- src/test/hbase-configuration-test.cc | 34 ++++----- src/test/location-cache-test.cc | 18 ++--- src/test/result-test.cc | 2 +- src/test/rpc-test.cc | 45 ++++++------ src/test/time-range-test.cc | 3 +- src/test/user-util-test.cc | 3 +- src/test/zk-deserializer-test.cc | 2 +- 75 files changed, 604 insertions(+), 345 deletions(-) create mode 100644 cmake/DownloadCyrusSasl.cmake create mode 100644 cmake/DownloadDoubleConversion.cmake create mode 100644 cmake/DownloadFizz.cmake create mode 100644 cmake/doubleconversion/local/FindDoubleConversion.cmake rename cmake/{ => doubleconversion/system}/FindDoubleConversion.cmake (96%) create mode 100644 cmake/fizz/local/FindFizz.cmake create mode 100644 cmake/patches/fizz.v2020.05.18.00.cmake create mode 100644 cmake/patches/zookeeper.3.4.14.buf create mode 100644 cmake/patches/zookeeper.3.4.14.cli create mode 100644 cmake/sasl2/local/FindSasl2.cmake rename cmake/{ => sasl2/system}/FindSasl2.cmake (100%) diff --git a/.gitignore b/.gitignore index 93c6522..c2102f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ *.lo *.o +# Proto files +src/hbase/if/*.proto + # Compiled Dynamic libraries *.so diff --git a/CMakeLists.txt b/CMakeLists.txt index df07059..3193761 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,10 +56,12 @@ endif() ## include the Protobuf generation code include(ProtobufGen) include(DownloadBoost) +include(DownloadFizz) include(DownloadFolly) include(DownloadWangle) include(DownloadZookeeper) - +include(DownloadCyrusSasl) +include(DownloadDoubleConversion) set(PROJECT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/dependencies") set(BOOST_MIN_VERSION "1.6.1") @@ -88,10 +90,16 @@ if (DOWNLOAD_DEPENDENCIES) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf/local") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wangle/local") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/local") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sasl2/local") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local") else() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zookeeper/system") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/system") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wangle/system") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/system") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sasl2/system") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/system") endif(DOWNLOAD_DEPENDENCIES) ## Build Apache HBase components that are necessary for this project @@ -122,23 +130,22 @@ endif() include_directories("${JAVA_HBASE_DIR}/hbase-common/target/generated-sources/native/") ############ -## Validate that we have C++ 14 support +## Validate that we have C++ 17 support ############ -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) +CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX14) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +if(COMPILER_SUPPORTS_CXX17) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() - message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++14 support. Please use a different C++ compiler.") + message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++17 support. Please use a different C++ compiler.") endif() - set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase") set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if") set(HBASE_PROTO_GEN_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/hbase/if") @@ -160,9 +167,12 @@ endif (OPENSSL_FOUND) if (DOWNLOAD_DEPENDENCIES) download_boost(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${BOOST_LIBS}") - download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_fizz(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_cyrus_sasl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif(DOWNLOAD_DEPENDENCIES) @@ -172,7 +182,8 @@ find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS "${BOOST_LIBS}") find_package(LibEvent REQUIRED) find_package(Gflags REQUIRED) if (DOWNLOAD_DEPENDENCIES) - find_package(Sodium REQUIRED) + find_package(Sodium REQUIRED) + find_package(Fizz REQUIRED) endif(DOWNLOAD_DEPENDENCIES) find_package(Folly REQUIRED) find_package(Krb5 REQUIRED) @@ -206,7 +217,9 @@ include_directories(${Boost_INCLUDE_DIR}) include_directories(${KRB5_INCLUDE_DIRS}) include_directories(${JAVA_INCLUDE_DIRS}) include_directories(${FOLLY_INCLUDE_DIR}) +include_directories(${FIZZ_INCLUDE_DIR}) include_directories(${WANGLE_INCLUDE_DIR}) +include_directories(${DOUBLE_CONVERSION_INCLUDE_DIR}) ### create a directory for the hbase protobuf headers. ### this is helpful so that when we include it, later, we can generate ### the protocol buffer source/headers without polluting our tree. @@ -244,12 +257,15 @@ set_target_properties(hbaseclient-static PROPERTIES LINKER_LANGUAGE CXX) SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) set_target_properties(hbaseclient-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs") target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) + + target_link_libraries(hbaseclient-static ${SASL_LIBS}) target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) - target_link_libraries(hbaseclient-static ${sodium_LIBRARY_RELEASE}) + target_link_libraries(hbaseclient-static ${FIZZ_LIBRARIES}) + target_link_libraries(hbaseclient-static ${sodium_LIBRARY_RELEASE}) endif(DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-static ${FOLLY_LIBRARIES}) target_link_libraries(hbaseclient-static ${GLOG_SHARED_LIB}) @@ -269,7 +285,8 @@ target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY}) target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES}) target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) - target_link_libraries(hbaseclient-shared ${sodium_LIBRARY_RELEASE}) + target_link_libraries(hbaseclient-shared ${FIZZ_LIBRARIES}) + target_link_libraries(hbaseclient-shared ${sodium_LIBRARY_RELEASE}) endif(DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-shared ${FOLLY_LIBRARIES}) target_link_libraries(hbaseclient-shared ${SASL_LIBS}) @@ -314,16 +331,22 @@ add_custom_target( COMMAND ${CMAKE_SOURCE_DIR}/bin/cpplint.sh) if (DOWNLOAD_DEPENDENCIES) + add_dependencies(hbaseclient-static Protobuf) + add_dependencies(hbaseclient-shared Protobuf) + ## everything relies on folly. fizz relies on folly. wangle + ## relies on folly and fizz add_dependencies(facebook-folly-proj boost) add_dependencies(hbaseclient-static boost) add_dependencies(hbaseclient-shared boost) - add_dependencies(hbaseclient-static Protobuf) - add_dependencies(hbaseclient-shared Protobuf) - add_dependencies(facebook-wangle-proj facebook-folly-proj) - add_dependencies(hbaseclient-static facebook-wangle-proj) - add_dependencies(hbaseclient-shared facebook-wangle-proj) - add_dependencies(hbaseclient-static zookeeper) - add_dependencies(hbaseclient-shared zookeeper) + add_dependencies(facebook-folly-proj doubleconversion-proj) + add_dependencies(facebook-wangle-proj facebook-folly-proj) + add_dependencies(facebook-fizz-proj facebook-folly-proj) + add_dependencies(facebook-wangle-proj facebook-folly-proj) + add_dependencies(facebook-wangle-proj facebook-fizz-proj) + add_dependencies(hbaseclient-static facebook-wangle-proj) + add_dependencies(hbaseclient-shared facebook-wangle-proj) + add_dependencies(hbaseclient-static zookeeper) + add_dependencies(hbaseclient-shared zookeeper) endif(DOWNLOAD_DEPENDENCIES) # Install library headers diff --git a/cmake/BuildTests.cmake b/cmake/BuildTests.cmake index 4808fc3..73ac92a 100644 --- a/cmake/BuildTests.cmake +++ b/cmake/BuildTests.cmake @@ -39,29 +39,24 @@ target_include_directories(testutil PRIVATE BEFORE${Zookeeper_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${KRB5_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${Java_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${FOLLY_INCLUDE_DIRS}) -target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${KRB5_LIBRARIES} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES}) +target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${KRB5_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES}) function(createTests testName) - message ("-- Including Test: ${testName}") + message (STATUS "Including Test: ${testName}") target_include_directories(${testName} PRIVATE BEFORE "include") target_include_directories(${testName} PRIVATE BEFORE "${Java_INCLUDE_DIRS}") target_include_directories(${testName} PRIVATE BEFORE "${JNI_INCLUDE_DIRS}") target_include_directories(${testName} PRIVATE BEFORE "${Boost_INCLUDE_DIR}") target_include_directories(${testName} PRIVATE BEFORE "${GTEST_INCLUDE_DIRS}") target_include_directories(${testName} PRIVATE BEFORE "${OPENSSL_INCLUDE_DIR}") - - - #target_link_libraries(${testName} ${PROTOBUF_LIBRARY}) - #${PROTOBUF_LIBRARY} - - target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_DL_LIBS} + target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} + ${KRB5_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} - ${KRB5_LIBRARIES} ${ZOOKEEPER_LIBRARIES} ${OPENSSL_LIBRARIES} ${GLOG_SHARED_LIB} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/cmake/DownloadBoost.cmake b/cmake/DownloadBoost.cmake index 388a511..cc2b445 100644 --- a/cmake/DownloadBoost.cmake +++ b/cmake/DownloadBoost.cmake @@ -49,4 +49,5 @@ function(download_boost SOURCE_DIR BUILD_DIR BOOST_LIBS) INSTALL_COMMAND "" ) set(BOOST_ROOT ${BOOST_INSTALL_DIR} PARENT_SCOPE) + set(Boost_FIND_COMPONENTS ${BOOST_LIBS} PARENT_SCOPE) endfunction(download_boost) diff --git a/cmake/DownloadCyrusSasl.cmake b/cmake/DownloadCyrusSasl.cmake new file mode 100644 index 0000000..1d1fe02 --- /dev/null +++ b/cmake/DownloadCyrusSasl.cmake @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +## Download Cyrus SASL +## SOURCE_DIR is typically the cmake source directory +## BINARY_DIR is the build directory, typically 'build' + + +function(download_cyrus_sasl SOURCE_DIR BUILD_DIR) + ExternalProject_Add( + cyrussasl + URL "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz" + PREFIX "${BUILD_DIR}/dependencies" + SOURCE_DIR "${BUILD_DIR}/dependencies/cyrussasl-src" + BINARY_DIR ${BUILD_DIR}/dependencies/cyrussasl-src/ + CONFIGURE_COMMAND ./configure --enable-static --with-pic --prefix=${BUILD_DIR}/dependencies/cyrussasl-install + "CFLAGS=-fPIC" + "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC" + ) + add_library(sasl2 STATIC IMPORTED) + set_target_properties(sasl2 PROPERTIES IMPORTED_LOCATION "${BUILD_DIR}/dependencies/cyrussasl-install/lib/libsasl2.a") + set(SASL2_DIR "${BUILD_DIR}/dependencies/cyrussasl-install/" CACHE STRING "" FORCE) +endfunction(download_cyrus_sasl) diff --git a/cmake/DownloadDoubleConversion.cmake b/cmake/DownloadDoubleConversion.cmake new file mode 100644 index 0000000..dc32b07 --- /dev/null +++ b/cmake/DownloadDoubleConversion.cmake @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +## Download facebook's folly library. +## SOURCE_DIR is typically the cmake source directory +function(download_doubleconversion SOURCE_DIR BUILD_DIR) + ExternalProject_Add( + doubleconversion-proj + GIT_REPOSITORY "https://github.com/google/double-conversion.git" + GIT_TAG "master" + SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src" + CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} + "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + "${BUILD_ARGS}" + ) + + + set(DOUBLE_CONVERSION_ROOT_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-install" CACHE STRING "" FORCE) +endfunction(download_doubleconversion) diff --git a/cmake/DownloadFizz.cmake b/cmake/DownloadFizz.cmake new file mode 100644 index 0000000..faea366 --- /dev/null +++ b/cmake/DownloadFizz.cmake @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +## Download facebook's fizz library. +## SOURCE_DIR is typically the cmake source directory +## BINARY_DIR is the build directory, typically 'build' + +function(download_fizz SOURCE_DIR BUILD_DIR) + + + ExternalProject_Add( + facebook-fizz-proj + GIT_REPOSITORY "https://github.com/facebookincubator/fizz.git" + GIT_TAG "v2020.05.18.00" + SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-src" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake + COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake" + INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install + ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. + ) + + + set(FIZZ_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CACHE STRING "" FORCE) + +endfunction(download_fizz) \ No newline at end of file diff --git a/cmake/DownloadFolly.cmake b/cmake/DownloadFolly.cmake index 1ff5556..f999ccb 100644 --- a/cmake/DownloadFolly.cmake +++ b/cmake/DownloadFolly.cmake @@ -17,32 +17,25 @@ ## Download facebook's folly library. ## SOURCE_DIR is typically the cmake source directory -## BUILD_DIR is the build directory, typically 'build' - function(download_folly SOURCE_DIR BUILD_DIR) - - if (DOWNLOAD_DEPENDENCIES) - # Add custom boost include and lib paths. - set(CFLAGS "-fPIC -I${BOOST_ROOT}/include -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}") - set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -I${BOOST_ROOT}/include -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}") - set(LDFLAGS "-L${BOOST_ROOT}/lib") - set(CONFIGURE_CMD ./configure --prefix=${BUILD_DIR}/dependencies/facebook-folly-proj-install - --with-boost-libdir=${BOOST_ROOT}/lib CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS}) - else() - set(CFLAGS "-fPIC -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}") - set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}") - set(CONFIGURE_CMD ./configure --prefix=${BUILD_DIR}/dependencies/facebook-folly-proj-install CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}) - endif() ExternalProject_Add( - facebook-folly-proj - # TODO: Source version information from cmake file. - URL "https://github.com/facebook/folly/archive/v2017.09.04.00.tar.gz" - PREFIX "${BUILD_DIR}/dependencies" - SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src" - BINARY_DIR ${BUILD_DIR}/dependencies/facebook-folly-proj-src/folly - CONFIGURE_COMMAND autoreconf -ivf COMMAND ${CONFIGURE_CMD} - UPDATE_COMMAND "" + facebook-folly-proj + GIT_REPOSITORY "https://github.com/facebook/folly.git" + GIT_TAG "v2020.05.18.00" + SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake + CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} + "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install" + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} + -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} + -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} + -DBOOST_ROOT=${BOOST_ROOT} + -DBOOST_INCLUDEDIR=${BOOST_ROOT}/include + -DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib + "${BUILD_ARGS}" ) set(FOLLY_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-install" CACHE STRING "" FORCE) endfunction(download_folly) diff --git a/cmake/DownloadProject.cmake b/cmake/DownloadProject.cmake index fc98afe..2e18284 100644 --- a/cmake/DownloadProject.cmake +++ b/cmake/DownloadProject.cmake @@ -110,7 +110,6 @@ set(_DownloadProjectDir "${CMAKE_CURRENT_LIST_DIR}") include(CMakeParseArguments) function(download_project) - set(options QUIET IS_AUTOGEN IS_MAVEN) set(oneValueArgs PROJ @@ -188,8 +187,7 @@ function(download_project) if(result) file(REMOVE "${DL_ARGS_DOWNLOAD_DIR}/CMakeCache.txt") message(FATAL_ERROR "CMake step for ${DL_ARGS_PROJ} failed: ${result}") - endif() - + endif() execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result ${OUTPUT_QUIET} diff --git a/cmake/DownloadWangle.cmake b/cmake/DownloadWangle.cmake index 74c97a6..4cfd7b8 100644 --- a/cmake/DownloadWangle.cmake +++ b/cmake/DownloadWangle.cmake @@ -20,24 +20,25 @@ ## BINARY_DIR is the build directory, typically 'build' function(download_wangle SOURCE_DIR BUILD_DIR) + set(WANGLE_DOWNLOAD_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-download") set(WANGLE_SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-src") set(WANGLE_INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-install") - if (DOWNLOAD_DEPENDENCIES) - set(PATCH_FOLLY ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" "${WANGLE_SOURCE_DIR}/wangle/cmake") - else() - set(PATCH_FOLLY "") - endif() - - ExternalProject_Add( - facebook-wangle-proj - URL "https://github.com/facebook/wangle/archive/v2017.09.04.00.tar.gz" - PREFIX "${BUILD_DIR}/dependencies" - DOWNLOAD_DIR ${WANGLE_DOWNLOAD_DIR} - SOURCE_DIR ${WANGLE_SOURCE_DIR} - PATCH_COMMAND ${PATCH_FOLLY} - INSTALL_DIR ${WANGLE_INSTALL_DIR} - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DBOOST_ROOT=${BOOST_ROOT} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} "${WANGLE_SOURCE_DIR}/wangle" # Tell CMake to use subdirectory as source. - ) - set(WANGLE_ROOT_DIR ${WANGLE_INSTALL_DIR} CACHE STRING "" FORCE) + + ExternalProject_Add( + facebook-wangle-proj + GIT_REPOSITORY "https://github.com/facebook/wangle.git" + GIT_TAG "v2020.05.18.00" + SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-src" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/local/FindFizz.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND patch ${WANGLE_SOURCE_DIR}/wangle/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/wangle.v2020.05.18.00.cmake + INSTALL_DIR "${WANGLE_INSTALL_DIR}" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFIZZ_ROOT_DIR=${FIZZ_ROOT_DIR} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} + ${WANGLE_SOURCE_DIR}/wangle # Tell CMake to use subdirectory as source. + ) + + set(WANGLE_ROOT_DIR "${WANGLE_INSTALL_DIR}" CACHE STRING "" FORCE) endfunction(download_wangle) diff --git a/cmake/FindKrb5.cmake b/cmake/FindKrb5.cmake index e4c6fb8..318820a 100644 --- a/cmake/FindKrb5.cmake +++ b/cmake/FindKrb5.cmake @@ -19,10 +19,16 @@ find_path(KRB5_ROOT_DIR NAMES include/krb5/krb5.h ) +find_library(GSSAPI_KRB5_LIBRARY gssapi_krb5) + find_library(KRB5_LIBRARIES NAMES krb5 HINTS ${KRB5_ROOT_DIR}/lib ) + + +find_library(GSSAPI_KRB5_LIBRARY gssapi_krb5) + find_path(KRB5_INCLUDE_DIR NAMES krb5/krb5.h HINTS ${KRB5_ROOT_DIR}/include @@ -32,9 +38,10 @@ find_package_handle_standard_args(krb5 DEFAULT_MSG KRB5_LIBRARIES KRB5_INCLUDE_DIR ) +set(KRB5_LIBRARIES "${KRB5_LIBRARIES}" "${GSSAPI_KRB5_LIBRARY}") if (KRB5_LIBRARIES) set(KRB5_FOUND "true") - message("-- KRB5 Libs Found, ${KRB5_LIBRARIES}") + message(STATUS "KRB5 Libs Found, ${KRB5_LIBRARIES}") endif() mark_as_advanced( KRB5_ROOT_DIR diff --git a/cmake/ProtobufGen.cmake b/cmake/ProtobufGen.cmake index 07e57d0..27a3cc7 100644 --- a/cmake/ProtobufGen.cmake +++ b/cmake/ProtobufGen.cmake @@ -36,6 +36,7 @@ function(generate_protobuf_src SRCS HDRS HDR_DIR PROTO_PATH) set(${SRCS}) set(${HDRS}) foreach(FIL ${ARGN}) + message("Generating ${FIL} with ${PROTOBUF_PROTOC_EXECUTABLE}") get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) ## get the directory where our protobufs are stored diff --git a/cmake/doubleconversion/local/FindDoubleConversion.cmake b/cmake/doubleconversion/local/FindDoubleConversion.cmake new file mode 100644 index 0000000..aa98b95 --- /dev/null +++ b/cmake/doubleconversion/local/FindDoubleConversion.cmake @@ -0,0 +1,28 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(DOUBLE_CONVERSION_FOUND "true" CACHE STRING "" FORCE) +set(DOUBLE_CONVERSION_INCLUDE_DIR "${DOUBLE_CONVERSION_ROOT_DIR}/include" CACHE STRING "" FORCE) +set(DOUBLE_CONVERSION_INCLUDE_DIRS "${DOUBLE_CONVERSION_INCLUDE_DIR}" CACHE STRING "" FORCE) +set(DOUBLE_CONVERSION_LIBRARY "${DOUBLE_CONVERSION_ROOT_DIR}/lib/${BYPRODUCT_PREFIX}double-conversion${BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) + + +mark_as_advanced( + DOUBLE_CONVERSION_ROOT_DIR + DOUBLE_CONVERSION_FOUND + DOUBLE_CONVERSION_LIBRARY + DOUBLE_CONVERSION_INCLUDE_DIR + DOUBLE_CONVERSION_INCLUDE_DIRS +) +message(STATUS "DoubleConversion found, ${DOUBLE_CONVERSION_LIBRARY}") diff --git a/cmake/FindDoubleConversion.cmake b/cmake/doubleconversion/system/FindDoubleConversion.cmake similarity index 96% rename from cmake/FindDoubleConversion.cmake rename to cmake/doubleconversion/system/FindDoubleConversion.cmake index d324472..f65bc2d 100644 --- a/cmake/FindDoubleConversion.cmake +++ b/cmake/doubleconversion/system/FindDoubleConversion.cmake @@ -14,7 +14,7 @@ # Finds libdouble-conversion. # -# DEFINE DOUBLE_CONVERSION_ROOT_DIR to provide a hint + DEFINE DOUBLE_CONVERSION_ROOT_DIR to provide a hint # This module defines: # DOUBLE_CONVERSION_INCLUDE_DIR # DOUBLE_CONVERSION_LIBRARY diff --git a/cmake/fizz/local/FindFizz.cmake b/cmake/fizz/local/FindFizz.cmake new file mode 100644 index 0000000..6f29ecd --- /dev/null +++ b/cmake/fizz/local/FindFizz.cmake @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Stubs to allow us to find FIZZ libs + +set(FIZZ_FOUND "true" CACHE STRING "" FORCE) +set(FIZZ_INCLUDE_DIR "${FIZZ_ROOT_DIR}/include" CACHE STRING "" FORCE) +set(FIZZ_LIBRARIES "${FIZZ_ROOT_DIR}/lib/${BYPRODUCT_PREFIX}fizz${BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) + + +mark_as_advanced( + FIZZ_ROOT_DIR + FIZZ_LIBRARIES + FIZZ_BENCHMARK_LIBRARIES + FIZZ_INCLUDE_DIR +) +message(STATUS "Fizz found, ${FIZZ_LIBRARIES}") \ No newline at end of file diff --git a/cmake/folly/local/FindFolly.cmake b/cmake/folly/local/FindFolly.cmake index 63fb190..8e9d88a 100644 --- a/cmake/folly/local/FindFolly.cmake +++ b/cmake/folly/local/FindFolly.cmake @@ -22,14 +22,15 @@ set(FOLLY_INCLUDE_DIRS "${FOLLY_ROOT_DIR}/include" CACHE STRING "" FORCE) set(FOLLY_INCLUDE_DIR "${FOLLY_ROOT_DIR}/include" CACHE STRING "" FORCE) ## Given that folly is an older dependency, and the way it is built has evolved, newer ## versions of folly won't require an SO. For now it is far easier to link against the .so (BYPRODUCT_SHARED_SUFFIX) -set(FOLLY_LIBRARIES "${FOLLY_ROOT_DIR}/lib/${BYPRODUCT_PREFIX}folly${BYPRODUCT_SHARED_SUFFIX}" CACHE STRING "" FORCE) +set(FOLLY_LIBRARIES "${FOLLY_ROOT_DIR}/lib/${BYPRODUCT_PREFIX}folly${BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) mark_as_advanced( + FOLLY_ROOT_DIR FOLLY_INCLUDE FOLLY_INCLUDE_DIRS FOLLY_INCLUDE_DIR FOLLY_LIBRARIES ) -message("-- FOLLY found, ${FOLLY_LIBRARIES}") \ No newline at end of file +message(STATUS "FOLLY found, ${FOLLY_LIBRARIES}") \ No newline at end of file diff --git a/cmake/patches/fizz.v2020.05.18.00.cmake b/cmake/patches/fizz.v2020.05.18.00.cmake new file mode 100644 index 0000000..ca7981f --- /dev/null +++ b/cmake/patches/fizz.v2020.05.18.00.cmake @@ -0,0 +1,18 @@ +36c36 +< find_package(folly CONFIG REQUIRED) +--- +> find_package(Folly REQUIRED) +46a47,54 +> +> if(NOT APPLE) +> if(NOT WIN32) +> set(WHOLE_ARCHIVE "-Wl,--whole-archive") +> set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive") +> endif() +> endif() +> +220a229 +> ${WHOLE_ARCHIVE} +221a231 +> ${NO_WHOLE_ARCHIVE} + diff --git a/cmake/patches/zookeeper.3.4.14.buf b/cmake/patches/zookeeper.3.4.14.buf new file mode 100644 index 0000000..881d335 --- /dev/null +++ b/cmake/patches/zookeeper.3.4.14.buf @@ -0,0 +1,4 @@ +3480c3480 +< static char buf[128]; +--- +> static char buf[128+6] = {0}; diff --git a/cmake/patches/zookeeper.3.4.14.cli b/cmake/patches/zookeeper.3.4.14.cli new file mode 100644 index 0000000..fa6bfcc --- /dev/null +++ b/cmake/patches/zookeeper.3.4.14.cli @@ -0,0 +1,4 @@ +559c559 +< strncpy(cmd, argv[2]+4, sizeof(cmd)); +--- +> strncpy(cmd, argv[2]+4, sizeof(cmd)-1); diff --git a/cmake/sasl2/local/FindSasl2.cmake b/cmake/sasl2/local/FindSasl2.cmake new file mode 100644 index 0000000..9eef5a5 --- /dev/null +++ b/cmake/sasl2/local/FindSasl2.cmake @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Stubs to allow us to find folly libs + +set(SASL2_FOUND "true" CACHE STRING "" FORCE) +set(SASL2_INCLUDE_DIR "${SASL2_DIR}/include" CACHE STRING "" FORCE) +set(SASL_INCLUDE_DIRS "${SASL2_INCLUDE_DIR}" CACHE STRING "" FORCE) +set(SASL2_LIBRARIES "${SASL2_DIR}/lib/sasl2/${BYPRODUCT_PREFIX}gs2${BYPRODUCT_SUFFIX}" "${SASL2_DIR}/lib/sasl2/${BYPRODUCT_PREFIX}gssapiv2${BYPRODUCT_SUFFIX}" "${SASL2_DIR}/lib/${BYPRODUCT_PREFIX}sasl2${BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) +set(SASL_LIBS "${SASL2_LIBRARIES}" CACHE STRING "" FORCE) + +mark_as_advanced( + SASL2_FOUND + WANGLE_LIBRARIES + SASL2_INCLUDE_DIR + SASL_INCLUDE_DIRS + SASL2_LIBRARIES + SASL_LIBS +) + message(STATUS "SASL2 found, ${SASL2_LIBRARIES}") \ No newline at end of file diff --git a/cmake/FindSasl2.cmake b/cmake/sasl2/system/FindSasl2.cmake similarity index 100% rename from cmake/FindSasl2.cmake rename to cmake/sasl2/system/FindSasl2.cmake diff --git a/include/hbase/client/async-batch-rpc-retrying-caller.h b/include/hbase/client/async-batch-rpc-retrying-caller.h index f2e11d5..0ac9391 100644 --- a/include/hbase/client/async-batch-rpc-retrying-caller.h +++ b/include/hbase/client/async-batch-rpc-retrying-caller.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -178,7 +178,7 @@ class AsyncBatchRpcRetryingCaller { std::shared_ptr location_cache_ = nullptr; std::shared_ptr rpc_client_ = nullptr; - std::shared_ptr cpu_pool_ = nullptr; + std::shared_ptr cpu_pool_ = nullptr; std::recursive_mutex multi_mutex_; }; diff --git a/include/hbase/client/async-client-scanner.h b/include/hbase/client/async-client-scanner.h index 4a560c4..c3ea8c4 100644 --- a/include/hbase/client/async-client-scanner.h +++ b/include/hbase/client/async-client-scanner.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/include/hbase/client/async-connection.h b/include/hbase/client/async-connection.h index 1f1c226..deca611 100644 --- a/include/hbase/client/async-connection.h +++ b/include/hbase/client/async-connection.h @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -53,9 +53,9 @@ class AsyncConnection { virtual std::shared_ptr rpc_client() = 0; virtual std::shared_ptr region_locator() = 0; virtual std::shared_ptr CreateRpcController() = 0; - virtual std::shared_ptr cpu_executor() = 0; - virtual std::shared_ptr io_executor() = 0; - virtual std::shared_ptr retry_executor() = 0; + virtual std::shared_ptr cpu_executor() = 0; + virtual std::shared_ptr io_executor() = 0; + virtual std::shared_ptr retry_executor() = 0; virtual void Close() = 0; }; @@ -84,9 +84,9 @@ class AsyncConnectionImpl : public AsyncConnection, std::shared_ptr CreateRpcController() override { return std::make_shared(); } - std::shared_ptr cpu_executor() override { return cpu_executor_; } - std::shared_ptr io_executor() override { return io_executor_; } - std::shared_ptr retry_executor() override { + std::shared_ptr cpu_executor() override { return cpu_executor_; } + std::shared_ptr io_executor() override { return io_executor_; } + std::shared_ptr retry_executor() override { return retry_executor_; } @@ -107,9 +107,9 @@ class AsyncConnectionImpl : public AsyncConnection, std::shared_ptr connection_conf_; std::shared_ptr caller_factory_; std::shared_ptr retry_timer_; - std::shared_ptr cpu_executor_; - std::shared_ptr io_executor_; - std::shared_ptr retry_executor_; + std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr retry_executor_; std::shared_ptr location_cache_; std::shared_ptr rpc_client_; bool is_closed_ = false; diff --git a/include/hbase/client/async-rpc-retrying-caller-factory.h b/include/hbase/client/async-rpc-retrying-caller-factory.h index 2cc94f4..1277681 100644 --- a/include/hbase/client/async-rpc-retrying-caller-factory.h +++ b/include/hbase/client/async-rpc-retrying-caller-factory.h @@ -18,7 +18,6 @@ */ #pragma once -#include #include #include #include diff --git a/include/hbase/client/async-scan-rpc-retrying-caller.h b/include/hbase/client/async-scan-rpc-retrying-caller.h index 332d5bd..ee18968 100644 --- a/include/hbase/client/async-scan-rpc-retrying-caller.h +++ b/include/hbase/client/async-scan-rpc-retrying-caller.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/include/hbase/client/async-table-result-scanner.h b/include/hbase/client/async-table-result-scanner.h index d67ab3f..6cdd8b4 100644 --- a/include/hbase/client/async-table-result-scanner.h +++ b/include/hbase/client/async-table-result-scanner.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/hbase/client/configuration.h b/include/hbase/client/configuration.h index 06f9c79..d851263 100644 --- a/include/hbase/client/configuration.h +++ b/include/hbase/client/configuration.h @@ -28,8 +28,6 @@ namespace hbase { -template -using optional = boost::optional; class Configuration { public: @@ -160,44 +158,44 @@ class Configuration { * SubstituteVars will be called for any variable expansion. * @param key Key whose value is to be fetched. */ - optional Get(const std::string &key) const; + std::optional Get(const std::string &key) const; /** - * @brief returns optional int32_t value identified by the key in ConfigMap. + * @brief returns std::optional int32_t value identified by the key in ConfigMap. * Get(key) is called to get the string value which is then converted to * int32_t using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to int32_t fails */ - optional GetInt(const std::string &key) const; + std::optional GetInt(const std::string &key) const; /** - * @brief returns optional int64_t value identified by the key in ConfigMap. + * @brief returns std::optional int64_t value identified by the key in ConfigMap. * Get(key) is called internally to get the string value which is then * converted to int64_t using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to int64_t fails */ - optional GetLong(const std::string &key) const; + std::optional GetLong(const std::string &key) const; /** - * @brief returns optional double value identified by the key in ConfigMap. + * @brief returns std::optional double value identified by the key in ConfigMap. * Get(key) is called to get the string value which is then converted to * double using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to double fails */ - optional GetDouble(const std::string &key) const; + std::optional GetDouble(const std::string &key) const; /** - * @brief returns optional bool for a property identified by key in ConfigMap. + * @brief returns std::optional bool for a property identified by key in ConfigMap. * Get(key) is called to get the string value which is then converted to bool * by checking the validity. * @param key Key whose value is to be fetched. Get(key) is called to get the * string value which is then converted to bool. * @throws std::runtime_error if conversion to bool fails */ - optional GetBool(const std::string &key) const; + std::optional GetBool(const std::string &key) const; /** * @brief This method will perform any variable expansion if present. @@ -221,12 +219,12 @@ class Configuration { * @brief This method will fetch value for key from environment if present. * @param key key to be fetched from environment. */ - optional GetEnv(const std::string &key) const; + std::optional GetEnv(const std::string &key) const; /** * @brief This method will fetch value for key from ConfigMap if present. * @param key key to be fetched from environment. */ - optional GetProperty(const std::string &key) const; + std::optional GetProperty(const std::string &key) const; }; } /* namespace hbase */ diff --git a/include/hbase/client/hbase-configuration-loader.h b/include/hbase/client/hbase-configuration-loader.h index d46217d..7a070ed 100644 --- a/include/hbase/client/hbase-configuration-loader.h +++ b/include/hbase/client/hbase-configuration-loader.h @@ -132,7 +132,7 @@ class HBaseConfigurationLoader { * @param final_text value of final node true or false if present */ bool UpdateMapWithValue(ConfigMap &map, const std::string &key, const std::string &value, - boost::optional final_text); + std::optional final_text); }; } /* namespace hbase */ diff --git a/include/hbase/client/location-cache.h b/include/hbase/client/location-cache.h index a800642..7b6b22c 100644 --- a/include/hbase/client/location-cache.h +++ b/include/hbase/client/location-cache.h @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -88,8 +88,8 @@ class LocationCache : public AsyncRegionLocator { * @param io_executor executor used to talk to the network */ LocationCache(std::shared_ptr conf, - std::shared_ptr io_executor, - std::shared_ptr cpu_executor, + std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr cp); /** * Destructor. @@ -202,8 +202,8 @@ class LocationCache : public AsyncRegionLocator { /* data */ std::shared_ptr conf_; std::string zk_quorum_; - std::shared_ptr io_executor_; - std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr cpu_executor_; std::shared_ptr> meta_promise_; std::recursive_mutex meta_lock_; MetaUtil meta_util_; diff --git a/include/hbase/client/raw-scan-result-consumer.h b/include/hbase/client/raw-scan-result-consumer.h index ad0cbe3..edbb0c7 100644 --- a/include/hbase/client/raw-scan-result-consumer.h +++ b/include/hbase/client/raw-scan-result-consumer.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/include/hbase/client/request-converter.h b/include/hbase/client/request-converter.h index 9c671c8..e80625b 100644 --- a/include/hbase/client/request-converter.h +++ b/include/hbase/client/request-converter.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "hbase/connection/request.h" #include "hbase/client/action.h" #include "hbase/client/append.h" diff --git a/include/hbase/client/scan-result-cache.h b/include/hbase/client/scan-result-cache.h index 8b1bc11..27a303a 100644 --- a/include/hbase/client/scan-result-cache.h +++ b/include/hbase/client/scan-result-cache.h @@ -18,7 +18,7 @@ */ #pragma once -#include +#include #include #include #include diff --git a/include/hbase/connection/client-dispatcher.h b/include/hbase/connection/client-dispatcher.h index 33384a7..097478f 100644 --- a/include/hbase/connection/client-dispatcher.h +++ b/include/hbase/connection/client-dispatcher.h @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include diff --git a/include/hbase/connection/connection-factory.h b/include/hbase/connection/connection-factory.h index 14b7fda..02eb303 100644 --- a/include/hbase/connection/connection-factory.h +++ b/include/hbase/connection/connection-factory.h @@ -18,8 +18,8 @@ */ #pragma once -#include -#include +#include +#include #include #include @@ -46,8 +46,8 @@ class ConnectionFactory { * Constructor. * There should only be one ConnectionFactory per client. */ - ConnectionFactory(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, + ConnectionFactory(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, std::chrono::nanoseconds connect_timeout = std::chrono::nanoseconds(0)); @@ -69,15 +69,15 @@ class ConnectionFactory { std::shared_ptr> client_bootstrap, const std::string &hostname, uint16_t port); - std::shared_ptr io_executor() { return io_executor_; } + std::shared_ptr io_executor() { return io_executor_; } - std::shared_ptr cpu_executor() { return cpu_executor_; } + std::shared_ptr cpu_executor() { return cpu_executor_; } private: std::chrono::nanoseconds connect_timeout_; std::shared_ptr conf_; - std::shared_ptr io_executor_; - std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr cpu_executor_; std::shared_ptr pipeline_factory_; }; } // namespace hbase diff --git a/include/hbase/connection/connection-pool.h b/include/hbase/connection/connection-pool.h index 1198c33..ccabde7 100644 --- a/include/hbase/connection/connection-pool.h +++ b/include/hbase/connection/connection-pool.h @@ -42,8 +42,8 @@ namespace hbase { class ConnectionPool { public: /** Create connection pool wit default connection factory */ - ConnectionPool(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, + ConnectionPool(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, std::chrono::nanoseconds connect_timeout = std::chrono::nanoseconds(0)); diff --git a/include/hbase/connection/rpc-client.h b/include/hbase/connection/rpc-client.h index 1189410..2b4a921 100644 --- a/include/hbase/connection/rpc-client.h +++ b/include/hbase/connection/rpc-client.h @@ -36,8 +36,8 @@ namespace hbase { class RpcClient { public: - RpcClient(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, + RpcClient(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, std::chrono::nanoseconds connect_timeout = std::chrono::nanoseconds(0)); @@ -77,7 +77,7 @@ class RpcClient { private: std::shared_ptr cp_; - std::shared_ptr io_executor_; + std::shared_ptr io_executor_; std::shared_ptr conf_; }; } // namespace hbase diff --git a/include/hbase/connection/rpc-connection.h b/include/hbase/connection/rpc-connection.h index cbbac63..6c15b14 100644 --- a/include/hbase/connection/rpc-connection.h +++ b/include/hbase/connection/rpc-connection.h @@ -69,8 +69,8 @@ class RpcConnection : public std::enable_shared_from_this { private: std::recursive_mutex mutex_; - std::shared_ptr io_executor_; - std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr cpu_executor_; std::shared_ptr connection_id_; std::shared_ptr hbase_service_; std::shared_ptr cf_; diff --git a/include/hbase/connection/rpc-test-server.h b/include/hbase/connection/rpc-test-server.h index 76ab8ba..c9a6a8a 100644 --- a/include/hbase/connection/rpc-test-server.h +++ b/include/hbase/connection/rpc-test-server.h @@ -18,7 +18,7 @@ */ #pragma once #include -#include +#include #include #include diff --git a/include/hbase/utils/optional.h b/include/hbase/utils/optional.h index c43fd56..9e5102f 100644 --- a/include/hbase/utils/optional.h +++ b/include/hbase/utils/optional.h @@ -18,8 +18,7 @@ */ #pragma once - -#include +#include #include namespace hbase { @@ -28,7 +27,7 @@ namespace hbase { * An optional value that may or may not be present. */ template -using optional = boost::optional; +using optional = std::optional; const boost::none_t none = boost::none; diff --git a/src/hbase/client/async-batch-rpc-retrying-caller.cc b/src/hbase/client/async-batch-rpc-retrying-caller.cc index 6699b90..71b819d 100644 --- a/src/hbase/client/async-batch-rpc-retrying-caller.cc +++ b/src/hbase/client/async-batch-rpc-retrying-caller.cc @@ -70,7 +70,8 @@ AsyncBatchRpcRetryingCaller::~AsyncBatchRpcRetryingCaller() {} template Future>> AsyncBatchRpcRetryingCaller::Call() { GroupAndSend(actions_, 1); - return collectAll(action2futures_); + // use the executor to convert he SemiFuture to a Future. + return std::move(collectAll(action2futures_)).via(cpu_pool_.get()); } template @@ -239,7 +240,7 @@ AsyncBatchRpcRetryingCaller::GetRegionLocations( RegionLocateType::kCurrent, locate_timeout_ns)); } - return collectAll(locs); + return std::move(collectAll(locs)).via(cpu_pool_.get()); } template @@ -257,7 +258,7 @@ void AsyncBatchRpcRetryingCaller::GroupAndSend( } GetRegionLocations(actions, locate_timeout_ns) - .then([=](std::vector>> &loc) { + .thenValue([&](std::vector>> loc) { std::lock_guard lck(multi_mutex_); ActionsByServer actions_by_server; std::vector> locate_failed; @@ -305,7 +306,7 @@ void AsyncBatchRpcRetryingCaller::GroupAndSend( TryResubmit(locate_failed, tries); } }) - .onError([=](const folly::exception_wrapper &ew) { + .thenError(folly::tag_t{},[&](const folly::exception_wrapper &ew) { VLOG(1) << "GetRegionLocations() exception: " << ew.what().toStdString() << "tries: " << tries << "; max_attempts_: " << max_attempts_; std::lock_guard lck(multi_mutex_); @@ -331,7 +332,7 @@ AsyncBatchRpcRetryingCaller::GetMultiResponse(const ActionsByServer & multi_calls.push_back( rpc_client_->AsyncCall(host, port, std::move(multi_req), user, "ClientService")); } - return collectAll(multi_calls); + return std::move(collectAll(multi_calls)).via(cpu_pool_.get()); } template @@ -362,7 +363,7 @@ void AsyncBatchRpcRetryingCaller::Send(const ActionsByServer &actions std::move(RequestConverter::ToMultiRequest(action_by_server.second->actions_by_region()))); GetMultiResponse(actions_by_server) - .then([=](const std::vector>> &completed_responses) { + .thenValue([&](const std::vector>> &completed_responses) { std::lock_guard lck(multi_mutex_); uint64_t num = 0; for (const auto &action_by_server : actions_by_server) { @@ -382,7 +383,7 @@ void AsyncBatchRpcRetryingCaller::Send(const ActionsByServer &actions num++; } }) - .onError([=](const folly::exception_wrapper &ew) { + .thenError(folly::tag_t{},[&](const folly::exception_wrapper &ew) { VLOG(1) << "GetMultiResponse() exception: " << ew.what().toStdString(); std::lock_guard lck(multi_mutex_); for (const auto &action_by_server : actions_by_server) { diff --git a/src/hbase/client/async-client-scanner.cc b/src/hbase/client/async-client-scanner.cc index 50c01ee..5785e2a 100644 --- a/src/hbase/client/async-client-scanner.cc +++ b/src/hbase/client/async-client-scanner.cc @@ -59,7 +59,7 @@ folly::Future> AsyncClientScanner::CallOpen return rpc_client ->AsyncCall(loc->server_name().host_name(), loc->server_name().port(), std::move(preq), security::User::defaultUser(), "ClientService") - .then([self, loc, controller, rpc_client](const std::unique_ptr& presp) { + .thenValue([self, loc, controller, rpc_client](const std::unique_ptr& presp) { VLOG(5) << "Scan Response:" << presp->DebugString(); return std::make_shared(rpc_client, presp, loc, controller); }); @@ -88,16 +88,16 @@ void AsyncClientScanner::OpenScanner() { ->Build(); caller->Call() - .then([this, self](std::shared_ptr resp) { + .thenValue([this, self](std::shared_ptr resp) { VLOG(3) << "Opened scanner with id:" << resp->scan_resp_->scanner_id() << ", region:" << resp->region_location_->DebugString() << ", starting scan"; StartScan(resp); }) - .onError([this, self](const folly::exception_wrapper& e) { + .thenError(folly::tag_t{},[this,self](const folly::exception_wrapper &e) { VLOG(3) << "Open scan request received error:" << e.what(); consumer_->OnError(e); }) - .then([caller, self](const auto r) { return r; }); + .thenValue([caller, self](const auto r) { return r; }); } void AsyncClientScanner::StartScan(std::shared_ptr resp) { @@ -119,7 +119,7 @@ void AsyncClientScanner::StartScan(std::shared_ptr resp) { ->Build(); caller->Start(resp->controller_, resp->scan_resp_, resp->cell_scanner_) - .then([caller, self](const bool has_more) { + .thenValue([caller, self](const bool has_more) { if (has_more) { // open the next scanner on the next region. self->OpenScanner(); @@ -127,8 +127,8 @@ void AsyncClientScanner::StartScan(std::shared_ptr resp) { self->consumer_->OnComplete(); } }) - .onError([caller, self](const folly::exception_wrapper& e) { self->consumer_->OnError(e); }) - .then([caller, self](const auto r) { return r; }); + .thenError(folly::tag_t{},[caller, self](const folly::exception_wrapper& e) { self->consumer_->OnError(e); }) + .thenValue([caller, self](const auto r) { return r; }); } RegionLocateType AsyncClientScanner::GetLocateType(const Scan& scan) { diff --git a/src/hbase/client/async-connection.cc b/src/hbase/client/async-connection.cc index f1bdebc..84456fe 100644 --- a/src/hbase/client/async-connection.cc +++ b/src/hbase/client/async-connection.cc @@ -27,14 +27,14 @@ void AsyncConnectionImpl::Init() { // start thread pools auto io_threads = conf_->GetInt(kClientIoThreadPoolSize, sysconf(_SC_NPROCESSORS_ONLN)); auto cpu_threads = conf_->GetInt(kClientCpuThreadPoolSize, 2 * sysconf(_SC_NPROCESSORS_ONLN)); - cpu_executor_ = std::make_shared(cpu_threads); - io_executor_ = std::make_shared(io_threads); + cpu_executor_ = std::make_shared(cpu_threads); + io_executor_ = std::make_shared(io_threads); /* * We need a retry_executor for a thread pool of size 1 due to a possible bug in wangle/folly. * Otherwise, Assertion 'isInEventBaseThread()' always fails. See the comments * in async-rpc-retrying-caller.cc. */ - retry_executor_ = std::make_shared(1); + retry_executor_ = std::make_shared(1); retry_timer_ = folly::HHWheelTimer::newTimer(retry_executor_->getEventBase()); std::shared_ptr codec = nullptr; diff --git a/src/hbase/client/async-rpc-retrying-caller.cc b/src/hbase/client/async-rpc-retrying-caller.cc index 35cb08e..8c9c8e4 100644 --- a/src/hbase/client/async-rpc-retrying-caller.cc +++ b/src/hbase/client/async-rpc-retrying-caller.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include "hbase/connection/rpc-client.h" @@ -91,8 +91,8 @@ void AsyncSingleRequestRpcRetryingCaller::LocateThenCall() { conn_->region_locator() ->LocateRegion(*table_name_, row_, locate_type_, locate_timeout_ns) - .then([this](std::shared_ptr loc) { Call(*loc); }) - .onError([this](const exception_wrapper& e) { + .thenValue([this](std::shared_ptr loc) { Call(*loc); }) + .thenError(folly::tag_t{},[this](const exception_wrapper& e) { OnError(e, [this, e]() -> std::string { return "Locate '" + row_ + "' in " + table_name_->namespace_() + "::" + @@ -179,8 +179,8 @@ void AsyncSingleRequestRpcRetryingCaller::Call(const RegionLocation& loc) // Otherwise, it may get deleted underneat us. We are just copying for now. auto loc_ptr = std::make_shared(loc); callable_(controller_, loc_ptr, rpc_client) - .then([loc_ptr, this](const RESP& resp) { this->promise_->setValue(std::move(resp)); }) - .onError([&, loc_ptr, this](const exception_wrapper& e) { + .thenValue([loc_ptr, this](const RESP& resp) { this->promise_->setValue(std::move(resp)); }) + .thenError(folly::tag_t{},[&, loc_ptr, this](const exception_wrapper& e) { OnError( e, [&, this, e]() -> std::string { diff --git a/src/hbase/client/async-scan-rpc-retrying-caller.cc b/src/hbase/client/async-scan-rpc-retrying-caller.cc index 2189128..19fd19a 100644 --- a/src/hbase/client/async-scan-rpc-retrying-caller.cc +++ b/src/hbase/client/async-scan-rpc-retrying-caller.cc @@ -407,11 +407,11 @@ void AsyncScanRpcRetryingCaller::Call() { region_location_->server_name().port(), std::move(req), security::User::defaultUser(), "ClientService") .via(conn_->cpu_executor().get()) - .then([self, this](const std::unique_ptr& resp) { + .thenValue([self, this](const std::unique_ptr& resp) { auto scan_resp = std::static_pointer_cast(resp->resp_msg()); return OnComplete(controller_, scan_resp, resp->cell_scanner()); }) - .onError([self, this](const folly::exception_wrapper& e) { OnError(e); }); + .thenError(folly::tag_t{},[self, this](const folly::exception_wrapper& e) { OnError(e); }); } void AsyncScanRpcRetryingCaller::CloseScanner() { @@ -426,7 +426,7 @@ void AsyncScanRpcRetryingCaller::CloseScanner() { ->AsyncCall(region_location_->server_name().host_name(), region_location_->server_name().port(), std::move(req), security::User::defaultUser(), "ClientService") - .onError([self, this](const folly::exception_wrapper& e) -> std::unique_ptr { + .thenError(folly::tag_t{},[self, this](const folly::exception_wrapper& e) -> std::unique_ptr { LOG(WARNING) << "Call to " + region_location_->server_name().ShortDebugString() + " for closing scanner_id = " + folly::to(scanner_id_) + " for " + region_location_->region_info().ShortDebugString() + diff --git a/src/hbase/client/configuration.cc b/src/hbase/client/configuration.cc index 385ea6a..01ec248 100644 --- a/src/hbase/client/configuration.cc +++ b/src/hbase/client/configuration.cc @@ -23,9 +23,9 @@ #include #include +#include #include #include -#include namespace hbase { @@ -89,28 +89,28 @@ std::string Configuration::SubstituteVars(const std::string &expr) const { } } -optional Configuration::GetEnv(const std::string &key) const { +std::optional Configuration::GetEnv(const std::string &key) const { char buf[2048]; if ("user.name" == key) { #ifdef HAVE_GETLOGIN - return getlogin(); + return std::make_optional(getlogin()); #else DLOG(WARNING) << "Client user.name not implemented"; - return none; + return std::optional(); #endif } if ("user.dir" == key) { #ifdef HAVE_GETCWD if (getcwd(buf, sizeof(buf))) { - return buf; + return std::make_optional(buf); } else { - return none; + return std::optional(); } #else DLOG(WARNING) << "Client user.dir not implemented"; - return none; + return std::optional(); #endif } @@ -118,33 +118,33 @@ optional Configuration::GetEnv(const std::string &key) const { #if defined(HAVE_GETUID) && defined(HAVE_GETPWUID_R) uid = getuid(); if (!getpwuid_r(uid, &pw, buf, sizeof(buf), &pwp)) { - return buf; + return std::make_optional(buf); } else { - return none; + return std::optional(); } #else DLOG(WARNING) << "Client user.home not implemented"; - return none; + return std::optional(); #endif } - return none; + return std::optional(); } -optional Configuration::GetProperty(const std::string &key) const { +std::optional Configuration::GetProperty(const std::string &key) const { auto found = hb_property_.find(key); if (found != hb_property_.end()) { - return found->second.value; + return std::make_optional(found->second.value); } else { - return none; + return std::optional(); } } -optional Configuration::Get(const std::string &key) const { - optional raw = GetProperty(key); +std::optional Configuration::Get(const std::string &key) const { + std::optional raw = GetProperty(key); if (raw) { - return SubstituteVars(*raw); + return std::make_optional(SubstituteVars(*raw)); } else { - return none; + return std::optional(); } } @@ -152,61 +152,61 @@ std::string Configuration::Get(const std::string &key, const std::string &defaul return Get(key).value_or(default_value); } -optional Configuration::GetInt(const std::string &key) const { - optional raw = Get(key); +std::optional Configuration::GetInt(const std::string &key) const { + std::optional raw = Get(key); if (raw) { try { - return boost::lexical_cast(*raw); + return std::make_optional(boost::lexical_cast(*raw)); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return none; + return std::optional(); } int32_t Configuration::GetInt(const std::string &key, int32_t default_value) const { return GetInt(key).value_or(default_value); } -optional Configuration::GetLong(const std::string &key) const { - optional raw = Get(key); +std::optional Configuration::GetLong(const std::string &key) const { + std::optional raw = Get(key); if (raw) { try { - return boost::lexical_cast(*raw); + return std::make_optional(boost::lexical_cast(*raw)); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return none; + return std::optional(); } int64_t Configuration::GetLong(const std::string &key, int64_t default_value) const { return GetLong(key).value_or(default_value); } -optional Configuration::GetDouble(const std::string &key) const { - optional raw = Get(key); +std::optional Configuration::GetDouble(const std::string &key) const { + std::optional raw = Get(key); if (raw) { try { - return boost::lexical_cast(*raw); + return std::make_optional(boost::lexical_cast(*raw)); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return none; + return std::optional(); } double Configuration::GetDouble(const std::string &key, double default_value) const { return GetDouble(key).value_or(default_value); } -optional Configuration::GetBool(const std::string &key) const { - optional raw = Get(key); +std::optional Configuration::GetBool(const std::string &key) const { + std::optional raw = Get(key); if (raw) { if (!strcasecmp((*raw).c_str(), "true") || !strcasecmp((*raw).c_str(), "1")) { - return true; + return std::make_optional(true); } else if (!strcasecmp((*raw).c_str(), "false") || !strcasecmp((*raw).c_str(), "0")) { - return false; + return std::make_optional(false); } else { boost::format what("Unexpected value \"%s\" found being converted to bool for key \"%s\""); what % (*raw); @@ -214,7 +214,7 @@ optional Configuration::GetBool(const std::string &key) const { throw std::runtime_error(what.str()); } } - return none; + return std::optional(); } bool Configuration::GetBool(const std::string &key, bool default_value) const { diff --git a/src/hbase/client/hbase-configuration-loader.cc b/src/hbase/client/hbase-configuration-loader.cc index 2233794..a5b8249 100644 --- a/src/hbase/client/hbase-configuration-loader.cc +++ b/src/hbase/client/hbase-configuration-loader.cc @@ -125,9 +125,9 @@ optional HBaseConfigurationLoader::LoadDefaultResources() { } } if (success) { - return Configuration(conf_property); + return std::make_optional(Configuration(conf_property)); } else { - return none; + return optional(); } } @@ -149,9 +149,9 @@ optional HBaseConfigurationLoader::LoadResources( } } if (success) { - return Configuration(conf_property); + return std::make_optional(Configuration(conf_property)); } else { - return none; + return optional(); } } @@ -174,8 +174,11 @@ bool HBaseConfigurationLoader::LoadProperties(const std::string &file, ConfigMap std::string name_node = v.second.get("name"); std::string value_node = v.second.get("value"); if ((name_node.size() > 0) && (value_node.size() > 0)) { - boost::optional final_node = v.second.get_optional("final"); - UpdateMapWithValue(property_map, name_node, value_node, final_node); + auto final_node = v.second.get_optional("final"); + // since we're converting from boost::optional to std::optional we'll make a check + // as boost asserts initialization. + auto finalopt = final_node.is_initialized() ? std::make_optional(final_node.get()) : std::optional(); + UpdateMapWithValue(property_map, name_node, value_node, finalopt); } } } @@ -188,16 +191,16 @@ bool HBaseConfigurationLoader::LoadProperties(const std::string &file, ConfigMap bool HBaseConfigurationLoader::UpdateMapWithValue(ConfigMap &map, const std::string &key, const std::string &value, - boost::optional final_text) { + std::optional final_text) { auto map_value = map.find(key); if (map_value != map.end() && map_value->second.final) { return false; } bool final_value = false; - if (nullptr != final_text.get_ptr()) { - if (is_valid_bool(final_text.get())) { - final_value = str_to_bool(final_text.get()); + if (final_text) { + if (is_valid_bool(final_text.value())) { + final_value = str_to_bool(final_text.value()); } } diff --git a/src/hbase/client/location-cache.cc b/src/hbase/client/location-cache.cc index cf1d8ef..4fe73ef 100644 --- a/src/hbase/client/location-cache.cc +++ b/src/hbase/client/location-cache.cc @@ -19,10 +19,10 @@ #include "hbase/client/location-cache.h" #include -#include +#include #include -#include -#include +#include +#include #include #include @@ -45,8 +45,8 @@ using hbase::pb::TableName; namespace hbase { LocationCache::LocationCache(std::shared_ptr conf, - std::shared_ptr io_executor, - std::shared_ptr cpu_executor, + std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr cp) : conf_(conf), io_executor_(io_executor), @@ -85,7 +85,7 @@ folly::Future LocationCache::LocateMeta() { if (meta_promise_ == nullptr) { this->RefreshMetaLocation(); } - return meta_promise_->getFuture().onError([&](const folly::exception_wrapper &ew) { + return meta_promise_->getFuture().thenError(folly::tag_t{},[&](const folly::exception_wrapper &ew) { auto promise = InvalidateMeta(); if (promise) { promise->setException(ew); @@ -149,25 +149,25 @@ folly::Future> LocationCache::LocateFromMeta( const TableName &tn, const std::string &row) { return this->LocateMeta() .via(cpu_executor_.get()) - .then([this](ServerName sn) { + .thenValue([this](ServerName sn) { // TODO: use RpcClient? auto remote_id = std::make_shared(sn.host_name(), sn.port()); return this->cp_->GetConnection(remote_id); }) - .then([tn, row, this](std::shared_ptr rpc_connection) { + .thenValue([tn, row, this](std::shared_ptr rpc_connection) { return rpc_connection->SendRequest(std::move(meta_util_.MetaRequest(tn, row))); }) - .onError([&](const folly::exception_wrapper &ew) { + .thenError(folly::tag_t{},[&](const folly::exception_wrapper &ew) { auto promise = InvalidateMeta(); throw ew; return static_cast>(nullptr); }) - .then([tn, this](std::unique_ptr resp) { + .thenValue([tn, this](std::unique_ptr resp) { // take the protobuf response and make it into // a region location. return meta_util_.CreateLocation(std::move(*resp), tn); }) - .then([tn, this](std::shared_ptr rl) { + .thenValue([tn, this](std::shared_ptr rl) { // Make sure that the correct location was found. if (rl->region_info().table_name().namespace_() != tn.namespace_() || rl->region_info().table_name().qualifier() != tn.qualifier()) { @@ -175,12 +175,12 @@ folly::Future> LocationCache::LocateFromMeta( } return rl; }) - .then([this](std::shared_ptr rl) { + .thenValue([this](std::shared_ptr rl) { auto remote_id = std::make_shared(rl->server_name().host_name(), rl->server_name().port()); return rl; }) - .then([tn, this](std::shared_ptr rl) { + .thenValue([tn, this](std::shared_ptr rl) { // now add fetched location to the cache. this->CacheLocation(tn, rl); return rl; @@ -194,7 +194,7 @@ folly::Future> LocationCache::LocateRegion( const int64_t locate_ns) { // We maybe asked to locate meta itself if (MetaUtil::IsMeta(tn)) { - return LocateMeta().then([this](const ServerName &server_name) { + return LocateMeta().thenValue([this](const ServerName &server_name) { auto rl = std::make_shared(MetaUtil::kMetaRegionName, meta_util_.meta_region_info(), server_name); return rl; diff --git a/src/hbase/client/meta-utils.cc b/src/hbase/client/meta-utils.cc index 4a3727d..a74b4fa 100644 --- a/src/hbase/client/meta-utils.cc +++ b/src/hbase/client/meta-utils.cc @@ -66,7 +66,7 @@ std::unique_ptr MetaUtil::MetaRequest(const TableName tn, const std::st // Set the region this scan goes to auto region = msg->mutable_region(); - region->set_value(MetaUtil::kMetaRegionName); + region->set_value(MetaUtil::kMetaRegion); region->set_type( RegionSpecifier_RegionSpecifierType::RegionSpecifier_RegionSpecifierType_ENCODED_REGION_NAME); diff --git a/src/hbase/client/raw-async-table.cc b/src/hbase/client/raw-async-table.cc index f017e86..d19dee2 100644 --- a/src/hbase/client/raw-async-table.cc +++ b/src/hbase/client/raw-async-table.cc @@ -53,7 +53,7 @@ folly::Future RawAsyncTable::Call( return rpc_client ->AsyncCall(loc->server_name().host_name(), loc->server_name().port(), std::move(preq), User::defaultUser(), "ClientService") - .then( + .thenValue( [resp_converter](const std::unique_ptr& presp) { return resp_converter(*presp); }); } @@ -76,7 +76,7 @@ folly::Future> RawAsyncTable::Get(const hbase::Get& get) // context and get deallocated since the caller injects a lot of closures which capture [this, &] // which is use-after-free. We are just passing an identity closure capturing caller by value to // ensure that the lifecycle of the Caller object is longer than the retry lambdas. - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future> RawAsyncTable::Increment(const hbase::Increment& incr) { auto caller = @@ -93,7 +93,7 @@ folly::Future> RawAsyncTable::Increment(const hbase::Inc }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future RawAsyncTable::Put(const hbase::Put& put) { @@ -109,7 +109,7 @@ folly::Future RawAsyncTable::Put(const hbase::Put& put) { }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future RawAsyncTable::CheckAndPut(const std::string& row, const std::string& family, @@ -135,7 +135,7 @@ folly::Future RawAsyncTable::CheckAndPut(const std::string& row, const std }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future RawAsyncTable::CheckAndDelete(const std::string& row, const std::string& family, @@ -162,7 +162,7 @@ folly::Future RawAsyncTable::CheckAndDelete(const std::string& row, const }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future RawAsyncTable::Delete(const hbase::Delete& del) { @@ -178,7 +178,7 @@ folly::Future RawAsyncTable::Delete(const hbase::Delete& del) { }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future> RawAsyncTable::Append(const hbase::Append& append) { @@ -196,7 +196,7 @@ folly::Future> RawAsyncTable::Append(const hbase::Append }) ->Build(); - return caller->Call().then([caller](const auto r) { return r; }); + return caller->Call().thenValue([caller](const auto r) { return r; }); } folly::Future>>> RawAsyncTable::Get( @@ -224,7 +224,7 @@ folly::Future>> RawAsyncTable::Batch( ->start_log_errors_count(connection_conf_->start_log_errors_count()) ->Build(); - return caller->Call().then([caller](auto r) { return r; }); + return caller->Call().thenValue([caller](auto r) { return r; }); } void RawAsyncTable::Scan(const hbase::Scan& scan, std::shared_ptr consumer) { diff --git a/src/hbase/client/table.cc b/src/hbase/client/table.cc index 0daf4a3..0066d5e 100644 --- a/src/hbase/client/table.cc +++ b/src/hbase/client/table.cc @@ -49,8 +49,7 @@ Table::Table(const TableName &table_name, std::shared_ptr async Table::~Table() {} std::shared_ptr Table::Get(const hbase::Get &get) { - auto context = async_table_->Get(get); - return context.get(operation_timeout()); + return async_table_->Get(get).get(operation_timeout()); } std::shared_ptr Table::Scan(const hbase::Scan &scan) { @@ -69,37 +68,31 @@ int64_t Table::ResultSize2CacheSize(int64_t max_results_size) const { } void Table::Put(const hbase::Put &put) { - auto future = async_table_->Put(put); - future.get(operation_timeout()); + async_table_->Put(put).get(operation_timeout()); } bool Table::CheckAndPut(const std::string &row, const std::string &family, const std::string &qualifier, const std::string &value, const hbase::Put &put, const pb::CompareType &compare_op) { - auto context = async_table_->CheckAndPut(row, family, qualifier, value, put, compare_op); - return context.get(operation_timeout()); + return async_table_->CheckAndPut(row, family, qualifier, value, put, compare_op).get(operation_timeout()); } bool Table::CheckAndDelete(const std::string &row, const std::string &family, const std::string &qualifier, const std::string &value, const hbase::Delete &del, const pb::CompareType &compare_op) { - auto context = async_table_->CheckAndDelete(row, family, qualifier, value, del, compare_op); - return context.get(operation_timeout()); + return async_table_->CheckAndDelete(row, family, qualifier, value, del, compare_op).get(operation_timeout()); } void Table::Delete(const hbase::Delete &del) { - auto future = async_table_->Delete(del); - future.get(operation_timeout()); + async_table_->Delete(del).get(operation_timeout()); } std::shared_ptr Table::Increment(const hbase::Increment &increment) { - auto context = async_table_->Increment(increment); - return context.get(operation_timeout()); + return async_table_->Increment(increment).get(operation_timeout()); } std::shared_ptr Table::Append(const hbase::Append &append) { - auto context = async_table_->Append(append); - return context.get(operation_timeout()); + return async_table_->Append(append).get(operation_timeout()); } milliseconds Table::operation_timeout() const { diff --git a/src/hbase/connection/connection-factory.cc b/src/hbase/connection/connection-factory.cc index 14ac22b..1eba197 100644 --- a/src/hbase/connection/connection-factory.cc +++ b/src/hbase/connection/connection-factory.cc @@ -39,8 +39,8 @@ using std::chrono::nanoseconds; namespace hbase { -ConnectionFactory::ConnectionFactory(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, +ConnectionFactory::ConnectionFactory(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, nanoseconds connect_timeout) @@ -67,14 +67,14 @@ std::shared_ptr ConnectionFactory::Connect( const std::string &hostname, uint16_t port) { // connection should happen from an IO thread try { - auto future = via(io_executor_.get()).then([=]() { + auto future = via(io_executor_.get()).thenValue([&](folly::Unit) { VLOG(1) << "Connecting to server: " << hostname << ":" << port; return client_bootstrap->connect(folly::SocketAddress(hostname, port, true), std::chrono::duration_cast(connect_timeout_)); }); // See about using shared promise for this. - auto pipeline = future.get(); + auto pipeline = std::move(future).get(); VLOG(1) << "Connected to server: " << hostname << ":" << port; auto dispatcher = diff --git a/src/hbase/connection/connection-pool.cc b/src/hbase/connection/connection-pool.cc index 92e87f8..69b1b4e 100644 --- a/src/hbase/connection/connection-pool.cc +++ b/src/hbase/connection/connection-pool.cc @@ -20,7 +20,7 @@ #include "hbase/connection/connection-pool.h" #include -#include +#include #include #include @@ -31,8 +31,8 @@ using std::chrono::nanoseconds; namespace hbase { -ConnectionPool::ConnectionPool(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, +ConnectionPool::ConnectionPool(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, nanoseconds connect_timeout) : cf_(std::make_shared(io_executor, cpu_executor, codec, conf, diff --git a/src/hbase/connection/pipeline.cc b/src/hbase/connection/pipeline.cc index 45ac0c0..329f4e3 100644 --- a/src/hbase/connection/pipeline.cc +++ b/src/hbase/connection/pipeline.cc @@ -18,7 +18,7 @@ */ #include "hbase/connection/pipeline.h" -#include +#include #include #include #include diff --git a/src/hbase/connection/rpc-client.cc b/src/hbase/connection/rpc-client.cc index d73829e..77ea895 100644 --- a/src/hbase/connection/rpc-client.cc +++ b/src/hbase/connection/rpc-client.cc @@ -20,10 +20,10 @@ #include "hbase/connection/rpc-client.h" #include -#include +#include #include #include -#include +#include #include "hbase/exceptions/exception.h" using hbase::security::User; @@ -31,8 +31,8 @@ using std::chrono::nanoseconds; namespace hbase { -RpcClient::RpcClient(std::shared_ptr io_executor, - std::shared_ptr cpu_executor, +RpcClient::RpcClient(std::shared_ptr io_executor, + std::shared_ptr cpu_executor, std::shared_ptr codec, std::shared_ptr conf, nanoseconds connect_timeout) : io_executor_(io_executor), conf_(conf) { @@ -83,7 +83,7 @@ folly::Future> RpcClient::SendRequest( try { return GetConnection(remote_id) ->SendRequest(std::move(req)) - .onError([&, this](const folly::exception_wrapper& ew) { + .thenError([&, this](const folly::exception_wrapper& ew) { VLOG(3) << folly::sformat("RpcClient Exception: {}", ew.what()); ew.with_exception([&, this](const hbase::ConnectionException& re) { /* bad connection, remove it from pool. */ diff --git a/src/hbase/connection/rpc-test-server.cc b/src/hbase/connection/rpc-test-server.cc index 0be06ed..61e1364 100644 --- a/src/hbase/connection/rpc-test-server.cc +++ b/src/hbase/connection/rpc-test-server.cc @@ -65,6 +65,8 @@ Future> RpcTestService::operator()(std::unique_ptrset_call_id(request->call_id()); std::string method_name = request->method(); + std::cout << "received " << method_name << std::endl; + if (method_name == "ping") { auto pb_resp_msg = std::make_shared(); response->set_resp_msg(pb_resp_msg); diff --git a/src/hbase/examples/load-client.cc b/src/hbase/examples/load-client.cc index a321845..4accc5a 100644 --- a/src/hbase/examples/load-client.cc +++ b/src/hbase/examples/load-client.cc @@ -17,7 +17,7 @@ * */ -#include +#include #include #include diff --git a/src/hbase/examples/simple-client.cc b/src/hbase/examples/simple-client.cc index 25f203a..f031820 100644 --- a/src/hbase/examples/simple-client.cc +++ b/src/hbase/examples/simple-client.cc @@ -17,7 +17,7 @@ * */ -#include +#include #include #include diff --git a/src/hbase/serde/rpc-serde.cc b/src/hbase/serde/rpc-serde.cc index b7d75f4..22b1fcf 100644 --- a/src/hbase/serde/rpc-serde.cc +++ b/src/hbase/serde/rpc-serde.cc @@ -18,7 +18,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/hbase/test-util/mini-cluster-util.cc b/src/hbase/test-util/mini-cluster-util.cc index 648c0c8..8444ff4 100644 --- a/src/hbase/test-util/mini-cluster-util.cc +++ b/src/hbase/test-util/mini-cluster-util.cc @@ -18,6 +18,7 @@ */ #include "hbase/test-util/mini-cluster-util.h" +#include #include #include diff --git a/src/hbase/test-util/mini-cluster.cc b/src/hbase/test-util/mini-cluster.cc index 6cdfafb..be0139c 100644 --- a/src/hbase/test-util/mini-cluster.cc +++ b/src/hbase/test-util/mini-cluster.cc @@ -238,7 +238,6 @@ jobject MiniCluster::CreateTable(const string &table, const vector &fami for (const auto& key : keys) { env_->SetObjectArrayElement(key_array, i++, StrToByteChar(key)); } - jobject tbl = env_->CallObjectMethod(htu_, create_table_with_split_mid_, table_name, family_array, key_array); return tbl; diff --git a/src/hbase/utils/user-util.cc b/src/hbase/utils/user-util.cc index ec8bb27..bf70be5 100644 --- a/src/hbase/utils/user-util.cc +++ b/src/hbase/utils/user-util.cc @@ -19,7 +19,7 @@ #include "hbase/utils/user-util.h" -#include +#include #include #include #include diff --git a/src/test/async-batch-rpc-retrying-test.cc b/src/test/async-batch-rpc-retrying-test.cc index 4608d74..fa4886a 100644 --- a/src/test/async-batch-rpc-retrying-test.cc +++ b/src/test/async-batch-rpc-retrying-test.cc @@ -17,12 +17,13 @@ * */ -#include +#include #include #include #include #include -#include +#include +#include #include #include @@ -204,9 +205,9 @@ class MockAsyncConnection : public AsyncConnection, public: MockAsyncConnection(std::shared_ptr conn_conf, std::shared_ptr retry_timer, - std::shared_ptr cpu_executor, - std::shared_ptr io_executor, - std::shared_ptr retry_executor, + std::shared_ptr cpu_executor, + std::shared_ptr io_executor, + std::shared_ptr retry_executor, std::shared_ptr rpc_client, std::shared_ptr region_locator) : conn_conf_(conn_conf), @@ -229,9 +230,9 @@ class MockAsyncConnection : public AsyncConnection, } std::shared_ptr rpc_client() override { return rpc_client_; } std::shared_ptr region_locator() override { return region_locator_; } - std::shared_ptr cpu_executor() override { return cpu_executor_; } - std::shared_ptr io_executor() override { return io_executor_; } - std::shared_ptr retry_executor() override { + std::shared_ptr cpu_executor() override { return cpu_executor_; } + std::shared_ptr io_executor() override { return io_executor_; } + std::shared_ptr retry_executor() override { return retry_executor_; } @@ -251,9 +252,9 @@ class MockAsyncConnection : public AsyncConnection, std::shared_ptr caller_factory_; std::shared_ptr rpc_client_; std::shared_ptr region_locator_; - std::shared_ptr cpu_executor_; - std::shared_ptr io_executor_; - std::shared_ptr retry_executor_; + std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr retry_executor_; }; class MockRawAsyncTableImpl { @@ -292,9 +293,9 @@ std::shared_ptr getAsyncConnection( Client &client, uint32_t operation_timeout_millis, uint32_t tries, std::shared_ptr region_locator) { /* init region location and rpc channel */ - auto cpu_executor_ = std::make_shared(4); + auto cpu_executor_ = std::make_shared(4); auto io_executor_ = client.async_connection()->io_executor(); - auto retry_executor_ = std::make_shared(1); + auto retry_executor_ = std::make_shared(1); auto codec = std::make_shared(); auto rpc_client = std::make_shared(io_executor_, cpu_executor_, codec, AsyncBatchRpcRetryTest::test_util->conf()); diff --git a/src/test/async-rpc-retrying-test.cc b/src/test/async-rpc-retrying-test.cc index 59fcd20..c7c6217 100644 --- a/src/test/async-rpc-retrying-test.cc +++ b/src/test/async-rpc-retrying-test.cc @@ -17,13 +17,13 @@ * */ -#include +#include #include #include #include #include #include -#include +#include #include #include @@ -183,9 +183,9 @@ class MockAsyncConnection : public AsyncConnection, public: MockAsyncConnection(std::shared_ptr conn_conf, std::shared_ptr retry_timer, - std::shared_ptr cpu_executor, - std::shared_ptr io_executor, - std::shared_ptr retry_executor, + std::shared_ptr cpu_executor, + std::shared_ptr io_executor, + std::shared_ptr retry_executor, std::shared_ptr rpc_client, std::shared_ptr region_locator) : conn_conf_(conn_conf), @@ -208,9 +208,9 @@ class MockAsyncConnection : public AsyncConnection, } std::shared_ptr rpc_client() override { return rpc_client_; } std::shared_ptr region_locator() override { return region_locator_; } - std::shared_ptr cpu_executor() override { return cpu_executor_; } - std::shared_ptr io_executor() override { return io_executor_; } - std::shared_ptr retry_executor() override { + std::shared_ptr cpu_executor() override { return cpu_executor_; } + std::shared_ptr io_executor() override { return io_executor_; } + std::shared_ptr retry_executor() override { return retry_executor_; } @@ -225,9 +225,9 @@ class MockAsyncConnection : public AsyncConnection, std::shared_ptr caller_factory_; std::shared_ptr rpc_client_; std::shared_ptr region_locator_; - std::shared_ptr cpu_executor_; - std::shared_ptr io_executor_; - std::shared_ptr retry_executor_; + std::shared_ptr cpu_executor_; + std::shared_ptr io_executor_; + std::shared_ptr retry_executor_; }; template @@ -269,12 +269,12 @@ class MockRawAsyncTableImpl { auto f = promise_->getFuture(); VLOG(1) << "calling rpc_call"; rpc_call(rpc_client, loc, controller, std::move(req_converter(req, loc->region_name()))) - .then([&, this, resp_converter](std::unique_ptr presp) { + .thenValue([&, this, resp_converter](std::unique_ptr presp) { VLOG(1) << "MockRawAsyncTableImpl#call succeded: "; RESP result = resp_converter(*presp); promise_->setValue(result); }) - .onError([this](const exception_wrapper &e) { + .thenError([this](const exception_wrapper &e) { VLOG(1) << "entering MockRawAsyncTableImpl#call, exception: " << e.what(); VLOG(1) << "entering MockRawAsyncTableImpl#call, error typeinfo: " << typeid(e).name(); promise_->setException(e); @@ -310,10 +310,10 @@ void runTest(std::shared_ptr region_locator, std::string /* init region location and rpc channel */ auto region_location = table->GetRegionLocation(row); - // auto io_executor_ = std::make_shared(4); - auto cpu_executor_ = std::make_shared(4); + // auto io_executor_ = std::make_shared(4); + auto cpu_executor_ = std::make_shared(4); auto io_executor_ = client.async_connection()->io_executor(); - auto retry_executor_ = std::make_shared(1); + auto retry_executor_ = std::make_shared(1); auto codec = std::make_shared(); auto rpc_client = std::make_shared(io_executor_, cpu_executor_, codec, AsyncRpcRetryTest::test_util->conf()); diff --git a/src/test/bytes-util-test.cc b/src/test/bytes-util-test.cc index 8997501..2ef07a6 100644 --- a/src/test/bytes-util-test.cc +++ b/src/test/bytes-util-test.cc @@ -17,7 +17,8 @@ * */ -#include +#include +#include #include #include "hbase/utils/bytes-util.h" diff --git a/src/test/client-test.cc b/src/test/client-test.cc index 282039c..ebdf585 100644 --- a/src/test/client-test.cc +++ b/src/test/client-test.cc @@ -207,7 +207,7 @@ TEST_F(ClientTest, PutGetDelete) { result = table->Get(get); ASSERT_TRUE(!result->IsEmpty()) << "Result shouldn't be empty."; ASSERT_FALSE(result->Value("d", "1")) << "Column 1 should be gone"; - ASSERT_TRUE(result->Value("d", "extra") != none) << "Column extra should have value"; + ASSERT_TRUE(result->Value("d", "extra")) << "Column extra should have value"; EXPECT_EQ(valExt, *(result->Value("d", "ext"))) << "Column ext should have value"; // delete all cells from "extra" column diff --git a/src/test/concurrent-map-test.cc b/src/test/concurrent-map-test.cc index b1733ad..2b44ef0 100644 --- a/src/test/concurrent-map-test.cc +++ b/src/test/concurrent-map-test.cc @@ -17,7 +17,8 @@ * */ -#include +#include +#include #include #include "hbase/test-util/test-util.h" diff --git a/src/test/connection-pool-test.cc b/src/test/connection-pool-test.cc index 5886a42..b97e7cf 100644 --- a/src/test/connection-pool-test.cc +++ b/src/test/connection-pool-test.cc @@ -17,7 +17,7 @@ * */ -#include +#include #include #include "hbase/connection/connection-factory.h" diff --git a/src/test/hbase-configuration-test.cc b/src/test/hbase-configuration-test.cc index a5760e8..2186095 100644 --- a/src/test/hbase-configuration-test.cc +++ b/src/test/hbase-configuration-test.cc @@ -150,7 +150,7 @@ TEST(Configuration, LoadConfFromDefaultLocation) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("custom-prop", "Set this value").c_str(), "custom-value"); EXPECT_STREQ((*conf).Get("default-prop", "Set this value").c_str(), "default-value"); } @@ -167,7 +167,7 @@ TEST(Configuration, LoadConfFromCustomLocation) { HBaseConfigurationLoader loader; std::vector resources{kHBaseSiteXml}; hbase::optional conf = loader.LoadResources(kHBaseConfPath, resources); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("custom-prop", "").c_str(), "custom-value"); EXPECT_STRNE((*conf).Get("custom-prop", "").c_str(), "some-value"); } @@ -188,7 +188,7 @@ TEST(Configuration, LoadConfFromMultipleLocatons) { std::string conf_paths = kDefHBaseConfPath + ":" + kHBaseConfPath; std::vector resources{kHBaseDefaultXml, kHBaseSiteXml}; hbase::optional conf = loader.LoadResources(conf_paths, resources); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("default-prop", "From hbase-default.xml").c_str(), "default-value"); EXPECT_STREQ((*conf).Get("custom-prop", "").c_str(), "custom-value"); EXPECT_STRNE((*conf).Get("custom-prop", "").c_str(), "some-value"); @@ -207,7 +207,7 @@ TEST(Configuration, DefaultValues) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("default-prop", "Set this value.").c_str(), "default-value"); EXPECT_STREQ((*conf).Get("custom-prop", "Set this value.").c_str(), "custom-value"); } @@ -219,7 +219,7 @@ TEST(Configuration, FinalValues) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("hbase.rootdir", "").c_str(), "/root/hbase-docker/apps/hbase/data"); EXPECT_STREQ((*conf).Get("hbase.zookeeper.property.datadir", "").c_str(), "/root/hbase-docker/zookeeper"); @@ -241,7 +241,7 @@ TEST(Configuration, EnvVars) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("hbase-client.user.name", "").c_str(), "${user.name}"); EXPECT_STRNE((*conf).Get("hbase-client.user.name", "root").c_str(), "test-user"); } @@ -253,7 +253,7 @@ TEST(Configuration, SelfRef) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("selfRef", "${selfRef}").c_str(), "${selfRef}"); } @@ -264,7 +264,7 @@ TEST(Configuration, VarExpansion) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_STREQ((*conf).Get("foo.substs", "foo-value").c_str(), "bar-value,bar-value,bar-value,bar-value,bar-value,bar-value," "bar-value,bar-value,bar-value,bar-value,"); @@ -278,7 +278,7 @@ TEST(Configuration, VarExpansionException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; ASSERT_THROW((*conf).Get("foo.substs.exception", "foo-value").c_str(), std::runtime_error); } @@ -289,7 +289,7 @@ TEST(Configuration, GetInt) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_EQ(16000, (*conf).GetInt("int", 0)); EXPECT_EQ(2147483646, (*conf).GetInt("int.largevalue", 0)); } @@ -301,7 +301,7 @@ TEST(Configuration, GetLong) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_EQ(2147483850, (*conf).GetLong("long", 0)); EXPECT_EQ(9223372036854775807, (*conf).GetLong("long.largevalue", 0)); } @@ -313,7 +313,7 @@ TEST(Configuration, GetDouble) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_DOUBLE_EQ(17.9769e+100, (*conf).GetDouble("double", 0.0)); EXPECT_DOUBLE_EQ(170.769e+200, (*conf).GetDouble("double.largevalue", 0.0)); } @@ -325,7 +325,7 @@ TEST(Configuration, GetBool) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; EXPECT_EQ(true, (*conf).GetBool("bool.true", true)); EXPECT_EQ(false, (*conf).GetBool("bool.false", false)); } @@ -337,7 +337,7 @@ TEST(Configuration, GetIntException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; ASSERT_THROW((*conf).GetInt("int.exception", 0), std::runtime_error); } @@ -348,7 +348,7 @@ TEST(Configuration, GetLongException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; ASSERT_THROW((*conf).GetLong("long.exception", 0), std::runtime_error); } @@ -359,7 +359,7 @@ TEST(Configuration, GetDoubleException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; ASSERT_THROW((*conf).GetDouble("double.exception", 0), std::runtime_error); } @@ -370,7 +370,7 @@ TEST(Configuration, GetBoolException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf != none) << "No configuration object present."; + ASSERT_TRUE(conf ) << "No configuration object present."; ASSERT_THROW((*conf).GetBool("bool.exception", false), std::runtime_error); } diff --git a/src/test/location-cache-test.cc b/src/test/location-cache-test.cc index 0d030c8..6ad9cc9 100644 --- a/src/test/location-cache-test.cc +++ b/src/test/location-cache-test.cc @@ -56,23 +56,23 @@ class LocationCacheTest : public ::testing::Test { std::unique_ptr LocationCacheTest::test_util_ = nullptr; TEST_F(LocationCacheTest, TestGetMetaNodeContents) { - auto cpu = std::make_shared(4); - auto io = std::make_shared(4); + auto cpu = std::make_shared(4); + auto io = std::make_shared(4); auto codec = std::make_shared(); auto cp = std::make_shared(io, cpu, codec, LocationCacheTest::test_util_->conf()); LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp}; auto f = cache.LocateMeta(); - auto result = f.get(); ASSERT_FALSE(f.hasException()); - ASSERT_TRUE(result.has_port()); - ASSERT_TRUE(result.has_host_name()); + auto res = std::move(f).get(); + ASSERT_TRUE(res.has_port()); + ASSERT_TRUE(res.has_host_name()); cpu->stop(); io->stop(); } TEST_F(LocationCacheTest, TestGetRegionLocation) { - auto cpu = std::make_shared(4); - auto io = std::make_shared(4); + auto cpu = std::make_shared(4); + auto io = std::make_shared(4); auto codec = std::make_shared(); auto cp = std::make_shared(io, cpu, codec, LocationCacheTest::test_util_->conf()); LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp}; @@ -89,8 +89,8 @@ TEST_F(LocationCacheTest, TestGetRegionLocation) { } TEST_F(LocationCacheTest, TestCaching) { - auto cpu = std::make_shared(4); - auto io = std::make_shared(4); + auto cpu = std::make_shared(4); + auto io = std::make_shared(4); auto codec = std::make_shared(); auto cp = std::make_shared(io, cpu, codec, LocationCacheTest::test_util_->conf()); LocationCache cache{LocationCacheTest::test_util_->conf(), io, cpu, cp}; diff --git a/src/test/result-test.cc b/src/test/result-test.cc index 581db32..3bd80e9 100644 --- a/src/test/result-test.cc +++ b/src/test/result-test.cc @@ -113,7 +113,7 @@ TEST(Result, FilledResult) { // Value will be nullptr as no such family and qualifier is present ASSERT_FALSE(result.Value("family-4", "qualifier")); // Value will be present as family and qualifier is present - ASSERT_TRUE(result.Value("family-4", "column-4") != none); + ASSERT_TRUE(result.Value("family-4", "column-4")); // Value should be present and match. EXPECT_EQ(latest_cell->Value(), (*result.ColumnLatestCell("family-4", "column-4")).Value()); EXPECT_EQ("value-5", (*result.ColumnLatestCell("family-5", "column-5")).Value()); diff --git a/src/test/rpc-test.cc b/src/test/rpc-test.cc index 277d573..c2771c4 100644 --- a/src/test/rpc-test.cc +++ b/src/test/rpc-test.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -79,16 +79,16 @@ std::shared_ptr GetRpcServerAddress(ServerPtr server) { } std::shared_ptr CreateRpcClient(std::shared_ptr conf) { - auto io_executor = std::make_shared(1); - auto cpu_executor = std::make_shared(1); + auto io_executor = std::make_shared(1); + auto cpu_executor = std::make_shared(1); auto client = std::make_shared(io_executor, cpu_executor, nullptr, conf); return client; } std::shared_ptr CreateRpcClient(std::shared_ptr conf, std::chrono::nanoseconds connect_timeout) { - auto io_executor = std::make_shared(1); - auto cpu_executor = std::make_shared(1); + auto io_executor = std::make_shared(1); + auto cpu_executor = std::make_shared(1); auto client = std::make_shared(io_executor, cpu_executor, nullptr, conf, connect_timeout); return client; @@ -108,15 +108,16 @@ TEST_F(RpcTest, Ping) { std::make_shared(), method); /* sending out request */ + auto server_host_name = server_addr->getIPAddress().isNonroutable() ? "127.0.0.1" : server_addr->getAddressStr(); client - ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + ->AsyncCall(server_host_name, server_addr->getPort(), std::move(request), hbase::security::User::defaultUser()) - .then([&](std::unique_ptr response) { + .thenValue([&](std::unique_ptr response) { auto pb_resp = std::static_pointer_cast(response->resp_msg()); EXPECT_TRUE(pb_resp != nullptr); VLOG(1) << folly::sformat(FLAGS_result_format, method, ""); }) - .onError([&](const folly::exception_wrapper& ew) { + .thenError([&](const folly::exception_wrapper& ew) { FAIL() << folly::sformat(FLAGS_fail_no_ex_format, method); }) .get(); @@ -142,16 +143,17 @@ TEST_F(RpcTest, Echo) { pb_msg->set_message(greetings); /* sending out request */ + auto server_host_name = server_addr->getIPAddress().isNonroutable() ? "127.0.0.1" : server_addr->getAddressStr(); client - ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + ->AsyncCall(server_host_name, server_addr->getPort(), std::move(request), hbase::security::User::defaultUser()) - .then([&](std::unique_ptr response) { + .thenValue([&](std::unique_ptr response) { auto pb_resp = std::static_pointer_cast(response->resp_msg()); EXPECT_TRUE(pb_resp != nullptr); VLOG(1) << folly::sformat(FLAGS_result_format, method, pb_resp->message()); EXPECT_EQ(greetings, pb_resp->message()); }) - .onError([&](const folly::exception_wrapper& ew) { + .thenError([&](const folly::exception_wrapper& ew) { FAIL() << folly::sformat(FLAGS_fail_no_ex_format, method); }) .get(); @@ -173,13 +175,14 @@ TEST_F(RpcTest, Error) { auto request = std::make_unique(std::make_shared(), std::make_shared(), method); /* sending out request */ +auto server_host_name = server_addr->getIPAddress().isNonroutable() ? "127.0.0.1" : server_addr->getAddressStr(); client - ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + ->AsyncCall(server_host_name, server_addr->getPort(), std::move(request), hbase::security::User::defaultUser()) - .then([&](std::unique_ptr response) { + .thenValue([&](std::unique_ptr response) { FAIL() << folly::sformat(FLAGS_fail_ex_format, method); }) - .onError([&](const folly::exception_wrapper& ew) { + .thenError([&](const folly::exception_wrapper& ew) { VLOG(1) << folly::sformat(FLAGS_result_format, method, ew.what()); std::string kRemoteException = demangle(typeid(hbase::RemoteException)).toStdString(); std::string kRpcTestException = demangle(typeid(hbase::RpcTestException)).toStdString(); @@ -214,13 +217,14 @@ TEST_F(RpcTest, SocketNotOpen) { server->join(); /* sending out request */ + auto server_host_name = server_addr->getIPAddress().isNonroutable() ? "127.0.0.1" : server_addr->getAddressStr(); client - ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + ->AsyncCall(server_host_name, server_addr->getPort(), std::move(request), hbase::security::User::defaultUser()) - .then([&](std::unique_ptr response) { + .thenValue([&](std::unique_ptr response) { FAIL() << folly::sformat(FLAGS_fail_ex_format, method); }) - .onError([&](const folly::exception_wrapper& ew) { + .thenError([&](const folly::exception_wrapper& ew) { VLOG(1) << folly::sformat(FLAGS_result_format, method, ew.what()); std::string kConnectionException = demangle(typeid(hbase::ConnectionException)).toStdString(); @@ -265,15 +269,16 @@ TEST_F(RpcTest, Pause) { pb_msg->set_ms(ms); /* sending out request */ + auto server_host_name = server_addr->getIPAddress().isNonroutable() ? "127.0.0.1" : server_addr->getAddressStr(); client - ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + ->AsyncCall(server_host_name, server_addr->getPort(), std::move(request), hbase::security::User::defaultUser()) - .then([&](std::unique_ptr response) { + .thenValue([&](std::unique_ptr response) { auto pb_resp = std::static_pointer_cast(response->resp_msg()); EXPECT_TRUE(pb_resp != nullptr); VLOG(1) << folly::sformat(FLAGS_result_format, method, ""); }) - .onError([&](const folly::exception_wrapper& ew) { + .thenError([&](const folly::exception_wrapper& ew) { VLOG(1) << folly::sformat(FLAGS_result_format, method, ew.what()); FAIL() << folly::sformat(FLAGS_fail_no_ex_format, method); }) diff --git a/src/test/time-range-test.cc b/src/test/time-range-test.cc index 9267c8c..209476e 100644 --- a/src/test/time-range-test.cc +++ b/src/test/time-range-test.cc @@ -20,7 +20,8 @@ #include "hbase/client/time-range.h" #include "hbase/test-util/test-util.h" -#include +#include +#include using namespace hbase; diff --git a/src/test/user-util-test.cc b/src/test/user-util-test.cc index c132419..29a1544 100644 --- a/src/test/user-util-test.cc +++ b/src/test/user-util-test.cc @@ -17,7 +17,8 @@ * */ -#include +#include +#include #include #include "hbase/utils/user-util.h" diff --git a/src/test/zk-deserializer-test.cc b/src/test/zk-deserializer-test.cc index 81bc42d..4ad26fe 100644 --- a/src/test/zk-deserializer-test.cc +++ b/src/test/zk-deserializer-test.cc @@ -19,7 +19,7 @@ #include "hbase/serde/zk.h" -#include +#include #include #include From 711be41009ed1c04cf0e7f1c62e7612acc9c8b96 Mon Sep 17 00:00:00 2001 From: phrocker Date: Tue, 23 Jun 2020 18:27:40 +0000 Subject: [PATCH 02/12] remove removal of proto files --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index c2102f8..93c6522 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ *.lo *.o -# Proto files -src/hbase/if/*.proto - # Compiled Dynamic libraries *.so From 04581aeb7f2503b41540d8fbe69cee6482ffd237 Mon Sep 17 00:00:00 2001 From: phrocker Date: Tue, 23 Jun 2020 18:35:19 +0000 Subject: [PATCH 03/12] tabs to spaces --- CMakeLists.txt | 21 ++++++++++----------- cmake/DownloadFolly.cmake | 2 +- cmake/DownloadWangle.cmake | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3193761..d7e0b17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,12 +167,12 @@ endif (OPENSSL_FOUND) if (DOWNLOAD_DEPENDENCIES) download_boost(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${BOOST_LIBS}") - download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_fizz(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_cyrus_sasl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif(DOWNLOAD_DEPENDENCIES) @@ -182,8 +182,8 @@ find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS "${BOOST_LIBS}") find_package(LibEvent REQUIRED) find_package(Gflags REQUIRED) if (DOWNLOAD_DEPENDENCIES) - find_package(Sodium REQUIRED) - find_package(Fizz REQUIRED) + find_package(Sodium REQUIRED) + find_package(Fizz REQUIRED) endif(DOWNLOAD_DEPENDENCIES) find_package(Folly REQUIRED) find_package(Krb5 REQUIRED) @@ -264,8 +264,8 @@ target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) - target_link_libraries(hbaseclient-static ${FIZZ_LIBRARIES}) - target_link_libraries(hbaseclient-static ${sodium_LIBRARY_RELEASE}) + target_link_libraries(hbaseclient-static ${FIZZ_LIBRARIES}) + target_link_libraries(hbaseclient-static ${sodium_LIBRARY_RELEASE}) endif(DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-static ${FOLLY_LIBRARIES}) target_link_libraries(hbaseclient-static ${GLOG_SHARED_LIB}) @@ -285,8 +285,8 @@ target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY}) target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES}) target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) - target_link_libraries(hbaseclient-shared ${FIZZ_LIBRARIES}) - target_link_libraries(hbaseclient-shared ${sodium_LIBRARY_RELEASE}) + target_link_libraries(hbaseclient-shared ${FIZZ_LIBRARIES}) + target_link_libraries(hbaseclient-shared ${sodium_LIBRARY_RELEASE}) endif(DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-shared ${FOLLY_LIBRARIES}) target_link_libraries(hbaseclient-shared ${SASL_LIBS}) @@ -347,7 +347,6 @@ if (DOWNLOAD_DEPENDENCIES) add_dependencies(hbaseclient-shared facebook-wangle-proj) add_dependencies(hbaseclient-static zookeeper) add_dependencies(hbaseclient-shared zookeeper) -endif(DOWNLOAD_DEPENDENCIES) # Install library headers include(GNUInstallDirs) diff --git a/cmake/DownloadFolly.cmake b/cmake/DownloadFolly.cmake index f999ccb..880cba2 100644 --- a/cmake/DownloadFolly.cmake +++ b/cmake/DownloadFolly.cmake @@ -28,7 +28,7 @@ function(download_folly SOURCE_DIR BUILD_DIR) "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install" - -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} diff --git a/cmake/DownloadWangle.cmake b/cmake/DownloadWangle.cmake index 4cfd7b8..02080c7 100644 --- a/cmake/DownloadWangle.cmake +++ b/cmake/DownloadWangle.cmake @@ -24,7 +24,6 @@ function(download_wangle SOURCE_DIR BUILD_DIR) set(WANGLE_DOWNLOAD_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-download") set(WANGLE_SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-src") set(WANGLE_INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-install") - ExternalProject_Add( facebook-wangle-proj GIT_REPOSITORY "https://github.com/facebook/wangle.git" From ef10758dcc24afcfc78ea85d29ef30a49f87cc06 Mon Sep 17 00:00:00 2001 From: phrocker Date: Fri, 26 Jun 2020 11:44:53 +0000 Subject: [PATCH 04/12] fix some review comments --- cmake/DownloadCyrusSasl.cmake | 19 +++++------ cmake/DownloadDoubleConversion.cmake | 22 ++++++------ cmake/DownloadFizz.cmake | 27 +++++++-------- cmake/DownloadFolly.cmake | 1 + cmake/DownloadWangle.cmake | 1 - docker-files/Dockerfile | 10 +----- .../client/async-batch-rpc-retrying-caller.cc | 7 ++-- src/test/hbase-configuration-test.cc | 34 +++++++++---------- 8 files changed, 53 insertions(+), 68 deletions(-) diff --git a/cmake/DownloadCyrusSasl.cmake b/cmake/DownloadCyrusSasl.cmake index 1d1fe02..9d7963c 100644 --- a/cmake/DownloadCyrusSasl.cmake +++ b/cmake/DownloadCyrusSasl.cmake @@ -19,19 +19,16 @@ ## SOURCE_DIR is typically the cmake source directory ## BINARY_DIR is the build directory, typically 'build' - function(download_cyrus_sasl SOURCE_DIR BUILD_DIR) ExternalProject_Add( - cyrussasl - URL "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz" - PREFIX "${BUILD_DIR}/dependencies" - SOURCE_DIR "${BUILD_DIR}/dependencies/cyrussasl-src" - BINARY_DIR ${BUILD_DIR}/dependencies/cyrussasl-src/ - CONFIGURE_COMMAND ./configure --enable-static --with-pic --prefix=${BUILD_DIR}/dependencies/cyrussasl-install - "CFLAGS=-fPIC" - "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC" + cyrussasl + URL "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz" + PREFIX "${BUILD_DIR}/dependencies" + SOURCE_DIR "${BUILD_DIR}/dependencies/cyrussasl-src" + BINARY_DIR ${BUILD_DIR}/dependencies/cyrussasl-src/ + CONFIGURE_COMMAND ./configure --enable-static --with-pic --prefix=${BUILD_DIR}/dependencies/cyrussasl-install + "CFLAGS=-fPIC" + "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC" ) - add_library(sasl2 STATIC IMPORTED) - set_target_properties(sasl2 PROPERTIES IMPORTED_LOCATION "${BUILD_DIR}/dependencies/cyrussasl-install/lib/libsasl2.a") set(SASL2_DIR "${BUILD_DIR}/dependencies/cyrussasl-install/" CACHE STRING "" FORCE) endfunction(download_cyrus_sasl) diff --git a/cmake/DownloadDoubleConversion.cmake b/cmake/DownloadDoubleConversion.cmake index dc32b07..dcca374 100644 --- a/cmake/DownloadDoubleConversion.cmake +++ b/cmake/DownloadDoubleConversion.cmake @@ -15,20 +15,18 @@ # specific language governing permissions and limitations # under the License. -## Download facebook's folly library. +## Download Double Conversion library. ## SOURCE_DIR is typically the cmake source directory function(download_doubleconversion SOURCE_DIR BUILD_DIR) - ExternalProject_Add( - doubleconversion-proj - GIT_REPOSITORY "https://github.com/google/double-conversion.git" - GIT_TAG "master" - SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src" - CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} - "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - "${BUILD_ARGS}" - ) + ExternalProject_Add( + doubleconversion-proj + PREFIX "${BUILD_DIR}/dependencies" + GIT_REPOSITORY "https://github.com/google/double-conversion.git" + GIT_TAG "master" + SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src" + CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" -DCMAKE_POSITION_INDEPENDENT_CODE=ON "${BUILD_ARGS}" + ) - set(DOUBLE_CONVERSION_ROOT_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-install" CACHE STRING "" FORCE) + set(DOUBLE_CONVERSION_ROOT_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-install" CACHE STRING "" FORCE) endfunction(download_doubleconversion) diff --git a/cmake/DownloadFizz.cmake b/cmake/DownloadFizz.cmake index faea366..5ce196e 100644 --- a/cmake/DownloadFizz.cmake +++ b/cmake/DownloadFizz.cmake @@ -21,21 +21,20 @@ function(download_fizz SOURCE_DIR BUILD_DIR) - - ExternalProject_Add( - facebook-fizz-proj - GIT_REPOSITORY "https://github.com/facebookincubator/fizz.git" - GIT_TAG "v2020.05.18.00" - SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-src" - PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake - COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake" - INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install - ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. - ) + ExternalProject_Add( + facebook-fizz-proj + GIT_REPOSITORY "https://github.com/facebookincubator/fizz.git" + PREFIX "${BUILD_DIR}/dependencies" + GIT_TAG "v2020.05.18.00" + SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-src" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake + COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake" + INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. + ) - set(FIZZ_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CACHE STRING "" FORCE) + set(FIZZ_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CACHE STRING "" FORCE) endfunction(download_fizz) \ No newline at end of file diff --git a/cmake/DownloadFolly.cmake b/cmake/DownloadFolly.cmake index 880cba2..3fcd9dc 100644 --- a/cmake/DownloadFolly.cmake +++ b/cmake/DownloadFolly.cmake @@ -21,6 +21,7 @@ function(download_folly SOURCE_DIR BUILD_DIR) ExternalProject_Add( facebook-folly-proj + PREFIX "${BUILD_DIR}/dependencies" GIT_REPOSITORY "https://github.com/facebook/folly.git" GIT_TAG "v2020.05.18.00" SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src" diff --git a/cmake/DownloadWangle.cmake b/cmake/DownloadWangle.cmake index 02080c7..55218ee 100644 --- a/cmake/DownloadWangle.cmake +++ b/cmake/DownloadWangle.cmake @@ -20,7 +20,6 @@ ## BINARY_DIR is the build directory, typically 'build' function(download_wangle SOURCE_DIR BUILD_DIR) - set(WANGLE_DOWNLOAD_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-download") set(WANGLE_SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-src") set(WANGLE_INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-install") diff --git a/docker-files/Dockerfile b/docker-files/Dockerfile index 82545d7..4a18d4b 100644 --- a/docker-files/Dockerfile +++ b/docker-files/Dockerfile @@ -30,21 +30,13 @@ ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" RUN apt-get update && \ apt-get install -y vim maven inetutils-ping python-pip doxygen graphviz clang-format valgrind \ wget libgflags-dev libgoogle-glog-dev dh-autoreconf pkg-config libssl-dev build-essential \ - libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev libdouble-conversion-dev && \ + libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev && \ pip install yapf && \ apt-get -qq clean && \ apt-get -y -qq autoremove && \ rm -rf /var/lib/{apt,dpkg,cache,log}/ && \ rm -rf /tmp/* -RUN wget https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.26/cyrus-sasl-2.1.26.tar.gz ; \ - tar zxf cyrus-sasl-2.1.26.tar.gz ; \ - cd cyrus-sasl-2.1.26 ; \ - ./configure ; \ - make -j4; \ - make install ;\ - cp /usr/local/lib/sasl2/* /usr/lib/sasl2/ - ## Install Google Test to support RUN wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \ tar zxf release-1.8.0.tar.gz && \ diff --git a/src/hbase/client/async-batch-rpc-retrying-caller.cc b/src/hbase/client/async-batch-rpc-retrying-caller.cc index 71b819d..b159cfc 100644 --- a/src/hbase/client/async-batch-rpc-retrying-caller.cc +++ b/src/hbase/client/async-batch-rpc-retrying-caller.cc @@ -71,7 +71,7 @@ template Future>> AsyncBatchRpcRetryingCaller::Call() { GroupAndSend(actions_, 1); // use the executor to convert he SemiFuture to a Future. - return std::move(collectAll(action2futures_)).via(cpu_pool_.get()); + return collectAll(action2futures_).via(cpu_pool_.get()); } template @@ -239,8 +239,7 @@ AsyncBatchRpcRetryingCaller::GetRegionLocations( locs.push_back(location_cache_->LocateRegion(*table_name_, action->action()->row(), RegionLocateType::kCurrent, locate_timeout_ns)); } - - return std::move(collectAll(locs)).via(cpu_pool_.get()); + return collectAll(locs).via(cpu_pool_.get()); } template @@ -332,7 +331,7 @@ AsyncBatchRpcRetryingCaller::GetMultiResponse(const ActionsByServer & multi_calls.push_back( rpc_client_->AsyncCall(host, port, std::move(multi_req), user, "ClientService")); } - return std::move(collectAll(multi_calls)).via(cpu_pool_.get()); + return collectAll(multi_calls).via(cpu_pool_.get()); } template diff --git a/src/test/hbase-configuration-test.cc b/src/test/hbase-configuration-test.cc index 2186095..e724bfb 100644 --- a/src/test/hbase-configuration-test.cc +++ b/src/test/hbase-configuration-test.cc @@ -150,7 +150,7 @@ TEST(Configuration, LoadConfFromDefaultLocation) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("custom-prop", "Set this value").c_str(), "custom-value"); EXPECT_STREQ((*conf).Get("default-prop", "Set this value").c_str(), "default-value"); } @@ -167,7 +167,7 @@ TEST(Configuration, LoadConfFromCustomLocation) { HBaseConfigurationLoader loader; std::vector resources{kHBaseSiteXml}; hbase::optional conf = loader.LoadResources(kHBaseConfPath, resources); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("custom-prop", "").c_str(), "custom-value"); EXPECT_STRNE((*conf).Get("custom-prop", "").c_str(), "some-value"); } @@ -188,7 +188,7 @@ TEST(Configuration, LoadConfFromMultipleLocatons) { std::string conf_paths = kDefHBaseConfPath + ":" + kHBaseConfPath; std::vector resources{kHBaseDefaultXml, kHBaseSiteXml}; hbase::optional conf = loader.LoadResources(conf_paths, resources); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("default-prop", "From hbase-default.xml").c_str(), "default-value"); EXPECT_STREQ((*conf).Get("custom-prop", "").c_str(), "custom-value"); EXPECT_STRNE((*conf).Get("custom-prop", "").c_str(), "some-value"); @@ -207,7 +207,7 @@ TEST(Configuration, DefaultValues) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("default-prop", "Set this value.").c_str(), "default-value"); EXPECT_STREQ((*conf).Get("custom-prop", "Set this value.").c_str(), "custom-value"); } @@ -219,7 +219,7 @@ TEST(Configuration, FinalValues) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("hbase.rootdir", "").c_str(), "/root/hbase-docker/apps/hbase/data"); EXPECT_STREQ((*conf).Get("hbase.zookeeper.property.datadir", "").c_str(), "/root/hbase-docker/zookeeper"); @@ -241,7 +241,7 @@ TEST(Configuration, EnvVars) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("hbase-client.user.name", "").c_str(), "${user.name}"); EXPECT_STRNE((*conf).Get("hbase-client.user.name", "root").c_str(), "test-user"); } @@ -253,7 +253,7 @@ TEST(Configuration, SelfRef) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("selfRef", "${selfRef}").c_str(), "${selfRef}"); } @@ -264,7 +264,7 @@ TEST(Configuration, VarExpansion) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_STREQ((*conf).Get("foo.substs", "foo-value").c_str(), "bar-value,bar-value,bar-value,bar-value,bar-value,bar-value," "bar-value,bar-value,bar-value,bar-value,"); @@ -278,7 +278,7 @@ TEST(Configuration, VarExpansionException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; ASSERT_THROW((*conf).Get("foo.substs.exception", "foo-value").c_str(), std::runtime_error); } @@ -289,7 +289,7 @@ TEST(Configuration, GetInt) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_EQ(16000, (*conf).GetInt("int", 0)); EXPECT_EQ(2147483646, (*conf).GetInt("int.largevalue", 0)); } @@ -301,7 +301,7 @@ TEST(Configuration, GetLong) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_EQ(2147483850, (*conf).GetLong("long", 0)); EXPECT_EQ(9223372036854775807, (*conf).GetLong("long.largevalue", 0)); } @@ -313,7 +313,7 @@ TEST(Configuration, GetDouble) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_DOUBLE_EQ(17.9769e+100, (*conf).GetDouble("double", 0.0)); EXPECT_DOUBLE_EQ(170.769e+200, (*conf).GetDouble("double.largevalue", 0.0)); } @@ -325,7 +325,7 @@ TEST(Configuration, GetBool) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; EXPECT_EQ(true, (*conf).GetBool("bool.true", true)); EXPECT_EQ(false, (*conf).GetBool("bool.false", false)); } @@ -337,7 +337,7 @@ TEST(Configuration, GetIntException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; ASSERT_THROW((*conf).GetInt("int.exception", 0), std::runtime_error); } @@ -348,7 +348,7 @@ TEST(Configuration, GetLongException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; ASSERT_THROW((*conf).GetLong("long.exception", 0), std::runtime_error); } @@ -359,7 +359,7 @@ TEST(Configuration, GetDoubleException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; ASSERT_THROW((*conf).GetDouble("double.exception", 0), std::runtime_error); } @@ -370,7 +370,7 @@ TEST(Configuration, GetBoolException) { HBaseConfigurationLoader loader; hbase::optional conf = loader.LoadDefaultResources(); - ASSERT_TRUE(conf ) << "No configuration object present."; + ASSERT_TRUE(conf) << "No configuration object present."; ASSERT_THROW((*conf).GetBool("bool.exception", false), std::runtime_error); } From 793121d374500bc902271a004ae0836c2b7b1405 Mon Sep 17 00:00:00 2001 From: phrocker Date: Thu, 9 Jul 2020 15:12:03 +0000 Subject: [PATCH 05/12] Clean up broken commit --- CMakeLists.txt | 4 ++-- cmake/folly/local/FindFolly.cmake | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7e0b17..4c1114a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,15 +162,15 @@ if (OPENSSL_FOUND) else () message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" ) endif (OPENSSL_FOUND) -## Download Facebook Folly and build locally +## Download Facebook 1 and build locally if (DOWNLOAD_DEPENDENCIES) download_boost(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${BOOST_LIBS}") download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) - download_fizz(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_cyrus_sasl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + download_fizz(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) endif(DOWNLOAD_DEPENDENCIES) diff --git a/cmake/folly/local/FindFolly.cmake b/cmake/folly/local/FindFolly.cmake index 8e9d88a..be9fb34 100644 --- a/cmake/folly/local/FindFolly.cmake +++ b/cmake/folly/local/FindFolly.cmake @@ -18,7 +18,6 @@ # Stubs to allow us to find folly libs set(FOLLY_FOUND "true" CACHE STRING "" FORCE) -set(FOLLY_INCLUDE_DIRS "${FOLLY_ROOT_DIR}/include" CACHE STRING "" FORCE) set(FOLLY_INCLUDE_DIR "${FOLLY_ROOT_DIR}/include" CACHE STRING "" FORCE) ## Given that folly is an older dependency, and the way it is built has evolved, newer ## versions of folly won't require an SO. For now it is far easier to link against the .so (BYPRODUCT_SHARED_SUFFIX) @@ -28,8 +27,6 @@ set(FOLLY_LIBRARIES "${FOLLY_ROOT_DIR}/lib/${BYPRODUCT_PREFIX}folly${BYPRODUCT_S mark_as_advanced( FOLLY_ROOT_DIR - FOLLY_INCLUDE - FOLLY_INCLUDE_DIRS FOLLY_INCLUDE_DIR FOLLY_LIBRARIES ) From d8a27c3e134a376b28c1d9b2e4ad22df184ddd04 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Tue, 14 Jul 2020 10:17:08 +0000 Subject: [PATCH 06/12] Remove C++17 Ref --- CMakeLists.txt | 12 ++-- cmake/patches/zookeeper.3.4.14.buf | 4 -- cmake/patches/zookeeper.3.4.14.cli | 4 -- include/hbase/client/configuration.h | 22 +++--- .../hbase/client/hbase-configuration-loader.h | 2 +- include/hbase/utils/optional.h | 4 +- src/hbase/client/configuration.cc | 68 +++++++++---------- .../client/hbase-configuration-loader.cc | 13 ++-- 8 files changed, 59 insertions(+), 70 deletions(-) delete mode 100644 cmake/patches/zookeeper.3.4.14.buf delete mode 100644 cmake/patches/zookeeper.3.4.14.cli diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c1114a..b56bd20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,21 +130,21 @@ endif() include_directories("${JAVA_HBASE_DIR}/hbase-common/target/generated-sources/native/") ############ -## Validate that we have C++ 17 support +## Validate that we have C++ 14 support ############ -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) +CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) -if(COMPILER_SUPPORTS_CXX17) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +if(COMPILER_SUPPORTS_CXX14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() - message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++17 support. Please use a different C++ compiler.") + message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not have C++14 support. Please use a different C++ compiler.") endif() set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase") set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if") diff --git a/cmake/patches/zookeeper.3.4.14.buf b/cmake/patches/zookeeper.3.4.14.buf deleted file mode 100644 index 881d335..0000000 --- a/cmake/patches/zookeeper.3.4.14.buf +++ /dev/null @@ -1,4 +0,0 @@ -3480c3480 -< static char buf[128]; ---- -> static char buf[128+6] = {0}; diff --git a/cmake/patches/zookeeper.3.4.14.cli b/cmake/patches/zookeeper.3.4.14.cli deleted file mode 100644 index fa6bfcc..0000000 --- a/cmake/patches/zookeeper.3.4.14.cli +++ /dev/null @@ -1,4 +0,0 @@ -559c559 -< strncpy(cmd, argv[2]+4, sizeof(cmd)); ---- -> strncpy(cmd, argv[2]+4, sizeof(cmd)-1); diff --git a/include/hbase/client/configuration.h b/include/hbase/client/configuration.h index d851263..95f29c6 100644 --- a/include/hbase/client/configuration.h +++ b/include/hbase/client/configuration.h @@ -158,44 +158,44 @@ class Configuration { * SubstituteVars will be called for any variable expansion. * @param key Key whose value is to be fetched. */ - std::optional Get(const std::string &key) const; + optional Get(const std::string &key) const; /** - * @brief returns std::optional int32_t value identified by the key in ConfigMap. + * @brief returns optional int32_t value identified by the key in ConfigMap. * Get(key) is called to get the string value which is then converted to * int32_t using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to int32_t fails */ - std::optional GetInt(const std::string &key) const; + optional GetInt(const std::string &key) const; /** - * @brief returns std::optional int64_t value identified by the key in ConfigMap. + * @brief returns optional int64_t value identified by the key in ConfigMap. * Get(key) is called internally to get the string value which is then * converted to int64_t using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to int64_t fails */ - std::optional GetLong(const std::string &key) const; + optional GetLong(const std::string &key) const; /** - * @brief returns std::optional double value identified by the key in ConfigMap. + * @brief returns optional double value identified by the key in ConfigMap. * Get(key) is called to get the string value which is then converted to * double using boost::lexical_cast. * @param key Key whose value is to be fetched. * @throws std::runtime_error if conversion to double fails */ - std::optional GetDouble(const std::string &key) const; + optional GetDouble(const std::string &key) const; /** - * @brief returns std::optional bool for a property identified by key in ConfigMap. + * @brief returns optional bool for a property identified by key in ConfigMap. * Get(key) is called to get the string value which is then converted to bool * by checking the validity. * @param key Key whose value is to be fetched. Get(key) is called to get the * string value which is then converted to bool. * @throws std::runtime_error if conversion to bool fails */ - std::optional GetBool(const std::string &key) const; + optional GetBool(const std::string &key) const; /** * @brief This method will perform any variable expansion if present. @@ -219,12 +219,12 @@ class Configuration { * @brief This method will fetch value for key from environment if present. * @param key key to be fetched from environment. */ - std::optional GetEnv(const std::string &key) const; + optional GetEnv(const std::string &key) const; /** * @brief This method will fetch value for key from ConfigMap if present. * @param key key to be fetched from environment. */ - std::optional GetProperty(const std::string &key) const; + optional GetProperty(const std::string &key) const; }; } /* namespace hbase */ diff --git a/include/hbase/client/hbase-configuration-loader.h b/include/hbase/client/hbase-configuration-loader.h index 7a070ed..d0839d6 100644 --- a/include/hbase/client/hbase-configuration-loader.h +++ b/include/hbase/client/hbase-configuration-loader.h @@ -132,7 +132,7 @@ class HBaseConfigurationLoader { * @param final_text value of final node true or false if present */ bool UpdateMapWithValue(ConfigMap &map, const std::string &key, const std::string &value, - std::optional final_text); + optional final_text); }; } /* namespace hbase */ diff --git a/include/hbase/utils/optional.h b/include/hbase/utils/optional.h index 9e5102f..f257b44 100644 --- a/include/hbase/utils/optional.h +++ b/include/hbase/utils/optional.h @@ -18,8 +18,8 @@ */ #pragma once -#include #include +#include namespace hbase { @@ -27,7 +27,7 @@ namespace hbase { * An optional value that may or may not be present. */ template -using optional = std::optional; +using optional = boost::optional; const boost::none_t none = boost::none; diff --git a/src/hbase/client/configuration.cc b/src/hbase/client/configuration.cc index 01ec248..ace976a 100644 --- a/src/hbase/client/configuration.cc +++ b/src/hbase/client/configuration.cc @@ -89,28 +89,28 @@ std::string Configuration::SubstituteVars(const std::string &expr) const { } } -std::optional Configuration::GetEnv(const std::string &key) const { +optional Configuration::GetEnv(const std::string &key) const { char buf[2048]; if ("user.name" == key) { #ifdef HAVE_GETLOGIN - return std::make_optional(getlogin()); + return getlogin(); #else DLOG(WARNING) << "Client user.name not implemented"; - return std::optional(); + return none; #endif } if ("user.dir" == key) { #ifdef HAVE_GETCWD if (getcwd(buf, sizeof(buf))) { - return std::make_optional(buf); + return buf; } else { - return std::optional(); + return none; } #else DLOG(WARNING) << "Client user.dir not implemented"; - return std::optional(); + return none; #endif } @@ -118,33 +118,33 @@ std::optional Configuration::GetEnv(const std::string &key) const { #if defined(HAVE_GETUID) && defined(HAVE_GETPWUID_R) uid = getuid(); if (!getpwuid_r(uid, &pw, buf, sizeof(buf), &pwp)) { - return std::make_optional(buf); + return buf; } else { - return std::optional(); + return none; } #else DLOG(WARNING) << "Client user.home not implemented"; - return std::optional(); + return none; #endif } - return std::optional(); + return none; } -std::optional Configuration::GetProperty(const std::string &key) const { +optional Configuration::GetProperty(const std::string &key) const { auto found = hb_property_.find(key); if (found != hb_property_.end()) { - return std::make_optional(found->second.value); + return found->second.value; } else { - return std::optional(); + return none; } } -std::optional Configuration::Get(const std::string &key) const { - std::optional raw = GetProperty(key); +optional Configuration::Get(const std::string &key) const { + optional raw = GetProperty(key); if (raw) { - return std::make_optional(SubstituteVars(*raw)); + return SubstituteVars(*raw); } else { - return std::optional(); + return none; } } @@ -152,61 +152,61 @@ std::string Configuration::Get(const std::string &key, const std::string &defaul return Get(key).value_or(default_value); } -std::optional Configuration::GetInt(const std::string &key) const { - std::optional raw = Get(key); +optional Configuration::GetInt(const std::string &key) const { + optional raw = Get(key); if (raw) { try { - return std::make_optional(boost::lexical_cast(*raw)); + return boost::lexical_cast(*raw); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return std::optional(); + return optional(); } int32_t Configuration::GetInt(const std::string &key, int32_t default_value) const { return GetInt(key).value_or(default_value); } -std::optional Configuration::GetLong(const std::string &key) const { - std::optional raw = Get(key); +optional Configuration::GetLong(const std::string &key) const { + optional raw = Get(key); if (raw) { try { - return std::make_optional(boost::lexical_cast(*raw)); + return boost::lexical_cast(*raw); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return std::optional(); + return optional(); } int64_t Configuration::GetLong(const std::string &key, int64_t default_value) const { return GetLong(key).value_or(default_value); } -std::optional Configuration::GetDouble(const std::string &key) const { - std::optional raw = Get(key); +optional Configuration::GetDouble(const std::string &key) const { + optional raw = Get(key); if (raw) { try { - return std::make_optional(boost::lexical_cast(*raw)); + return boost::lexical_cast(*raw); } catch (const boost::bad_lexical_cast &blex) { throw std::runtime_error(blex.what()); } } - return std::optional(); + return optional(); } double Configuration::GetDouble(const std::string &key, double default_value) const { return GetDouble(key).value_or(default_value); } -std::optional Configuration::GetBool(const std::string &key) const { - std::optional raw = Get(key); +optional Configuration::GetBool(const std::string &key) const { + optional raw = Get(key); if (raw) { if (!strcasecmp((*raw).c_str(), "true") || !strcasecmp((*raw).c_str(), "1")) { - return std::make_optional(true); + return true; } else if (!strcasecmp((*raw).c_str(), "false") || !strcasecmp((*raw).c_str(), "0")) { - return std::make_optional(false); + return false; } else { boost::format what("Unexpected value \"%s\" found being converted to bool for key \"%s\""); what % (*raw); @@ -214,7 +214,7 @@ std::optional Configuration::GetBool(const std::string &key) const { throw std::runtime_error(what.str()); } } - return std::optional(); + return optional(); } bool Configuration::GetBool(const std::string &key, bool default_value) const { diff --git a/src/hbase/client/hbase-configuration-loader.cc b/src/hbase/client/hbase-configuration-loader.cc index a5b8249..a72545a 100644 --- a/src/hbase/client/hbase-configuration-loader.cc +++ b/src/hbase/client/hbase-configuration-loader.cc @@ -125,9 +125,9 @@ optional HBaseConfigurationLoader::LoadDefaultResources() { } } if (success) { - return std::make_optional(Configuration(conf_property)); + return Configuration(conf_property); } else { - return optional(); + return none; } } @@ -149,7 +149,7 @@ optional HBaseConfigurationLoader::LoadResources( } } if (success) { - return std::make_optional(Configuration(conf_property)); + return Configuration(conf_property); } else { return optional(); } @@ -175,10 +175,7 @@ bool HBaseConfigurationLoader::LoadProperties(const std::string &file, ConfigMap std::string value_node = v.second.get("value"); if ((name_node.size() > 0) && (value_node.size() > 0)) { auto final_node = v.second.get_optional("final"); - // since we're converting from boost::optional to std::optional we'll make a check - // as boost asserts initialization. - auto finalopt = final_node.is_initialized() ? std::make_optional(final_node.get()) : std::optional(); - UpdateMapWithValue(property_map, name_node, value_node, finalopt); + UpdateMapWithValue(property_map, name_node, value_node, final_node.get()); } } } @@ -191,7 +188,7 @@ bool HBaseConfigurationLoader::LoadProperties(const std::string &file, ConfigMap bool HBaseConfigurationLoader::UpdateMapWithValue(ConfigMap &map, const std::string &key, const std::string &value, - std::optional final_text) { + optional final_text) { auto map_value = map.find(key); if (map_value != map.end() && map_value->second.final) { return false; From 45644b7d9f76a6cee968ebfbaaa235833b4bd837 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Tue, 28 Jul 2020 09:59:27 +0000 Subject: [PATCH 07/12] cleanup --- CMakeLists.txt | 17 ++++++++--------- cmake/DownloadBoost.cmake | 4 +++- cmake/DownloadCyrusSasl.cmake | 2 +- cmake/DownloadDoubleConversion.cmake | 3 +-- cmake/DownloadFizz.cmake | 1 + cmake/DownloadFolly.cmake | 4 +++- cmake/FindKrb5.cmake | 1 - cmake/ProtobufGen.cmake | 2 +- cmake/boost/local/FindBoost.cmake | 6 ++++-- .../system/FindDoubleConversion.cmake | 2 +- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b56bd20..a417034 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,7 @@ if(COMPILER_SUPPORTS_CXX14) elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() - message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not have C++14 support. Please use a different C++ compiler.") + message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not have C++14 support. Please use a different C++ compiler.") endif() set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase") set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if") @@ -162,9 +162,7 @@ if (OPENSSL_FOUND) else () message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" ) endif (OPENSSL_FOUND) -## Download Facebook 1 and build locally - - +## Download dependencies and build locally if (DOWNLOAD_DEPENDENCIES) download_boost(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${BOOST_LIBS}") download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) @@ -257,8 +255,6 @@ set_target_properties(hbaseclient-static PROPERTIES LINKER_LANGUAGE CXX) SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) set_target_properties(hbaseclient-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs") target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) - - target_link_libraries(hbaseclient-static ${SASL_LIBS}) target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) @@ -299,10 +295,11 @@ target_link_libraries(hbaseclient-shared ${ZOOKEEPER_LIBRARIES}) target_link_libraries(hbaseclient-shared ${DOUBLE_CONVERSION_LIBRARY}) target_link_libraries(hbaseclient-shared ${CMAKE_DL_LIBS}) add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc") -set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ") +#set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(simple-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") target_link_libraries(simple-client ${PROTOBUF_LIBRARY}) -target_link_libraries(simple-client ${Boost_LIBRARIES}) +#target_link_libraries(simple-client ${Boost_LIBRARIES}) +target_link_libraries(simple-client ${CMAKE_DL_LIBS}) target_link_libraries(simple-client ${SASL_LIBS}) target_link_libraries(simple-client ${GFLAGS_SHARED_LIB}) target_link_libraries(simple-client ${KRB5_LIBRARIES}) @@ -312,7 +309,7 @@ add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc") set_target_properties(load-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(load-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") target_link_libraries(load-client ${PROTOBUF_LIBRARY}) -target_link_libraries(load-client ${Boost_LIBRARIES}) +#target_link_libraries(load-client ${Boost_LIBRARIES}) target_link_libraries(load-client ${SASL_LIBS}) target_link_libraries(load-client ${GFLAGS_SHARED_LIB}) target_link_libraries(load-client ${KRB5_LIBRARIES}) @@ -338,6 +335,7 @@ if (DOWNLOAD_DEPENDENCIES) add_dependencies(facebook-folly-proj boost) add_dependencies(hbaseclient-static boost) add_dependencies(hbaseclient-shared boost) + add_dependencies(facebook-folly-proj boost) add_dependencies(facebook-folly-proj doubleconversion-proj) add_dependencies(facebook-wangle-proj facebook-folly-proj) add_dependencies(facebook-fizz-proj facebook-folly-proj) @@ -347,6 +345,7 @@ if (DOWNLOAD_DEPENDENCIES) add_dependencies(hbaseclient-shared facebook-wangle-proj) add_dependencies(hbaseclient-static zookeeper) add_dependencies(hbaseclient-shared zookeeper) +endif(DOWNLOAD_DEPENDENCIES) # Install library headers include(GNUInstallDirs) diff --git a/cmake/DownloadBoost.cmake b/cmake/DownloadBoost.cmake index cc2b445..98cf6af 100644 --- a/cmake/DownloadBoost.cmake +++ b/cmake/DownloadBoost.cmake @@ -26,7 +26,7 @@ function(download_boost SOURCE_DIR BUILD_DIR BOOST_LIBS) set(BOOST_INSTALL_DIR "${BUILD_DIR}/dependencies/boost-install") set(CFLAGS "-fPIC") - set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14") # Only compile and install the needed libs. set(LIBS_TO_COMPILE "") @@ -49,5 +49,7 @@ function(download_boost SOURCE_DIR BUILD_DIR BOOST_LIBS) INSTALL_COMMAND "" ) set(BOOST_ROOT ${BOOST_INSTALL_DIR} PARENT_SCOPE) + set(BOOST_INCLUDEDIR ${BOOST_ROOT}/include PARENT_SCOPE) + set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib PARENT_SCOPE) set(Boost_FIND_COMPONENTS ${BOOST_LIBS} PARENT_SCOPE) endfunction(download_boost) diff --git a/cmake/DownloadCyrusSasl.cmake b/cmake/DownloadCyrusSasl.cmake index 9d7963c..c67fae7 100644 --- a/cmake/DownloadCyrusSasl.cmake +++ b/cmake/DownloadCyrusSasl.cmake @@ -28,7 +28,7 @@ function(download_cyrus_sasl SOURCE_DIR BUILD_DIR) BINARY_DIR ${BUILD_DIR}/dependencies/cyrussasl-src/ CONFIGURE_COMMAND ./configure --enable-static --with-pic --prefix=${BUILD_DIR}/dependencies/cyrussasl-install "CFLAGS=-fPIC" - "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC" + "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC" ) set(SASL2_DIR "${BUILD_DIR}/dependencies/cyrussasl-install/" CACHE STRING "" FORCE) endfunction(download_cyrus_sasl) diff --git a/cmake/DownloadDoubleConversion.cmake b/cmake/DownloadDoubleConversion.cmake index dcca374..1d6fd9b 100644 --- a/cmake/DownloadDoubleConversion.cmake +++ b/cmake/DownloadDoubleConversion.cmake @@ -25,8 +25,7 @@ function(download_doubleconversion SOURCE_DIR BUILD_DIR) GIT_REPOSITORY "https://github.com/google/double-conversion.git" GIT_TAG "master" SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src" - CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" -DCMAKE_POSITION_INDEPENDENT_CODE=ON "${BUILD_ARGS}" - ) + CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" -DCMAKE_POSITION_INDEPENDENT_CODE=ON "${BUILD_ARGS}") set(DOUBLE_CONVERSION_ROOT_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-install" CACHE STRING "" FORCE) endfunction(download_doubleconversion) diff --git a/cmake/DownloadFizz.cmake b/cmake/DownloadFizz.cmake index 5ce196e..50474b3 100644 --- a/cmake/DownloadFizz.cmake +++ b/cmake/DownloadFizz.cmake @@ -29,6 +29,7 @@ function(download_fizz SOURCE_DIR BUILD_DIR) SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-src" PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake/ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake" INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. diff --git a/cmake/DownloadFolly.cmake b/cmake/DownloadFolly.cmake index 3fcd9dc..010bc47 100644 --- a/cmake/DownloadFolly.cmake +++ b/cmake/DownloadFolly.cmake @@ -27,8 +27,9 @@ function(download_folly SOURCE_DIR BUILD_DIR) SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src" PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} - "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install" + -DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} @@ -36,6 +37,7 @@ function(download_folly SOURCE_DIR BUILD_DIR) -DBOOST_ROOT=${BOOST_ROOT} -DBOOST_INCLUDEDIR=${BOOST_ROOT}/include -DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib + -DBOOST_LIBRARIES=${BOOST_LIBRARIES} "${BUILD_ARGS}" ) set(FOLLY_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-install" CACHE STRING "" FORCE) diff --git a/cmake/FindKrb5.cmake b/cmake/FindKrb5.cmake index 318820a..cd992cd 100644 --- a/cmake/FindKrb5.cmake +++ b/cmake/FindKrb5.cmake @@ -26,7 +26,6 @@ find_library(KRB5_LIBRARIES HINTS ${KRB5_ROOT_DIR}/lib ) - find_library(GSSAPI_KRB5_LIBRARY gssapi_krb5) find_path(KRB5_INCLUDE_DIR diff --git a/cmake/ProtobufGen.cmake b/cmake/ProtobufGen.cmake index 27a3cc7..a44e443 100644 --- a/cmake/ProtobufGen.cmake +++ b/cmake/ProtobufGen.cmake @@ -36,7 +36,7 @@ function(generate_protobuf_src SRCS HDRS HDR_DIR PROTO_PATH) set(${SRCS}) set(${HDRS}) foreach(FIL ${ARGN}) - message("Generating ${FIL} with ${PROTOBUF_PROTOC_EXECUTABLE}") + message("Generating ${FIL} with ${PROTOBUF_PROTOC_EXECUTABLE}") get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) ## get the directory where our protobufs are stored diff --git a/cmake/boost/local/FindBoost.cmake b/cmake/boost/local/FindBoost.cmake index 60d7ee0..52e238e 100644 --- a/cmake/boost/local/FindBoost.cmake +++ b/cmake/boost/local/FindBoost.cmake @@ -22,9 +22,11 @@ set(Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE STRING "" FORCE) set(Boost_LIBRARIES "" CACHE STRING "" FORCE) foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - list(APPEND Boost_LIBRARIES "${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}") + list(APPEND Boost_LIBRARIES "${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}") endforeach() +set(Boost_LIBRARIES "${Boost_LIBRARIES}" CACHE STRING "" FORCE) + set(Boost_FOUND "true" CACHE STRING "" FORCE) mark_as_advanced( @@ -33,4 +35,4 @@ mark_as_advanced( Boost_INCLUDE_DIRS Boost_LIBRARIES ) -message("-- Boost found, ${Boost_LIBRARIES}") +message(STATUS "Boost found, ${Boost_LIBRARIES}") diff --git a/cmake/doubleconversion/system/FindDoubleConversion.cmake b/cmake/doubleconversion/system/FindDoubleConversion.cmake index f65bc2d..d324472 100644 --- a/cmake/doubleconversion/system/FindDoubleConversion.cmake +++ b/cmake/doubleconversion/system/FindDoubleConversion.cmake @@ -14,7 +14,7 @@ # Finds libdouble-conversion. # - DEFINE DOUBLE_CONVERSION_ROOT_DIR to provide a hint +# DEFINE DOUBLE_CONVERSION_ROOT_DIR to provide a hint # This module defines: # DOUBLE_CONVERSION_INCLUDE_DIR # DOUBLE_CONVERSION_LIBRARY From a06358e196071a443d8677f7905087f0eb20c0b0 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Sat, 15 Aug 2020 07:12:55 -0400 Subject: [PATCH 08/12] fix boost build issues --- CMakeLists.txt | 50 ++++++++++++++----------------- cmake/DownloadFolly.cmake | 5 ++-- cmake/DownloadWangle.cmake | 14 +++++---- cmake/boost/local/FindBoost.cmake | 4 ++- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a417034..33f5f8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,13 @@ if (DOWNLOAD_DEPENDENCIES) set(PROTOBUF_PROTOC_EXECUTABLE "${Protobuf_BINARY_DIR}/bin/protoc" CACHE STRING "" FORCE) ## Add CMAKE_MODULE_PATHS + +if(NOT APPLE) + if(NOT WIN32) + set(WHOLE_ARCHIVE "-Wl,--whole-archive") + set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive") + endif() +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zookeeper/local") @@ -256,6 +263,7 @@ SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEA set_target_properties(hbaseclient-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs") target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) target_link_libraries(hbaseclient-static ${SASL_LIBS}) +target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS}) target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES}) @@ -270,7 +278,6 @@ target_link_libraries(hbaseclient-static ${PROTOBUF_LIBRARY}) target_link_libraries(hbaseclient-static ${DOUBLE_CONVERSION_LIBRARY}) target_link_libraries(hbaseclient-static ${ZOOKEEPER_LIBRARIES}) target_link_libraries(hbaseclient-static ${OPENSSL_LIBRARIES}) -target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS}) add_library(hbaseclient-shared SHARED ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC}) set_target_properties(hbaseclient-shared PROPERTIES LINKER_LANGUAGE CXX) @@ -295,26 +302,15 @@ target_link_libraries(hbaseclient-shared ${ZOOKEEPER_LIBRARIES}) target_link_libraries(hbaseclient-shared ${DOUBLE_CONVERSION_LIBRARY}) target_link_libraries(hbaseclient-shared ${CMAKE_DL_LIBS}) add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc") -#set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ") +set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(simple-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") -target_link_libraries(simple-client ${PROTOBUF_LIBRARY}) -#target_link_libraries(simple-client ${Boost_LIBRARIES}) -target_link_libraries(simple-client ${CMAKE_DL_LIBS}) -target_link_libraries(simple-client ${SASL_LIBS}) -target_link_libraries(simple-client ${GFLAGS_SHARED_LIB}) -target_link_libraries(simple-client ${KRB5_LIBRARIES}) -target_link_libraries(simple-client ${ZOOKEEPER_LIBRARIES}) target_link_libraries(simple-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(simple-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE}) add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc") set_target_properties(load-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(load-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") -target_link_libraries(load-client ${PROTOBUF_LIBRARY}) -#target_link_libraries(load-client ${Boost_LIBRARIES}) -target_link_libraries(load-client ${SASL_LIBS}) -target_link_libraries(load-client ${GFLAGS_SHARED_LIB}) -target_link_libraries(load-client ${KRB5_LIBRARIES}) -target_link_libraries(load-client ${ZOOKEEPER_LIBRARIES}) target_link_libraries(load-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(load-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE}) if (JNI_FOUND) message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") @@ -328,23 +324,23 @@ add_custom_target( COMMAND ${CMAKE_SOURCE_DIR}/bin/cpplint.sh) if (DOWNLOAD_DEPENDENCIES) - add_dependencies(hbaseclient-static Protobuf) - add_dependencies(hbaseclient-shared Protobuf) - ## everything relies on folly. fizz relies on folly. wangle - ## relies on folly and fizz + add_dependencies(hbaseclient-static Protobuf) + add_dependencies(hbaseclient-shared Protobuf) + ## everything relies on folly. fizz relies on folly. wangle + ## relies on folly and fizz add_dependencies(facebook-folly-proj boost) add_dependencies(hbaseclient-static boost) add_dependencies(hbaseclient-shared boost) add_dependencies(facebook-folly-proj boost) add_dependencies(facebook-folly-proj doubleconversion-proj) - add_dependencies(facebook-wangle-proj facebook-folly-proj) - add_dependencies(facebook-fizz-proj facebook-folly-proj) - add_dependencies(facebook-wangle-proj facebook-folly-proj) - add_dependencies(facebook-wangle-proj facebook-fizz-proj) - add_dependencies(hbaseclient-static facebook-wangle-proj) - add_dependencies(hbaseclient-shared facebook-wangle-proj) - add_dependencies(hbaseclient-static zookeeper) - add_dependencies(hbaseclient-shared zookeeper) + add_dependencies(facebook-wangle-proj facebook-folly-proj) + add_dependencies(facebook-fizz-proj facebook-folly-proj) + add_dependencies(facebook-wangle-proj facebook-folly-proj) + add_dependencies(facebook-wangle-proj facebook-fizz-proj) + add_dependencies(hbaseclient-static facebook-wangle-proj) + add_dependencies(hbaseclient-shared facebook-wangle-proj) + add_dependencies(hbaseclient-static zookeeper) + add_dependencies(hbaseclient-shared zookeeper) endif(DOWNLOAD_DEPENDENCIES) # Install library headers diff --git a/cmake/DownloadFolly.cmake b/cmake/DownloadFolly.cmake index 010bc47..76d4b63 100644 --- a/cmake/DownloadFolly.cmake +++ b/cmake/DownloadFolly.cmake @@ -25,8 +25,7 @@ function(download_folly SOURCE_DIR BUILD_DIR) GIT_REPOSITORY "https://github.com/facebook/folly.git" GIT_TAG "v2020.05.18.00" SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src" - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake + PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install @@ -38,7 +37,7 @@ function(download_folly SOURCE_DIR BUILD_DIR) -DBOOST_INCLUDEDIR=${BOOST_ROOT}/include -DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib -DBOOST_LIBRARIES=${BOOST_LIBRARIES} - "${BUILD_ARGS}" + "${BUILD_ARGS}" ) set(FOLLY_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-install" CACHE STRING "" FORCE) endfunction(download_folly) diff --git a/cmake/DownloadWangle.cmake b/cmake/DownloadWangle.cmake index 55218ee..bda65e0 100644 --- a/cmake/DownloadWangle.cmake +++ b/cmake/DownloadWangle.cmake @@ -30,12 +30,16 @@ function(download_wangle SOURCE_DIR BUILD_DIR) SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-wangle-proj-src" PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/local/FindFizz.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ - COMMAND patch ${WANGLE_SOURCE_DIR}/wangle/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/wangle.v2020.05.18.00.cmake + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ + COMMAND patch ${WANGLE_SOURCE_DIR}/wangle/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/wangle.v2020.05.18.00.cmake INSTALL_DIR "${WANGLE_INSTALL_DIR}" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFIZZ_ROOT_DIR=${FIZZ_ROOT_DIR} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} - ${WANGLE_SOURCE_DIR}/wangle # Tell CMake to use subdirectory as source. + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFIZZ_ROOT_DIR=${FIZZ_ROOT_DIR} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} + -DBOOST_ROOT=${BOOST_ROOT} + -DBOOST_INCLUDEDIR=${BOOST_ROOT}/include + -DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib + -DBOOST_LIBRARIES=${BOOST_LIBRARIES} + ${WANGLE_SOURCE_DIR}/wangle # Tell CMake to use subdirectory as source. ) set(WANGLE_ROOT_DIR "${WANGLE_INSTALL_DIR}" CACHE STRING "" FORCE) diff --git a/cmake/boost/local/FindBoost.cmake b/cmake/boost/local/FindBoost.cmake index 52e238e..0d5ca19 100644 --- a/cmake/boost/local/FindBoost.cmake +++ b/cmake/boost/local/FindBoost.cmake @@ -22,7 +22,9 @@ set(Boost_INCLUDE_DIR "${BOOST_ROOT}/include" CACHE STRING "" FORCE) set(Boost_LIBRARIES "" CACHE STRING "" FORCE) foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - list(APPEND Boost_LIBRARIES "${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}") + list(APPEND Boost_LIBRARIES "${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}") + set(Boost_${COMPONENT} "${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}" CACHE STRING "" FORCE) + message(STATUS "Found Boost_${COMPONENT} at ${BOOST_ROOT}/lib/${BYPRODUCT_PREFIX}boost_${COMPONENT}${BYPRODUCT_SUFFIX}" ) endforeach() set(Boost_LIBRARIES "${Boost_LIBRARIES}" CACHE STRING "" FORCE) From 08a0b31e21448839986b5be73a1c0d33abc825c0 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Sun, 16 Aug 2020 14:30:29 +0000 Subject: [PATCH 09/12] update --- CMakeLists.txt | 4 +--- cmake/DownloadBoost.cmake | 2 +- cmake/DownloadDoubleConversion.cmake | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33f5f8c..3ce1064 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,11 +85,9 @@ if (DOWNLOAD_DEPENDENCIES) set(PROTOBUF_PROTOC_EXECUTABLE "${Protobuf_BINARY_DIR}/bin/protoc" CACHE STRING "" FORCE) ## Add CMAKE_MODULE_PATHS -if(NOT APPLE) - if(NOT WIN32) +if(LINUX) set(WHOLE_ARCHIVE "-Wl,--whole-archive") set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive") - endif() endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local") diff --git a/cmake/DownloadBoost.cmake b/cmake/DownloadBoost.cmake index 98cf6af..92da50f 100644 --- a/cmake/DownloadBoost.cmake +++ b/cmake/DownloadBoost.cmake @@ -26,7 +26,7 @@ function(download_boost SOURCE_DIR BUILD_DIR BOOST_LIBS) set(BOOST_INSTALL_DIR "${BUILD_DIR}/dependencies/boost-install") set(CFLAGS "-fPIC") - set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14") + set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC") # Only compile and install the needed libs. set(LIBS_TO_COMPILE "") diff --git a/cmake/DownloadDoubleConversion.cmake b/cmake/DownloadDoubleConversion.cmake index 1d6fd9b..db99893 100644 --- a/cmake/DownloadDoubleConversion.cmake +++ b/cmake/DownloadDoubleConversion.cmake @@ -23,7 +23,7 @@ function(download_doubleconversion SOURCE_DIR BUILD_DIR) doubleconversion-proj PREFIX "${BUILD_DIR}/dependencies" GIT_REPOSITORY "https://github.com/google/double-conversion.git" - GIT_TAG "master" + GIT_TAG "b1d531bfb130e7149ffe24bb0f1c5c01f20c3a5f" ## Commit hash from master SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src" CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" -DCMAKE_POSITION_INDEPENDENT_CODE=ON "${BUILD_ARGS}") From 2784cbaffa4a5794db2ced6a3e65cc50cb3f1284 Mon Sep 17 00:00:00 2001 From: Marc Parisi Date: Sun, 16 Aug 2020 21:18:28 +0000 Subject: [PATCH 10/12] add libfmt dev --- docker-files/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-files/Dockerfile b/docker-files/Dockerfile index 4a18d4b..271e3b0 100644 --- a/docker-files/Dockerfile +++ b/docker-files/Dockerfile @@ -30,7 +30,7 @@ ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" RUN apt-get update && \ apt-get install -y vim maven inetutils-ping python-pip doxygen graphviz clang-format valgrind \ wget libgflags-dev libgoogle-glog-dev dh-autoreconf pkg-config libssl-dev build-essential \ - libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev && \ + libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev libfmt-dev && \ pip install yapf && \ apt-get -qq clean && \ apt-get -y -qq autoremove && \ From 4c2ad3a9c59129475a46d0e3194fd7e140cfb835 Mon Sep 17 00:00:00 2001 From: Bharath Vissapragada Date: Sat, 24 Oct 2020 23:12:03 -0700 Subject: [PATCH 11/12] Fix dependency issues - Folly/Wangle should depend on downloaded boost. - Add cyrussasl to the dependency graph - Fix test compilation - Remove libfmt-dev install from apt (not available for 16.04) --- CMakeLists.txt | 30 +++++++++++------------ cmake/BuildTests.cmake | 15 ++---------- cmake/DownloadFizz.cmake | 8 ++---- cmake/DownloadWangle.cmake | 2 +- cmake/patches/fizz.v2020.05.18.00.cmake | 16 +++++++----- cmake/patches/wangle.v2020.05.18.00.cmake | 7 +++--- docker-files/Dockerfile | 2 +- 7 files changed, 34 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ce1064..179461c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,11 +85,6 @@ if (DOWNLOAD_DEPENDENCIES) set(PROTOBUF_PROTOC_EXECUTABLE "${Protobuf_BINARY_DIR}/bin/protoc" CACHE STRING "" FORCE) ## Add CMAKE_MODULE_PATHS -if(LINUX) - set(WHOLE_ARCHIVE "-Wl,--whole-archive") - set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive") -endif() - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zookeeper/local") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf/local") @@ -259,11 +254,6 @@ add_library(hbaseclient-static STATIC ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTIO set_target_properties(hbaseclient-static PROPERTIES LINKER_LANGUAGE CXX) SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) set_target_properties(hbaseclient-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs") -target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) -target_link_libraries(hbaseclient-static ${SASL_LIBS}) -target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS}) -target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) -target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-static ${FIZZ_LIBRARIES}) @@ -276,14 +266,18 @@ target_link_libraries(hbaseclient-static ${PROTOBUF_LIBRARY}) target_link_libraries(hbaseclient-static ${DOUBLE_CONVERSION_LIBRARY}) target_link_libraries(hbaseclient-static ${ZOOKEEPER_LIBRARIES}) target_link_libraries(hbaseclient-static ${OPENSSL_LIBRARIES}) +target_link_libraries(hbaseclient-static ${Boost_LIBRARIES}) +target_link_libraries(hbaseclient-static ${SASL_LIBS}) +target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB}) +target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES}) +target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS}) +target_link_libraries(hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) add_library(hbaseclient-shared SHARED ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC}) set_target_properties(hbaseclient-shared PROPERTIES LINKER_LANGUAGE CXX) SET_TARGET_PROPERTIES(hbaseclient-shared PROPERTIES COMPILE_FLAGS " -fPIC") SET_TARGET_PROPERTIES(hbaseclient-shared PROPERTIES OUTPUT_NAME hbaseclient CLEAN_DIRECT_OUTPUT 1) set_target_properties(hbaseclient-shared PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs") -target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY}) -target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES}) target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES}) if (DOWNLOAD_DEPENDENCIES) target_link_libraries(hbaseclient-shared ${FIZZ_LIBRARIES}) @@ -298,17 +292,19 @@ target_link_libraries(hbaseclient-shared ${OPENSSL_LIBRARIES}) target_link_libraries(hbaseclient-shared ${LIB_EVENT_LIBRARY}) target_link_libraries(hbaseclient-shared ${ZOOKEEPER_LIBRARIES}) target_link_libraries(hbaseclient-shared ${DOUBLE_CONVERSION_LIBRARY}) +target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY}) +target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES}) target_link_libraries(hbaseclient-shared ${CMAKE_DL_LIBS}) +target_link_libraries(hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) + add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc") set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(simple-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") -target_link_libraries(simple-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries(simple-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE}) +target_link_libraries(simple-client hbaseclient-static) add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc") set_target_properties(load-client PROPERTIES COMPILE_FLAGS " ") set_target_properties(load-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples") -target_link_libraries(load-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries(load-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE}) +target_link_libraries(load-client hbaseclient-static) if (JNI_FOUND) message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") @@ -329,6 +325,8 @@ if (DOWNLOAD_DEPENDENCIES) add_dependencies(facebook-folly-proj boost) add_dependencies(hbaseclient-static boost) add_dependencies(hbaseclient-shared boost) + add_dependencies(hbaseclient-static cyrussasl) + add_dependencies(hbaseclient-shared cyrussasl) add_dependencies(facebook-folly-proj boost) add_dependencies(facebook-folly-proj doubleconversion-proj) add_dependencies(facebook-wangle-proj facebook-folly-proj) diff --git a/cmake/BuildTests.cmake b/cmake/BuildTests.cmake index 73ac92a..7af57b2 100644 --- a/cmake/BuildTests.cmake +++ b/cmake/BuildTests.cmake @@ -39,7 +39,7 @@ target_include_directories(testutil PRIVATE BEFORE${Zookeeper_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${KRB5_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${Java_INCLUDE_DIRS}) target_include_directories(testutil PRIVATE BEFORE${FOLLY_INCLUDE_DIRS}) -target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${KRB5_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES}) +target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${KRB5_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES}) function(createTests testName) message (STATUS "Including Test: ${testName}") target_include_directories(${testName} PRIVATE BEFORE "include") @@ -48,18 +48,7 @@ function(createTests testName) target_include_directories(${testName} PRIVATE BEFORE "${Boost_INCLUDE_DIR}") target_include_directories(${testName} PRIVATE BEFORE "${GTEST_INCLUDE_DIRS}") target_include_directories(${testName} PRIVATE BEFORE "${OPENSSL_INCLUDE_DIR}") - target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} - ${Java_LIBRARIES} - ${JNI_LIBRARIES} - ${Boost_LIBRARIES} - ${GFLAGS_SHARED_LIB} - ${GTEST_BOTH_LIBRARIES} - ${KRB5_LIBRARIES} - ${SASL_LIBS} - ${GFLAGS_SHARED_LIB} - ${ZOOKEEPER_LIBRARIES} ${OPENSSL_LIBRARIES} - ${GLOG_SHARED_LIB} - ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${testName} testutil) endfunction() enable_testing(test) SET(TEST_DIR ${CMAKE_SOURCE_DIR}/src/test) diff --git a/cmake/DownloadFizz.cmake b/cmake/DownloadFizz.cmake index 50474b3..7bf6fc9 100644 --- a/cmake/DownloadFizz.cmake +++ b/cmake/DownloadFizz.cmake @@ -20,7 +20,6 @@ ## BINARY_DIR is the build directory, typically 'build' function(download_fizz SOURCE_DIR BUILD_DIR) - ExternalProject_Add( facebook-fizz-proj GIT_REPOSITORY "https://github.com/facebookincubator/fizz.git" @@ -32,10 +31,7 @@ function(download_fizz SOURCE_DIR BUILD_DIR) COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake" INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DBOOST_ROOT=${BOOST_ROOT} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source. ) - - set(FIZZ_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CACHE STRING "" FORCE) - -endfunction(download_fizz) \ No newline at end of file +endfunction(download_fizz) diff --git a/cmake/DownloadWangle.cmake b/cmake/DownloadWangle.cmake index bda65e0..c01bf6c 100644 --- a/cmake/DownloadWangle.cmake +++ b/cmake/DownloadWangle.cmake @@ -34,7 +34,7 @@ function(download_wangle SOURCE_DIR BUILD_DIR) COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake ${WANGLE_SOURCE_DIR}/wangle/cmake/ COMMAND patch ${WANGLE_SOURCE_DIR}/wangle/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/wangle.v2020.05.18.00.cmake INSTALL_DIR "${WANGLE_INSTALL_DIR}" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFIZZ_ROOT_DIR=${FIZZ_ROOT_DIR} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} + CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFIZZ_ROOT_DIR=${FIZZ_ROOT_DIR} -DBOOST_ROOT=${BOOST_ROOT} -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DCMAKE_INSTALL_PREFIX:PATH=${WANGLE_INSTALL_DIR} -DBOOST_ROOT=${BOOST_ROOT} -DBOOST_INCLUDEDIR=${BOOST_ROOT}/include -DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib diff --git a/cmake/patches/fizz.v2020.05.18.00.cmake b/cmake/patches/fizz.v2020.05.18.00.cmake index ca7981f..5601e9e 100644 --- a/cmake/patches/fizz.v2020.05.18.00.cmake +++ b/cmake/patches/fizz.v2020.05.18.00.cmake @@ -1,18 +1,22 @@ -36c36 +36c36,37 < find_package(folly CONFIG REQUIRED) --- > find_package(Folly REQUIRED) -46a47,54 +> find_package(Boost REQUIRED) +46a48,55 > > if(NOT APPLE) > if(NOT WIN32) -> set(WHOLE_ARCHIVE "-Wl,--whole-archive") +> set(WHOLE_ARCHIVE "-Wl,--whole-archive") > set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive") > endif() > endif() > -220a229 +204a214 +> ${Boost_INCLUDE_DIRS} +216a227 +> ${Boost_LIBRARIES} +220a232 > ${WHOLE_ARCHIVE} -221a231 +221a234 > ${NO_WHOLE_ARCHIVE} - diff --git a/cmake/patches/wangle.v2020.05.18.00.cmake b/cmake/patches/wangle.v2020.05.18.00.cmake index c4e022c..48412d2 100644 --- a/cmake/patches/wangle.v2020.05.18.00.cmake +++ b/cmake/patches/wangle.v2020.05.18.00.cmake @@ -1,9 +1,10 @@ -49c49 +45a46 +> find_package(Boost REQUIRED) +49c50 < find_package(folly CONFIG REQUIRED) --- > find_package(Folly REQUIRED) -51c51 +51c52 < find_package(fizz CONFIG REQUIRED) --- > find_package(Fizz REQUIRED) - diff --git a/docker-files/Dockerfile b/docker-files/Dockerfile index 271e3b0..4a18d4b 100644 --- a/docker-files/Dockerfile +++ b/docker-files/Dockerfile @@ -30,7 +30,7 @@ ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" RUN apt-get update && \ apt-get install -y vim maven inetutils-ping python-pip doxygen graphviz clang-format valgrind \ wget libgflags-dev libgoogle-glog-dev dh-autoreconf pkg-config libssl-dev build-essential \ - libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev libfmt-dev && \ + libevent-dev cmake libkrb5-dev git openjdk-8-jdk curl unzip google-mock libsodium-dev && \ pip install yapf && \ apt-get -qq clean && \ apt-get -y -qq autoremove && \ From 42748debcd3e0ea8db07e3989e473f819f40f9c6 Mon Sep 17 00:00:00 2001 From: Bharath Vissapragada Date: Fri, 30 Oct 2020 15:15:25 -0700 Subject: [PATCH 12/12] Compile libfmt from sources. --- docker-files/Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-files/Dockerfile b/docker-files/Dockerfile index 4a18d4b..f8857cc 100644 --- a/docker-files/Dockerfile +++ b/docker-files/Dockerfile @@ -42,10 +42,13 @@ RUN wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \ tar zxf release-1.8.0.tar.gz && \ rm -f release-1.8.0.tar.gz && \ mv googletest-release-1.8.0 gtest && \ - cd gtest && \ - cmake . && \ - make -j4 && \ - make install + cd gtest && cmake . && make -j4 && make install + +## xenial has no libfmt-dev package in apt +RUN wget https://github.com/fmtlib/fmt/archive/7.0.0.tar.gz && \ + tar zxf 7.0.0.tar.gz && rm -f 7.0.0.tar.gz && \ + cd fmt-7.0.0 && \ + cmake . -DCMAKE_BUILD_TYPE=Release -DFMT_TEST=OFF && make -j4 && make install RUN apt-get update && \ apt-get install -y debconf-utils && \