From b6f22c737087c02babf4569eac4bf1fa1f574a41 Mon Sep 17 00:00:00 2001 From: groot Date: Thu, 5 Dec 2019 06:08:15 -0600 Subject: [PATCH 1/4] Fix unittest failure (#714) --- core/unittest/db/test_meta.cpp | 4 ++-- core/unittest/db/test_meta_mysql.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/unittest/db/test_meta.cpp b/core/unittest/db/test_meta.cpp index bb8641fac5..f61fbf7f6a 100644 --- a/core/unittest/db/test_meta.cpp +++ b/core/unittest/db/test_meta.cpp @@ -371,8 +371,8 @@ TEST_F(MetaTest, INDEX_TEST) { status = impl_->DropTableIndex(table_id); ASSERT_TRUE(status.ok()); status = impl_->DescribeTableIndex(table_id, index_out); - ASSERT_NE(index_out.metric_type_, index.metric_type_); - ASSERT_NE(index_out.nlist_, index.nlist_); + ASSERT_EQ(index_out.metric_type_, index.metric_type_); + ASSERT_EQ(index_out.nlist_, index.nlist_); ASSERT_NE(index_out.engine_type_, index.engine_type_); status = impl_->UpdateTableFilesToIndex(table_id); diff --git a/core/unittest/db/test_meta_mysql.cpp b/core/unittest/db/test_meta_mysql.cpp index f77defe2f6..3c75c5b6c4 100644 --- a/core/unittest/db/test_meta_mysql.cpp +++ b/core/unittest/db/test_meta_mysql.cpp @@ -385,8 +385,8 @@ TEST_F(MySqlMetaTest, INDEX_TEST) { status = impl_->DropTableIndex(table_id); ASSERT_TRUE(status.ok()); status = impl_->DescribeTableIndex(table_id, index_out); - ASSERT_NE(index_out.metric_type_, index.metric_type_); - ASSERT_NE(index_out.nlist_, index.nlist_); + ASSERT_EQ(index_out.metric_type_, index.metric_type_); + ASSERT_EQ(index_out.nlist_, index.nlist_); ASSERT_NE(index_out.engine_type_, index.engine_type_); status = impl_->UpdateTableFilesToIndex(table_id); From 5bec93bffa28ec91525398507d15cd5a3a3dda6c Mon Sep 17 00:00:00 2001 From: groot Date: Fri, 6 Dec 2019 00:30:17 -0600 Subject: [PATCH 2/4] Set nlist to default after drop index (#719) * #670 Random failure of unittest db_test::SEARCH_TEST * add an important log * add an important log * add an important log * #674 server down in stability test * add more log * remove log * #696 metric_type changed from IP to L2 * #696 metric_type changed from IP to L2 * #696 metric_type changed from IP to L2 --- core/src/db/meta/MySQLMetaImpl.cpp | 1 + core/src/db/meta/SqliteMetaImpl.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/db/meta/MySQLMetaImpl.cpp b/core/src/db/meta/MySQLMetaImpl.cpp index 51a642aa11..57cce25c42 100644 --- a/core/src/db/meta/MySQLMetaImpl.cpp +++ b/core/src/db/meta/MySQLMetaImpl.cpp @@ -1138,6 +1138,7 @@ MySQLMetaImpl::DropTableIndex(const std::string& table_id) { // set table index type to raw dropTableIndexQuery << "UPDATE " << META_TABLES << " SET engine_type = " << std::to_string(DEFAULT_ENGINE_TYPE) + << " ,nlist = " << std::to_string(DEFAULT_NLIST) << " WHERE table_id = " << mysqlpp::quote << table_id << ";"; ENGINE_LOG_DEBUG << "MySQLMetaImpl::DropTableIndex: " << dropTableIndexQuery.str(); diff --git a/core/src/db/meta/SqliteMetaImpl.cpp b/core/src/db/meta/SqliteMetaImpl.cpp index edd8187ba9..98a5505dd2 100644 --- a/core/src/db/meta/SqliteMetaImpl.cpp +++ b/core/src/db/meta/SqliteMetaImpl.cpp @@ -733,7 +733,8 @@ SqliteMetaImpl::DropTableIndex(const std::string& table_id) { //set table index type to raw ConnectorPtr->update_all( set( - c(&TableSchema::engine_type_) = DEFAULT_ENGINE_TYPE), + c(&TableSchema::engine_type_) = DEFAULT_ENGINE_TYPE, + c(&TableSchema::nlist_) = DEFAULT_NLIST), where( c(&TableSchema::table_id_) == table_id)); From 11935267193b60a4feb0a6d462897d1d4b56af79 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Fri, 6 Dec 2019 14:31:53 +0800 Subject: [PATCH 3/4] show last commit id when server start (#717) * #709 show last commit id when server start * #709 fix typo error --- CHANGELOG.md | 1 + core/CMakeLists.txt | 17 +++++++++++++++++ core/src/main.cpp | 1 + core/src/version.h.in | 3 ++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 850a271008..eb594dc44f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Please mark all change in change log and use the ticket from JIRA. - \#560 - Add version in server config file - \#605 - Print more messages when server start - \#644 - Add a new rpc command to get milvus build version whether cpu or gpu +- \#709 - Show last commit id when server start ## Improvement - \#255 - Add ivfsq8 test report detailed version diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index dd482f6464..0b02109bf4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -23,6 +23,7 @@ message(STATUS "Building using CMake version: ${CMAKE_VERSION}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +# get build time MACRO(GET_CURRENT_TIME CURRENT_TIME) execute_process(COMMAND "date" +"%Y-%m-%d %H:%M.%S" OUTPUT_VARIABLE ${CURRENT_TIME}) ENDMACRO(GET_CURRENT_TIME) @@ -35,6 +36,7 @@ if (NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.") endif () +# get Milvus version via branch name set(GIT_BRANCH_NAME_REGEX "[0-9]+\\.[0-9]+\\.[0-9]") MACRO(GET_GIT_BRANCH_NAME GIT_BRANCH_NAME) @@ -57,6 +59,21 @@ endif () set(MILVUS_VERSION "${GIT_BRANCH_NAME}") string(REGEX MATCH "${GIT_BRANCH_NAME_REGEX}" MILVUS_VERSION "${MILVUS_VERSION}") +# get last commit id +MACRO(GET_LAST_COMMIT_ID LAST_COMMIT_ID) + execute_process(COMMAND sh "-c" "git log --decorate | head -n 1 | awk '{print $2}'" + OUTPUT_VARIABLE ${LAST_COMMIT_ID}) +ENDMACRO(GET_LAST_COMMIT_ID) + +GET_LAST_COMMIT_ID(LAST_COMMIT_ID) +message(STATUS "LAST_COMMIT_ID = ${LAST_COMMIT_ID}") +if (NOT LAST_COMMIT_ID STREQUAL "") + string(REGEX REPLACE "\n" "" LAST_COMMIT_ID ${LAST_COMMIT_ID}) +endif () + +set(LAST_COMMIT_ID "${LAST_COMMIT_ID}") + +# set build type if (CMAKE_BUILD_TYPE STREQUAL "Release") set(BUILD_TYPE "Release") else () diff --git a/core/src/main.cpp b/core/src/main.cpp index 670a992d29..4b1d16fde3 100644 --- a/core/src/main.cpp +++ b/core/src/main.cpp @@ -63,6 +63,7 @@ print_banner() { #else std::cout << "You are using Milvus CPU edition" << std::endl; #endif + std::cout << "Last commit id: " << LAST_COMMIT_ID << std::endl; std::cout << std::endl; } diff --git a/core/src/version.h.in b/core/src/version.h.in index 989010cde8..81d282f942 100644 --- a/core/src/version.h.in +++ b/core/src/version.h.in @@ -17,4 +17,5 @@ #cmakedefine MILVUS_VERSION "@MILVUS_VERSION@" #cmakedefine BUILD_TYPE "@BUILD_TYPE@" -#cmakedefine BUILD_TIME @BUILD_TIME@ \ No newline at end of file +#cmakedefine BUILD_TIME @BUILD_TIME@ +#cmakedefine LAST_COMMIT_ID "@LAST_COMMIT_ID@" From 2b40ddbb277e06e03a3a85a29b07cd1225538e48 Mon Sep 17 00:00:00 2001 From: groot Date: Fri, 6 Dec 2019 02:40:51 -0600 Subject: [PATCH 4/4] fix unittest (#720) * #670 Random failure of unittest db_test::SEARCH_TEST * add an important log * add an important log * add an important log * #674 server down in stability test * add more log * remove log * #696 metric_type changed from IP to L2 * #696 metric_type changed from IP to L2 * #696 metric_type changed from IP to L2 * #696 metric_type changed from IP to L2 --- core/unittest/db/test_meta.cpp | 2 +- core/unittest/db/test_meta_mysql.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/unittest/db/test_meta.cpp b/core/unittest/db/test_meta.cpp index f61fbf7f6a..30ac9647da 100644 --- a/core/unittest/db/test_meta.cpp +++ b/core/unittest/db/test_meta.cpp @@ -372,7 +372,7 @@ TEST_F(MetaTest, INDEX_TEST) { ASSERT_TRUE(status.ok()); status = impl_->DescribeTableIndex(table_id, index_out); ASSERT_EQ(index_out.metric_type_, index.metric_type_); - ASSERT_EQ(index_out.nlist_, index.nlist_); + ASSERT_NE(index_out.nlist_, index.nlist_); ASSERT_NE(index_out.engine_type_, index.engine_type_); status = impl_->UpdateTableFilesToIndex(table_id); diff --git a/core/unittest/db/test_meta_mysql.cpp b/core/unittest/db/test_meta_mysql.cpp index 3c75c5b6c4..e550651ce2 100644 --- a/core/unittest/db/test_meta_mysql.cpp +++ b/core/unittest/db/test_meta_mysql.cpp @@ -386,7 +386,7 @@ TEST_F(MySqlMetaTest, INDEX_TEST) { ASSERT_TRUE(status.ok()); status = impl_->DescribeTableIndex(table_id, index_out); ASSERT_EQ(index_out.metric_type_, index.metric_type_); - ASSERT_EQ(index_out.nlist_, index.nlist_); + ASSERT_NE(index_out.nlist_, index.nlist_); ASSERT_NE(index_out.engine_type_, index.engine_type_); status = impl_->UpdateTableFilesToIndex(table_id);