mirror of https://github.com/milvus-io/milvus.git
fix mysql scoped connection concurrency issue
Former-commit-id: ecb3cf07b5f49f2f87e3972a126452ec2950caf8pull/191/head
parent
511a71f476
commit
7f24723ec7
|
@ -271,7 +271,7 @@ endif()
|
|||
if(DEFINED ENV{MILVUS_MYSQLPP_URL})
|
||||
set(MYSQLPP_SOURCE_URL "$ENV{MILVUS_MYSQLPP_URL}")
|
||||
else()
|
||||
set(MYSQLPP_SOURCE_URL "https://github.com/youny626/mysqlpp.git")
|
||||
set(MYSQLPP_SOURCE_URL "https://tangentsoft.com/mysqlpp/releases/mysql++-${MYSQLPP_VERSION}.tar.gz")
|
||||
endif()
|
||||
|
||||
if (DEFINED ENV{MILVUS_OPENBLAS_URL})
|
||||
|
@ -1095,18 +1095,18 @@ macro(build_mysqlpp)
|
|||
"LDFLAGS=-pthread")
|
||||
|
||||
externalproject_add(mysqlpp_ep
|
||||
# URL
|
||||
# ${MYSQLPP_SOURCE_URL}
|
||||
GIT_REPOSITORY
|
||||
URL
|
||||
${MYSQLPP_SOURCE_URL}
|
||||
GIT_TAG
|
||||
${MYSQLPP_VERSION}
|
||||
GIT_SHALLOW
|
||||
TRUE
|
||||
# GIT_REPOSITORY
|
||||
# ${MYSQLPP_SOURCE_URL}
|
||||
# GIT_TAG
|
||||
# ${MYSQLPP_VERSION}
|
||||
# GIT_SHALLOW
|
||||
# TRUE
|
||||
${EP_LOG_OPTIONS}
|
||||
CONFIGURE_COMMAND
|
||||
"./bootstrap"
|
||||
COMMAND
|
||||
# "./bootstrap"
|
||||
# COMMAND
|
||||
"./configure"
|
||||
${MYSQLPP_CONFIGURE_ARGS}
|
||||
BUILD_COMMAND
|
||||
|
|
|
@ -10,7 +10,7 @@ db_config:
|
|||
db_path: /tmp/milvus
|
||||
#URI format: dialect://username:password@host:port/database
|
||||
#All parts except dialect are optional, but you MUST include the delimiters
|
||||
db_backend_url: sqlite://:@:/
|
||||
db_backend_url: mysql://root:1234@:/test
|
||||
index_building_threshold: 1024 #build index file when raw data file size larger than this value, unit: MB
|
||||
|
||||
metric_config:
|
||||
|
|
|
@ -183,7 +183,10 @@ endif ()
|
|||
|
||||
install(TARGETS milvus_server DESTINATION bin)
|
||||
|
||||
install(FILES ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
install(FILES
|
||||
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3
|
||||
${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3.2.4
|
||||
DESTINATION bin) #need to copy libmysqlpp.so
|
||||
|
||||
add_subdirectory(sdk)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
class MySQLConnectionPool : public mysqlpp::ConnectionPool {
|
||||
|
||||
public:
|
||||
|
@ -43,6 +45,7 @@ public:
|
|||
sleep(1);
|
||||
}
|
||||
|
||||
ENGINE_LOG_DEBUG << "conns_in_use_ in grab: " << conns_in_use_ << std::endl;
|
||||
++conns_in_use_;
|
||||
return mysqlpp::ConnectionPool::grab();
|
||||
}
|
||||
|
@ -50,7 +53,11 @@ public:
|
|||
// Other half of in-use conn count limit
|
||||
void release(const mysqlpp::Connection* pc) override {
|
||||
mysqlpp::ConnectionPool::release(pc);
|
||||
ENGINE_LOG_DEBUG << "conns_in_use_ in release: " << conns_in_use_ << std::endl;
|
||||
--conns_in_use_;
|
||||
if (conns_in_use_ < 0) {
|
||||
ENGINE_LOG_DEBUG << "conns_in_use_ in release < 0: " << conns_in_use_ << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void set_max_idle_time(int max_idle) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ GTEST_VERSION=1.8.1
|
|||
JSONCONS_VERSION=0.126.0
|
||||
LAPACK_VERSION=v3.8.0
|
||||
LZ4_VERSION=v1.9.1
|
||||
MYSQLPP_VERSION=zilliz
|
||||
MYSQLPP_VERSION=3.2.4
|
||||
OPENBLAS_VERSION=v0.3.6
|
||||
PROMETHEUS_VERSION=v0.7.0
|
||||
ROCKSDB_VERSION=v6.0.2
|
||||
|
|
Loading…
Reference in New Issue