From fc6e31c8b028fe6e700543f5e2a5541e34ccf3da Mon Sep 17 00:00:00 2001 From: FluorineDog Date: Wed, 26 Aug 2020 17:38:45 +0800 Subject: [PATCH] Add test for unique_ptr manual release Signed-off-by: FluorineDog --- .gitignore | 1 + core/unittest/test_dog_segment.cpp | 3 +- proxy/cmake/DefineOptions.cmake | 1 + proxy/src/version.h | 6 +-- proxy/thirdparty/CMakeLists.txt | 5 ++ .../pulsar-client-cpp/CMakeLists.txt | 46 +++++++++++++++++++ proxy/thirdparty/versions.txt | 2 +- 7 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 proxy/thirdparty/pulsar-client-cpp/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 643c8a72ac..d0406b0029 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ #proxy proxy/cmake_build +proxy/cmake-build-debug proxy/thirdparty/grpc-src proxy/thirdparty/grpc-build .idea/ diff --git a/core/unittest/test_dog_segment.cpp b/core/unittest/test_dog_segment.cpp index e0fa51d68b..e8e9a957b5 100644 --- a/core/unittest/test_dog_segment.cpp +++ b/core/unittest/test_dog_segment.cpp @@ -163,11 +163,12 @@ TEST(DogSegmentTest, MockTest) { auto line_sizeof = (sizeof(int) + sizeof(float) * 16); assert(raw_data.size() == line_sizeof * N); - auto segment = CreateSegment(schema); + auto segment = CreateSegment(schema).release(); DogDataChunk data_chunk{raw_data.data(), (int)line_sizeof, N}; segment->Insert(N, uids.data(), timestamps.data(), data_chunk); QueryResult query_result; segment->Query(nullptr, 0, query_result); + delete segment; int i = 0; i++; } diff --git a/proxy/cmake/DefineOptions.cmake b/proxy/cmake/DefineOptions.cmake index 699f5f7d8f..32aed8fb18 100644 --- a/proxy/cmake/DefineOptions.cmake +++ b/proxy/cmake/DefineOptions.cmake @@ -72,6 +72,7 @@ define_option(MILVUS_WITH_OPENTRACING "Build with Opentracing" ON) define_option(MILVUS_WITH_YAMLCPP "Build with yaml-cpp library" ON) +define_option(MILVUS_WITH_PULSAR "Build with pulsar-client" ON) #---------------------------------------------------------------------- set_option_category("Test and benchmark") diff --git a/proxy/src/version.h b/proxy/src/version.h index ae9a0b7347..b469eb6736 100644 --- a/proxy/src/version.h +++ b/proxy/src/version.h @@ -10,6 +10,6 @@ // or implied. See the License for the specific language governing permissions and limitations under the License. #define MILVUS_VERSION "0.10.0" -#define BUILD_TYPE "Release" -#define BUILD_TIME "2020-08-24 14:23.26" -#define LAST_COMMIT_ID "83d51fc3196e51a3057e1fb716ee4f4be10ec0c1" +#define BUILD_TYPE "Debug" +#define BUILD_TIME "2020-08-26 10:38.42" +#define LAST_COMMIT_ID "d4541146463566c35477391afb0573a57b00a94e" diff --git a/proxy/thirdparty/CMakeLists.txt b/proxy/thirdparty/CMakeLists.txt index 7794212461..a3ea31b1e5 100644 --- a/proxy/thirdparty/CMakeLists.txt +++ b/proxy/thirdparty/CMakeLists.txt @@ -52,3 +52,8 @@ if ( MILVUS_WITH_OPENTRACING ) add_subdirectory( opentracing ) endif() + +# ****************************** Thirdparty pulsar-client-cpp *************************************** +if ( MILVUS_WITH_PULSAR ) + add_subdirectory(pulsar-client-cpp) +endif() \ No newline at end of file diff --git a/proxy/thirdparty/pulsar-client-cpp/CMakeLists.txt b/proxy/thirdparty/pulsar-client-cpp/CMakeLists.txt new file mode 100644 index 0000000000..289dfbb846 --- /dev/null +++ b/proxy/thirdparty/pulsar-client-cpp/CMakeLists.txt @@ -0,0 +1,46 @@ +#------------------------------------------------------------------------------- +# Copyright (C) 2019-2020 Zilliz. All rights reserved. +# +# 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. +#------------------------------------------------------------------------------- + +if (DEFINED ENV{MILVUS_PULSAR_URL}) + set(PULSAR_URL "$ENV{MILVUS_PULSAR_URL}") +else () + set(PULSAR_URL + "https://github.com/apache/pulsar/archive/${PULSAR_CLIENT_CPP_VERSION}.zip") +endif () + +message(STATUS "Building pulsar-client-cpp-${PULSAR_CLIENT_CPP_VERSION} from source") + +FetchContent_Declare( + pulsar + URL ${PULSAR_URL} + # URL_MD5 "f9137c5bc18b7d74027936f0f1bfa5c8" + DOWNLOAD_DIR ${MILVUS_BINARY_DIR}/3rdparty_download/download +) + + +if (NOT pulsar_POPULATED) + FetchContent_Populate(pulsar) + + # Adding the following targets: + # pulsar-client-cpp + add_subdirectory(${pulsar_SOURCE_DIR}/pulsar-client-cpp + ${pulsar_BINARY_DIR} + EXCLUDE_FROM_ALL) +endif () + + +#get_target_property( YAML_CPP_INCLUDE_DIR pulsar-client-cpp INTERFACE_INCLUDE_DIRECTORIES ) +#message( STATUS ${YAML_CPP_INCLUDE_DIR} ) + +get_property(var DIRECTORY "${pulsar_SOURCE_DIR}/pulsar-client-cpp" PROPERTY COMPILE_OPTIONS) +message(STATUS "pulsar-client-cpp compile options: ${var}") diff --git a/proxy/thirdparty/versions.txt b/proxy/thirdparty/versions.txt index 50281612ca..bf4c8d50e6 100644 --- a/proxy/thirdparty/versions.txt +++ b/proxy/thirdparty/versions.txt @@ -4,5 +4,5 @@ GRPC_VERSION=9a62f6e05d0be96df674d60a66f330a085ced095 YAMLCPP_VERSION=0.6.3 ZLIB_VERSION=v1.2.11 OPENTRACING_VERSION=v1.5.1 - +PULSAR_CLIENT_CPP_VERSION=v2.6.1 # vim: set filetype=sh: