mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-04 11:18:44 +08:00
Merge branch 'branch-0.5.0' into refactor_knowhere
Former-commit-id: 005c77538d7c2d0b52015a748a04da6d171d0f3d
This commit is contained in:
commit
aff9491824
20
.clang-format
Normal file
20
.clang-format
Normal file
@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
DerivePointerAlignment: false
|
||||
ColumnLimit: 120
|
||||
31
.clang-tidy
Normal file
31
.clang-tidy
Normal file
@ -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.
|
||||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*'
|
||||
# produce HeaderFilterRegex from cpp/build-support/lint_exclusions.txt with:
|
||||
# echo -n '^('; sed -e 's/*/\.*/g' cpp/build-support/lint_exclusions.txt | tr '\n' '|'; echo ')$'
|
||||
HeaderFilterRegex: '^(.*cmake-build-debug.*|.*cmake-build-release.*|.*cmake_build.*|.*src/thirdparty.*|.*src/core/thirdparty.*|.*src/grpc.*|)$'
|
||||
AnalyzeTemporaryDtors: true
|
||||
CheckOptions:
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
19
.clang-tidy-ignore
Normal file
19
.clang-tidy-ignore
Normal file
@ -0,0 +1,19 @@
|
||||
# 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.
|
||||
#
|
||||
# ipc-adapter-test.cc
|
||||
# memory-pool-test.cc
|
||||
@ -5,7 +5,7 @@ try {
|
||||
dir ("milvus-helm") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus-helm.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
dir ("milvus/milvus-cluster") {
|
||||
sh "helm install --wait --timeout 300 --set roServers.image.tag=${DOCKER_VERSION} --set woServers.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP -f ci/values.yaml --name ${env.JOB_NAME}-${env.BUILD_NUMBER}-cluster --namespace milvus-cluster --version 0.4.0 . "
|
||||
sh "helm install --wait --timeout 300 --set roServers.image.tag=${DOCKER_VERSION} --set woServers.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP -f ci/values.yaml --name ${env.JOB_NAME}-${env.BUILD_NUMBER}-cluster --namespace milvus-cluster --version 0.5.0 . "
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@ -5,7 +5,7 @@ try {
|
||||
dir ("milvus-helm") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus-helm.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
dir ("milvus/milvus-gpu") {
|
||||
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.4.0 ."
|
||||
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.5.0 ."
|
||||
}
|
||||
}
|
||||
} catch (exc) {
|
||||
|
||||
@ -5,7 +5,7 @@ try {
|
||||
dir ("milvus-helm") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus-helm.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
dir ("milvus/milvus-gpu") {
|
||||
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.4.0 ."
|
||||
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/values.yaml --namespace milvus-1 --version 0.5.0 ."
|
||||
}
|
||||
}
|
||||
} catch (exc) {
|
||||
|
||||
@ -3,7 +3,7 @@ timeout(time: 30, unit: 'MINUTES') {
|
||||
dir ("${PROJECT_NAME}_test") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:Test/milvus_test.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
sh 'python3 -m pip install -r requirements.txt'
|
||||
sh "pytest . --alluredir=\"test_out/dev/single/sqlite\" --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-1.svc.cluster.local"
|
||||
sh "pytest . --alluredir=\"test_out/dev/single/sqlite\" --level=1 --ip ${env.JOB_NAME}-${env.BUILD_NUMBER}-milvus-gpu-engine.milvus-1.svc.cluster.local"
|
||||
}
|
||||
|
||||
// mysql database backend test
|
||||
@ -16,7 +16,7 @@ timeout(time: 30, unit: 'MINUTES') {
|
||||
}
|
||||
dir ("milvus-helm") {
|
||||
dir ("milvus/milvus-gpu") {
|
||||
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.4.0 ."
|
||||
sh "helm install --wait --timeout 300 --set engine.image.tag=${DOCKER_VERSION} --set expose.type=clusterIP --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.5.0 ."
|
||||
}
|
||||
}
|
||||
dir ("${PROJECT_NAME}_test") {
|
||||
|
||||
@ -5,17 +5,12 @@ container('milvus-build-env') {
|
||||
try {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption',disableSubmodules: false,parentCredentials: true,recursiveSubmodules: true,reference: '',trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
|
||||
/*
|
||||
dir ("cpp/thirdparty/knowhere") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption',disableSubmodules: false,parentCredentials: true,recursiveSubmodules: true,reference: '',trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/knowhere.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
sh "./build.sh -t ${params.BUILD_TYPE} -p ${knowhere_build_dir} -j"
|
||||
}
|
||||
*/
|
||||
|
||||
dir ("cpp") {
|
||||
sh "git config --global user.email \"test@zilliz.com\""
|
||||
sh "git config --global user.name \"test\""
|
||||
sh "./build.sh -t ${params.BUILD_TYPE} -j -u -c"
|
||||
withCredentials([usernamePassword(credentialsId: "${params.JFROG_USER}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh "export JFROG_ARTFACTORY_URL='${params.JFROG_ARTFACTORY_URL}' && export JFROG_USER_NAME='${USERNAME}' && export JFROG_PASSWORD='${PASSWORD}' && ./build.sh -t ${params.BUILD_TYPE} -j -u -c"
|
||||
}
|
||||
}
|
||||
} catch (exc) {
|
||||
updateGitlabCommitStatus name: 'Build Engine', state: 'failed'
|
||||
|
||||
@ -5,17 +5,12 @@ container('milvus-build-env') {
|
||||
try {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption',disableSubmodules: false,parentCredentials: true,recursiveSubmodules: true,reference: '',trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/milvus.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
|
||||
/*
|
||||
dir ("cpp/thirdparty/knowhere") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: "${SEMVER}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption',disableSubmodules: false,parentCredentials: true,recursiveSubmodules: true,reference: '',trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${params.GIT_USER}", url: "git@192.168.1.105:megasearch/knowhere.git", name: 'origin', refspec: "+refs/heads/${SEMVER}:refs/remotes/origin/${SEMVER}"]]])
|
||||
sh "./build.sh -t ${params.BUILD_TYPE} -p ${knowhere_build_dir} -j"
|
||||
}
|
||||
*/
|
||||
|
||||
dir ("cpp") {
|
||||
sh "git config --global user.email \"test@zilliz.com\""
|
||||
sh "git config --global user.name \"test\""
|
||||
sh "./build.sh -t ${params.BUILD_TYPE} -j"
|
||||
withCredentials([usernamePassword(credentialsId: "${params.JFROG_USER}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh "export JFROG_ARTFACTORY_URL='${params.JFROG_ARTFACTORY_URL}' && export JFROG_USER_NAME='${USERNAME}' && export JFROG_PASSWORD='${PASSWORD}' && ./build.sh -t ${params.BUILD_TYPE} -j"
|
||||
}
|
||||
}
|
||||
} catch (exc) {
|
||||
updateGitlabCommitStatus name: 'Build Engine', state: 'failed'
|
||||
|
||||
@ -17,7 +17,7 @@ timeout(time: 40, unit: 'MINUTES') {
|
||||
}
|
||||
dir ("milvus-helm") {
|
||||
dir ("milvus/milvus-gpu") {
|
||||
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.4.0 ."
|
||||
sh "helm install --wait --timeout 300 --set engine.image.repository=\"zilliz.azurecr.cn/milvus/engine\" --set engine.image.tag=${DOCKER_VERSION} --set expose.type=loadBalancer --name ${env.JOB_NAME}-${env.BUILD_NUMBER} -f ci/db_backend/mysql_values.yaml --namespace milvus-2 --version 0.5.0 ."
|
||||
}
|
||||
}
|
||||
dir ("${PROJECT_NAME}_test") {
|
||||
|
||||
59
cmake-format.py
Normal file
59
cmake-format.py
Normal file
@ -0,0 +1,59 @@
|
||||
# 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.
|
||||
|
||||
# cmake-format configuration file
|
||||
# Use run-cmake-format.py to reformat all cmake files in the source tree
|
||||
|
||||
# How wide to allow formatted cmake files
|
||||
line_width = 90
|
||||
|
||||
# How many spaces to tab for indent
|
||||
tab_size = 2
|
||||
|
||||
# If arglists are longer than this, break them always
|
||||
max_subargs_per_line = 4
|
||||
|
||||
# If true, separate flow control names from their parentheses with a space
|
||||
separate_ctrl_name_with_space = False
|
||||
|
||||
# If true, separate function names from parentheses with a space
|
||||
separate_fn_name_with_space = False
|
||||
|
||||
# If a statement is wrapped to more than one line, than dangle the closing
|
||||
# parenthesis on it's own line
|
||||
dangle_parens = False
|
||||
|
||||
# What style line endings to use in the output.
|
||||
line_ending = 'unix'
|
||||
|
||||
# Format command names consistently as 'lower' or 'upper' case
|
||||
command_case = 'lower'
|
||||
|
||||
# Format keywords consistently as 'lower' or 'upper' case
|
||||
keyword_case = 'unchanged'
|
||||
|
||||
# enable comment markup parsing and reflow
|
||||
enable_markup = False
|
||||
|
||||
# If comment markup is enabled, don't reflow the first comment block in
|
||||
# eachlistfile. Use this to preserve formatting of your
|
||||
# copyright/licensestatements.
|
||||
first_comment_is_literal = False
|
||||
|
||||
# If comment markup is enabled, don't reflow any comment block which matchesthis
|
||||
# (regex) pattern. Default is `None` (disabled).
|
||||
literal_comment_pattern = None
|
||||
@ -18,7 +18,9 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-562 - Add JobMgr and TaskCreator in Scheduler
|
||||
- MS-566 - Refactor cmake
|
||||
- MS-555 - Remove old scheduler
|
||||
- MS-578 - Makesure milvus5.0 don't crack 0.3.1 data
|
||||
- MS-574 - Milvus configuration refactor
|
||||
- MS-578 - Make sure milvus5.0 don't crack 0.3.1 data
|
||||
- MS-585 - Update namespace in scheduler
|
||||
|
||||
## New Feature
|
||||
|
||||
@ -28,6 +30,8 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-567 - Add NOTICE.md
|
||||
- MS-569 - Complete the NOTICE.md
|
||||
- MS-575 - Add Clang-format & Clang-tidy & Cpplint
|
||||
- MS-586 - Remove BUILD_FAISS_WITH_MKL option
|
||||
- MS-590 - Refine cmake code to support cpplint
|
||||
|
||||
# Milvus 0.4.0 (2019-09-12)
|
||||
|
||||
@ -62,6 +66,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-510 - unittest out of memory and crashed
|
||||
- MS-507 - Dataset 10m-512, index type sq8,performance in-normal when set CPU_CACHE to 16 or 64
|
||||
- MS-543 - SearchTask fail without exception
|
||||
- MS-582 - grafana displays changes frequently
|
||||
|
||||
## Improvement
|
||||
- MS-327 - Clean code for milvus
|
||||
@ -147,6 +152,8 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-539 - Remove old task code
|
||||
- MS-546 - Add simple mode resource_config
|
||||
- MS-570 - Add prometheus docker-compose file
|
||||
- MS-576 - Scheduler refactor
|
||||
- MS-592 - Change showtables stream transport to unary
|
||||
|
||||
## New Feature
|
||||
- MS-343 - Implement ResourceMgr
|
||||
|
||||
@ -43,15 +43,7 @@ endif()
|
||||
set(MILVUS_VERSION "${GIT_BRANCH_NAME}")
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]" MILVUS_VERSION "${MILVUS_VERSION}")
|
||||
|
||||
set(CLANG_FORMAT_VERSION "6.0")
|
||||
find_package(ClangTools)
|
||||
if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
|
||||
# Generate a Clang compile_commands.json "compilation database" file for use
|
||||
# with various development tools, such as Vim's YouCompleteMe plugin.
|
||||
# See http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
||||
endif()
|
||||
|
||||
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
@ -64,6 +56,9 @@ message(STATUS "Build type = ${BUILD_TYPE}")
|
||||
project(milvus VERSION "${MILVUS_VERSION}")
|
||||
project(milvus_engine LANGUAGES CUDA CXX)
|
||||
|
||||
unset(CMAKE_EXPORT_COMPILE_COMMANDS CACHE)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(MILVUS_VERSION_MAJOR "${milvus_VERSION_MAJOR}")
|
||||
set(MILVUS_VERSION_MINOR "${milvus_VERSION_MINOR}")
|
||||
set(MILVUS_VERSION_PATCH "${milvus_VERSION_PATCH}")
|
||||
@ -72,7 +67,7 @@ if(MILVUS_VERSION_MAJOR STREQUAL ""
|
||||
OR MILVUS_VERSION_MINOR STREQUAL ""
|
||||
OR MILVUS_VERSION_PATCH STREQUAL "")
|
||||
message(WARNING "Failed to determine Milvus version from git branch name")
|
||||
set(MILVUS_VERSION "0.4.0")
|
||||
set(MILVUS_VERSION "0.5.0")
|
||||
endif()
|
||||
|
||||
message(STATUS "Build version = ${MILVUS_VERSION}")
|
||||
@ -180,12 +175,29 @@ if(NOT LINT_EXCLUSIONS_FILE)
|
||||
set(LINT_EXCLUSIONS_FILE ${BUILD_SUPPORT_DIR}/lint_exclusions.txt)
|
||||
endif()
|
||||
|
||||
find_program(CPPLINT_BIN NAMES cpplint cpplint.py HINTS ${BUILD_SUPPORT_DIR})
|
||||
message(STATUS "Found cpplint executable at ${CPPLINT_BIN}")
|
||||
|
||||
#
|
||||
# "make format" and "make check-format" targets
|
||||
# "make lint" targets
|
||||
#
|
||||
add_custom_target(lint
|
||||
${PYTHON_EXECUTABLE}
|
||||
${BUILD_SUPPORT_DIR}/run_cpplint.py
|
||||
--cpplint_binary
|
||||
${CPPLINT_BIN}
|
||||
--exclude_globs
|
||||
${LINT_EXCLUSIONS_FILE}
|
||||
--source_dir
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${MILVUS_LINT_QUIET})
|
||||
|
||||
#
|
||||
# "make clang-format" and "make check-clang-format" targets
|
||||
#
|
||||
if(${CLANG_FORMAT_FOUND})
|
||||
# runs clang format and updates files in place.
|
||||
add_custom_target(format
|
||||
add_custom_target(clang-format
|
||||
${PYTHON_EXECUTABLE}
|
||||
${BUILD_SUPPORT_DIR}/run_clang_format.py
|
||||
--clang_format_binary
|
||||
@ -198,7 +210,7 @@ if(${CLANG_FORMAT_FOUND})
|
||||
${MILVUS_LINT_QUIET})
|
||||
|
||||
# runs clang format and exits with a non-zero exit code if any files need to be reformatted
|
||||
add_custom_target(check-format
|
||||
add_custom_target(check-clang-format
|
||||
${PYTHON_EXECUTABLE}
|
||||
${BUILD_SUPPORT_DIR}/run_clang_format.py
|
||||
--clang_format_binary
|
||||
|
||||
@ -4,7 +4,7 @@ First of all, thanks for taking the time to contribute to Milvus! It's people li
|
||||
|
||||
The following are a set of guidelines for contributing to Milvus. Following these guidelines helps contributing to this project easy and transparent. These are mostly guideline, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
||||
|
||||
As for everything else in the project, the contributions to Milvus are governed by our [Code of Conduct](http://hood.ie/code-of-conduct/).
|
||||
As for everything else in the project, the contributions to Milvus are governed by our [Code of Conduct](CODE OF CONDUCT.md).
|
||||
|
||||
TOC
|
||||
|
||||
@ -36,21 +36,30 @@ The Milvus team members will review your pull requests, and once it is accepted,
|
||||
|
||||
Before sending your pull requests for review, make sure your changes are consistent with the guidelines and follow the Milvus coding style.
|
||||
|
||||
- Include unit tests when you contribute new features, as they help to a) prove that your code works correctly, and b) guard against future breaking changes to lower the maintenance cost.
|
||||
- Bug fixes also generally require unit tests, because the presence of bugs usually indicates insufficient test coverage.
|
||||
- Include unit tests when you contribute new features, as they help to prove that your code works correctly, and also guard against future breaking changes to lower the maintenance cost.
|
||||
- Bug fixes also require unit tests, because the presence of bugs usually indicates insufficient test coverage.
|
||||
- Keep API compatibility in mind when you change code in Milvus. Reviewers of your pull request will comment on any API compatibility issues.
|
||||
- When you contribute a new feature to Milvus, the maintenance burden is (by default) transferred to the Milvus team. This means that the benefit of the contribution must be compared against the cost of maintaining the feature.
|
||||
|
||||
|
||||
## Coding Style
|
||||
The coding style used in Milvus generally follow [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
|
||||
And we made the following changes based on the guide:
|
||||
|
||||
- 4 spaces for indentation
|
||||
- Adopt .cpp file extension instead of .cc extension
|
||||
- 120-character line length
|
||||
- Camel-Cased file names
|
||||
|
||||
|
||||
## Run unit test
|
||||
|
||||
We use Google Test framework for test running.
|
||||
To run unit test for Milvus under C++, please use the following command:
|
||||
|
||||
```shell
|
||||
# Run unit test for Milvus
|
||||
$ ./build.sh -u
|
||||
or
|
||||
$ ./build.sh --unittest
|
||||
```
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
- [Slack Community](https://join.slack.com/t/milvusio/shared_invite/enQtNzY1OTQ0NDI3NjMzLWNmYmM1NmNjOTQ5MGI5NDhhYmRhMGU5M2NhNzhhMDMzY2MzNDdlYjM5ODQ5MmE3ODFlYzU3YjJkNmVlNDQ2ZTk)
|
||||
- [Blog](https://www.milvus.io/blog/)
|
||||
|
||||
# Welcome to Milvus
|
||||
|
||||
Firstly, welcome, and thanks for your interest in [Milvus](https://milvus.io)! No matter who you are, what you do, we greatly appreciate your contribution to help us reinvent data science with Milvus.
|
||||
@ -8,9 +11,9 @@ Milvus is an open source vector search engine that supports similarity search of
|
||||
|
||||
Milvus was developed by ZILLIZ, a tech startup that intends to reinvent data science, with the purpose of providing enterprises with efficient and scalable similarity search and analysis of feature vectors and unstructured data.
|
||||
|
||||
Milvus provides stable Python and C++ APIs, as well as RESTful API.
|
||||
Milvus provides stable Python, C++ and Java APIs.
|
||||
|
||||
Keep up-to-date with newest releases and latest updates by reading [Releases](https://www.milvus-io/docs/master/releases).
|
||||
Keep up-to-date with newest releases and latest updates by reading Milvus [release notes](https://milvus.io/docs/en/Releases/v0.4.0/).
|
||||
|
||||
- GPU-accelerated search engine
|
||||
|
||||
@ -25,7 +28,7 @@ Keep up-to-date with newest releases and latest updates by reading [Releases](ht
|
||||
The data is stored and computed on a distributed architecture. This lets you scale data sizes up and down without redesigning the system.
|
||||
|
||||
## Architecture
|
||||

|
||||

|
||||
|
||||
## Get started
|
||||
|
||||
@ -33,7 +36,7 @@ Keep up-to-date with newest releases and latest updates by reading [Releases](ht
|
||||
|
||||
#### Use Docker
|
||||
|
||||
Use Docker to install Milvus is a breeze. See the [Milvus install guide](https://www.milvus-io/docs/master/userguide/install_milvus.md) for details.
|
||||
Use Docker to install Milvus is a breeze. See the [Milvus install guide](https://milvus.io/docs/en/userguide/install_milvus/) for details.
|
||||
|
||||
#### Use source code
|
||||
|
||||
@ -44,10 +47,12 @@ Use Docker to install Milvus is a breeze. See the [Milvus install guide](https:/
|
||||
```shell
|
||||
# Install tools
|
||||
Centos7 :
|
||||
$ yum install gfortran qt4 flex bison mysql-devel mysql
|
||||
$ yum install gfortran qt4 flex bison
|
||||
$ yum install mysql-devel mysql
|
||||
|
||||
Ubuntu16.04 :
|
||||
$ sudo apt-get install gfortran qt4-qmake flex bison libmysqlclient-dev mysql-client
|
||||
$ sudo apt-get install gfortran qt4-qmake flex bison
|
||||
$ sudo apt-get install libmysqlclient-dev mysql-client
|
||||
|
||||
```
|
||||
|
||||
@ -96,12 +101,21 @@ please reinstall CMake with curl:
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
##### code format and linting
|
||||
|
||||
```shell
|
||||
CentOS 7:
|
||||
$ yum install clang
|
||||
Ubuntu 16.04:
|
||||
$ sudo apt-get install clang-format clang-tidy
|
||||
|
||||
$ ./build.sh -l
|
||||
```
|
||||
|
||||
##### Run unit test
|
||||
|
||||
```shell
|
||||
$ ./build.sh -u
|
||||
or
|
||||
$ ./build.sh --unittest
|
||||
```
|
||||
|
||||
##### Run code coverage
|
||||
@ -174,17 +188,17 @@ $ python3 example.py
|
||||
|
||||
## Contribution guidelines
|
||||
|
||||
Contributions are welcomed and greatly appreciated. If you want to contribute to Milvus, please read the [contribution guidelines](CONTRIBUTING.md). This project adheres to the [code of conduct](CODE OF CONDUCT.md) of Milvus. By participating, you are expected to uphold this code.
|
||||
Contributions are welcomed and greatly appreciated. If you want to contribute to Milvus, please read our [contribution guidelines](CONTRIBUTING.md). This project adheres to the [code of conduct](CODE OF CONDUCT.md) of Milvus. By participating, you are expected to uphold this code.
|
||||
|
||||
We use [GitHub issues](https://github.com/milvus-io/milvus/issues) to track issues and bugs. For general questions and discussions, please go to [Milvus Forum].
|
||||
We use [GitHub issues](https://github.com/milvus-io/milvus/issues) to track issues and bugs. For general questions and public discussions, please join our community.
|
||||
|
||||
## Join the Milvus community
|
||||
|
||||
For public discussion of Milvus, please join our [discussion group](milvusio.slack.com).
|
||||
To connect with other users and contributors, welcome to join our [slack channel](https://join.slack.com/t/milvusio/shared_invite/enQtNzY1OTQ0NDI3NjMzLWNmYmM1NmNjOTQ5MGI5NDhhYmRhMGU5M2NhNzhhMDMzY2MzNDdlYjM5ODQ5MmE3ODFlYzU3YjJkNmVlNDQ2ZTk).
|
||||
|
||||
## Milvus Roadmap
|
||||
|
||||
Please read our [roadmap](milvus-io/milvus/docs/master/roadmap.md) to learn about upcoming features.
|
||||
Please read our [roadmap](https://milvus.io/docs/en/roadmap/) to learn about upcoming features.
|
||||
|
||||
## Resources
|
||||
|
||||
@ -196,7 +210,7 @@ Please read our [roadmap](milvus-io/milvus/docs/master/roadmap.md) to learn abou
|
||||
|
||||
[Milvus CSDN](https://mp.csdn.net/mdeditor/100041006#)
|
||||
|
||||
[Milvus roadmap](https://www.milvus-io/docs/master/roadmap.md)
|
||||
[Milvus roadmap](https://milvus.io/docs/en/roadmap/)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
6476
cpp/build-support/cpplint.py
vendored
Executable file
6476
cpp/build-support/cpplint.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
*cmake-build-debug*
|
||||
*cmake-build-release*
|
||||
*cmake_build*
|
||||
*src/thirdparty*
|
||||
*src/core/thirdparty*
|
||||
*src/grpc*
|
||||
*easylogging++*
|
||||
132
cpp/build-support/run_cpplint.py
Executable file
132
cpp/build-support/run_cpplint.py
Executable file
@ -0,0 +1,132 @@
|
||||
#!/usr/bin/env python
|
||||
# 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.
|
||||
|
||||
from __future__ import print_function
|
||||
import lintutils
|
||||
from subprocess import PIPE, STDOUT
|
||||
import argparse
|
||||
import multiprocessing as mp
|
||||
import sys
|
||||
import platform
|
||||
from functools import partial
|
||||
|
||||
|
||||
# NOTE(wesm):
|
||||
#
|
||||
# * readability/casting is disabled as it aggressively warns about functions
|
||||
# with names like "int32", so "int32(x)", where int32 is a function name,
|
||||
# warns with
|
||||
_filters = '''
|
||||
-whitespace/comments
|
||||
-readability/casting
|
||||
-readability/todo
|
||||
-readability/alt_tokens
|
||||
-build/header_guard
|
||||
-build/c++11
|
||||
-runtime/references
|
||||
-build/include_order
|
||||
'''.split()
|
||||
|
||||
|
||||
def _get_chunk_key(filenames):
|
||||
# lists are not hashable so key on the first filename in a chunk
|
||||
return filenames[0]
|
||||
|
||||
|
||||
def _check_some_files(completed_processes, filenames):
|
||||
# cpplint outputs complaints in '/path:line_number: complaint' format,
|
||||
# so we can scan its output to get a list of files to fix
|
||||
result = completed_processes[_get_chunk_key(filenames)]
|
||||
return lintutils.stdout_pathcolonline(result, filenames)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Runs cpplint on all of the source files.")
|
||||
parser.add_argument("--cpplint_binary",
|
||||
required=True,
|
||||
help="Path to the cpplint binary")
|
||||
parser.add_argument("--exclude_globs",
|
||||
help="Filename containing globs for files "
|
||||
"that should be excluded from the checks")
|
||||
parser.add_argument("--source_dir",
|
||||
required=True,
|
||||
help="Root directory of the source code")
|
||||
parser.add_argument("--quiet", default=False,
|
||||
action="store_true",
|
||||
help="If specified, only print errors")
|
||||
arguments = parser.parse_args()
|
||||
|
||||
exclude_globs = []
|
||||
if arguments.exclude_globs:
|
||||
for line in open(arguments.exclude_globs):
|
||||
exclude_globs.append(line.strip())
|
||||
|
||||
linted_filenames = []
|
||||
for path in lintutils.get_sources(arguments.source_dir, exclude_globs):
|
||||
linted_filenames.append(str(path))
|
||||
|
||||
cmd = [
|
||||
arguments.cpplint_binary,
|
||||
'--verbose=2',
|
||||
'--linelength=120',
|
||||
'--filter=' + ','.join(_filters)
|
||||
]
|
||||
if (arguments.cpplint_binary.endswith('.py') and
|
||||
platform.system() == 'Windows'):
|
||||
# Windows doesn't support executable scripts; execute with
|
||||
# sys.executable
|
||||
cmd.insert(0, sys.executable)
|
||||
if arguments.quiet:
|
||||
cmd.append('--quiet')
|
||||
else:
|
||||
print("\n".join(map(lambda x: "Linting {}".format(x),
|
||||
linted_filenames)))
|
||||
|
||||
# lint files in chunks: each invocation of cpplint will process 16 files
|
||||
chunks = lintutils.chunk(linted_filenames, 16)
|
||||
cmds = [cmd + some for some in chunks]
|
||||
results = lintutils.run_parallel(cmds, stdout=PIPE, stderr=STDOUT)
|
||||
|
||||
error = False
|
||||
# record completed processes (keyed by the first filename in the input
|
||||
# chunk) for lookup in _check_some_files
|
||||
completed_processes = {
|
||||
_get_chunk_key(filenames): result
|
||||
for filenames, result in zip(chunks, results)
|
||||
}
|
||||
checker = partial(_check_some_files, completed_processes)
|
||||
pool = mp.Pool()
|
||||
try:
|
||||
# scan the outputs of various cpplint invocations in parallel to
|
||||
# distill a list of problematic files
|
||||
for problem_files, stdout in pool.imap(checker, chunks):
|
||||
if problem_files:
|
||||
if isinstance(stdout, bytes):
|
||||
stdout = stdout.decode('utf8')
|
||||
print(stdout, file=sys.stderr)
|
||||
error = True
|
||||
except Exception:
|
||||
error = True
|
||||
raise
|
||||
finally:
|
||||
pool.terminate()
|
||||
pool.join()
|
||||
|
||||
sys.exit(1 if error else 0)
|
||||
|
||||
108
cpp/build.sh
108
cpp/build.sh
@ -7,12 +7,19 @@ MAKE_CLEAN="OFF"
|
||||
BUILD_COVERAGE="OFF"
|
||||
DB_PATH="/opt/milvus"
|
||||
PROFILING="OFF"
|
||||
BUILD_FAISS_WITH_MKL="OFF"
|
||||
USE_JFROG_CACHE="OFF"
|
||||
RUN_CPPLINT="OFF"
|
||||
CUDA_COMPILER=/usr/local/cuda/bin/nvcc
|
||||
|
||||
while getopts "p:d:t:uhrcgmj" arg
|
||||
while getopts "p:d:t:ulrcgjh" arg
|
||||
do
|
||||
case $arg in
|
||||
p)
|
||||
INSTALL_PREFIX=$OPTARG
|
||||
;;
|
||||
d)
|
||||
DB_PATH=$OPTARG
|
||||
;;
|
||||
t)
|
||||
BUILD_TYPE=$OPTARG # BUILD_TYPE
|
||||
;;
|
||||
@ -20,11 +27,8 @@ do
|
||||
echo "Build and run unittest cases" ;
|
||||
BUILD_UNITTEST="ON";
|
||||
;;
|
||||
p)
|
||||
INSTALL_PREFIX=$OPTARG
|
||||
;;
|
||||
d)
|
||||
DB_PATH=$OPTARG
|
||||
l)
|
||||
RUN_CPPLINT="ON"
|
||||
;;
|
||||
r)
|
||||
if [[ -d cmake_build ]]; then
|
||||
@ -38,9 +42,6 @@ do
|
||||
g)
|
||||
PROFILING="ON"
|
||||
;;
|
||||
m)
|
||||
BUILD_FAISS_WITH_MKL="ON"
|
||||
;;
|
||||
j)
|
||||
USE_JFROG_CACHE="ON"
|
||||
;;
|
||||
@ -48,65 +49,86 @@ do
|
||||
echo "
|
||||
|
||||
parameter:
|
||||
-t: build type(default: Debug)
|
||||
-u: building unit test options(default: OFF)
|
||||
-p: install prefix(default: $(pwd)/milvus)
|
||||
-d: db path(default: /opt/milvus)
|
||||
-t: build type(default: Debug)
|
||||
-u: building unit test options(default: OFF)
|
||||
-l: run cpplint, clang-format and clang-tidy(default: OFF)
|
||||
-r: remove previous build directory(default: OFF)
|
||||
-c: code coverage(default: OFF)
|
||||
-g: profiling(default: OFF)
|
||||
-m: build faiss with MKL(default: OFF)
|
||||
-j: use jfrog cache build directory
|
||||
-j: use jfrog cache build directory(default: OFF)
|
||||
-h: help
|
||||
|
||||
usage:
|
||||
./build.sh -t \${BUILD_TYPE} [-u] [-h] [-g] [-r] [-c] [-k] [-m] [-j]
|
||||
./build.sh -p \${INSTALL_PREFIX} -t \${BUILD_TYPE} [-u] [-l] [-r] [-c] [-g] [-j] [-h]
|
||||
"
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
echo "unknown argument"
|
||||
echo "ERROR! unknown argument"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -d cmake_build ]]; then
|
||||
mkdir cmake_build
|
||||
MAKE_CLEAN="ON"
|
||||
mkdir cmake_build
|
||||
fi
|
||||
|
||||
cd cmake_build
|
||||
|
||||
CUDA_COMPILER=/usr/local/cuda/bin/nvcc
|
||||
CMAKE_CMD="cmake \
|
||||
-DBUILD_UNIT_TEST=${BUILD_UNITTEST} \
|
||||
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} \
|
||||
-DBUILD_COVERAGE=${BUILD_COVERAGE} \
|
||||
-DMILVUS_DB_PATH=${DB_PATH} \
|
||||
-DMILVUS_ENABLE_PROFILING=${PROFILING} \
|
||||
-DUSE_JFROG_CACHE=${USE_JFROG_CACHE} \
|
||||
../"
|
||||
echo ${CMAKE_CMD}
|
||||
${CMAKE_CMD}
|
||||
|
||||
if [[ ${MAKE_CLEAN} == "ON" ]]; then
|
||||
CMAKE_CMD="cmake -DBUILD_UNIT_TEST=${BUILD_UNITTEST} \
|
||||
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DCMAKE_CUDA_COMPILER=${CUDA_COMPILER} \
|
||||
-DBUILD_COVERAGE=${BUILD_COVERAGE} \
|
||||
-DMILVUS_DB_PATH=${DB_PATH} \
|
||||
-DMILVUS_ENABLE_PROFILING=${PROFILING} \
|
||||
-DBUILD_FAISS_WITH_MKL=${BUILD_FAISS_WITH_MKL} \
|
||||
-DUSE_JFROG_CACHE=${USE_JFROG_CACHE} \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
../"
|
||||
echo ${CMAKE_CMD}
|
||||
|
||||
${CMAKE_CMD}
|
||||
make clean
|
||||
fi
|
||||
|
||||
make -j 4 || exit 1
|
||||
if [[ ${RUN_CPPLINT} == "ON" ]]; then
|
||||
# cpplint check
|
||||
make lint
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR! cpplint check not pass"
|
||||
exit 1
|
||||
fi
|
||||
# clang-format check
|
||||
make check-clang-format
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR! clang-format check failed"
|
||||
exit 1
|
||||
fi
|
||||
# clang-tidy check
|
||||
make check-clang-tidy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR! clang-tidy check failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# compile and build
|
||||
make -j 4 || exit 1
|
||||
|
||||
if [[ ${BUILD_TYPE} != "Debug" ]]; then
|
||||
strip src/milvus_server
|
||||
fi
|
||||
# strip binary symbol
|
||||
if [[ ${BUILD_TYPE} != "Debug" ]]; then
|
||||
strip src/milvus_server
|
||||
fi
|
||||
|
||||
make install || exit 1
|
||||
make install || exit 1
|
||||
|
||||
if [[ ${BUILD_COVERAGE} == "ON" ]]; then
|
||||
cd -
|
||||
bash `pwd`/coverage.sh
|
||||
cd -
|
||||
fi
|
||||
# evaluate code coverage
|
||||
if [[ ${BUILD_COVERAGE} == "ON" ]]; then
|
||||
cd -
|
||||
bash `pwd`/coverage.sh
|
||||
cd -
|
||||
fi
|
||||
fi
|
||||
@ -110,6 +110,7 @@ endif()
|
||||
#----------------------------------------------------------------------
|
||||
set_option_category("Test and benchmark")
|
||||
|
||||
unset(MILVUS_BUILD_TESTS CACHE)
|
||||
if (BUILD_UNIT_TEST)
|
||||
define_option(MILVUS_BUILD_TESTS "Build the MILVUS googletest unit tests" ON)
|
||||
else()
|
||||
|
||||
@ -137,9 +137,26 @@ if(NOT DEFINED USE_JFROG_CACHE)
|
||||
set(USE_JFROG_CACHE "OFF")
|
||||
endif()
|
||||
if(USE_JFROG_CACHE STREQUAL "ON")
|
||||
set(JFROG_ARTFACTORY_CACHE_URL "http://192.168.1.201:80/artifactory/generic-local/milvus/thirdparty/cache/${CMAKE_OS_NAME}/${MILVUS_BUILD_ARCH}/${BUILD_TYPE}")
|
||||
set(JFROG_USER_NAME "test")
|
||||
set(JFROG_PASSWORD "Fantast1c")
|
||||
if(DEFINED ENV{JFROG_ARTFACTORY_URL})
|
||||
set(JFROG_ARTFACTORY_URL "$ENV{JFROG_ARTFACTORY_URL}")
|
||||
endif()
|
||||
if(NOT DEFINED JFROG_ARTFACTORY_URL)
|
||||
message(FATAL_ERROR "JFROG_ARTFACTORY_URL is not set")
|
||||
endif()
|
||||
set(JFROG_ARTFACTORY_CACHE_URL "${JFROG_ARTFACTORY_URL}/generic-local/milvus/thirdparty/cache/${CMAKE_OS_NAME}/${MILVUS_BUILD_ARCH}/${BUILD_TYPE}")
|
||||
if(DEFINED ENV{JFROG_USER_NAME})
|
||||
set(JFROG_USER_NAME "$ENV{JFROG_USER_NAME}")
|
||||
endif()
|
||||
if(NOT DEFINED JFROG_USER_NAME)
|
||||
message(FATAL_ERROR "JFROG_USER_NAME is not set")
|
||||
endif()
|
||||
if(DEFINED ENV{JFROG_PASSWORD})
|
||||
set(JFROG_PASSWORD "$ENV{JFROG_PASSWORD}")
|
||||
endif()
|
||||
if(NOT DEFINED JFROG_PASSWORD)
|
||||
message(FATAL_ERROR "JFROG_PASSWORD is not set")
|
||||
endif()
|
||||
|
||||
set(THIRDPARTY_PACKAGE_CACHE "${THIRDPARTY_DIR}/cache")
|
||||
endif()
|
||||
|
||||
@ -242,14 +259,6 @@ foreach(_VERSION_ENTRY ${TOOLCHAIN_VERSIONS_TXT})
|
||||
set(${_LIB_NAME} "${_LIB_VERSION}")
|
||||
endforeach()
|
||||
|
||||
if(DEFINED ENV{MILVUS_ARROW_URL})
|
||||
set(ARROW_SOURCE_URL "$ENV{MILVUS_ARROW_URL}")
|
||||
else()
|
||||
set(ARROW_SOURCE_URL
|
||||
"https://github.com/youny626/arrow.git"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{MILVUS_BOOST_URL})
|
||||
set(BOOST_SOURCE_URL "$ENV{MILVUS_BOOST_URL}")
|
||||
else()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
* GLOBAL:
|
||||
FORMAT = "%datetime | %level | %logger | %msg"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-global.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-global.log"
|
||||
ENABLED = true
|
||||
TO_FILE = true
|
||||
TO_STANDARD_OUTPUT = false
|
||||
@ -8,12 +8,12 @@
|
||||
PERFORMANCE_TRACKING = false
|
||||
MAX_LOG_FILE_SIZE = 209715200 ## Throw log files away after 200MB
|
||||
* DEBUG:
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-debug.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-debug.log"
|
||||
ENABLED = true
|
||||
* WARNING:
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-warning.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-warning.log"
|
||||
* TRACE:
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-trace.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-trace.log"
|
||||
* VERBOSE:
|
||||
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
|
||||
TO_FILE = false
|
||||
@ -21,7 +21,7 @@
|
||||
## Error logs
|
||||
* ERROR:
|
||||
ENABLED = true
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-error.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-error.log"
|
||||
* FATAL:
|
||||
ENABLED = true
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%H:%m}-fatal.log"
|
||||
FILENAME = "@MILVUS_DB_PATH@/logs/milvus-%datetime{%y-%M-%d-%H:%m}-fatal.log"
|
||||
@ -1,42 +1,39 @@
|
||||
server_config:
|
||||
address: 0.0.0.0 # milvus server ip address (IPv4)
|
||||
port: 19530 # the port milvus listen to, default: 19530, range: 1025 ~ 65534
|
||||
mode: single # milvus deployment type: single, cluster, read_only
|
||||
time_zone: UTC+8 # Use the UTC-x or UTC+x to specify a time zone. eg. UTC+8 for China Standard Time
|
||||
address: 0.0.0.0 # milvus server ip address (IPv4)
|
||||
port: 19530 # port range: 1025 ~ 65534
|
||||
mode: single # deployment type: single, cluster, read_only
|
||||
time_zone: UTC+8
|
||||
|
||||
db_config:
|
||||
db_path: @MILVUS_DB_PATH@ # milvus data storage path
|
||||
db_slave_path: # secondry data storage path, split by semicolon
|
||||
path: @MILVUS_DB_PATH@ # milvus database path
|
||||
slave_path: # secondary database path, split by semicolon
|
||||
|
||||
# URI format: dialect://username:password@host:port/database
|
||||
# All parts except dialect are optional, but you MUST include the delimiters
|
||||
# Currently dialect supports mysql or sqlite
|
||||
db_backend_url: sqlite://:@:/
|
||||
backend_url: sqlite://:@:/
|
||||
|
||||
archive_disk_threshold: 0 # triger archive action if storage size exceed this value, 0 means no limit, unit: GB
|
||||
archive_days_threshold: 0 # files older than x days will be archived, 0 means no limit, unit: day
|
||||
insert_buffer_size: 4 # maximum insert buffer size allowed, default: 4, unit: GB, should be at least 1 GB.
|
||||
# the sum of insert_buffer_size and cpu_cache_capacity should be less than total memory, unit: GB
|
||||
build_index_gpu: 0 # which gpu is used to build index, default: 0, range: 0 ~ gpu number - 1
|
||||
archive_disk_threshold: 0 # GB, file will be archived when disk usage exceed, 0 for no limit
|
||||
archive_days_threshold: 0 # DAYS, older files will be archived, 0 for no limit
|
||||
buffer_size: 4 # GB, maximum insert buffer size allowed
|
||||
build_index_gpu: 0 # gpu id used for building index
|
||||
|
||||
metric_config:
|
||||
is_startup: off # if monitoring start: on, off
|
||||
collector: prometheus # metrics collector: prometheus
|
||||
prometheus_config: # following are prometheus configure
|
||||
port: 8080 # the port prometheus use to fetch metrics
|
||||
push_gateway_ip_address: 127.0.0.1 # push method configure: push gateway ip address
|
||||
push_gateway_port: 9091 # push method configure: push gateway port
|
||||
auto_bootup: off # whether enable monitoring when bootup
|
||||
collector: prometheus # prometheus
|
||||
prometheus_config:
|
||||
port: 8080 # port prometheus used to fetch metrics
|
||||
|
||||
cache_config:
|
||||
cpu_cache_capacity: 16 # how many memory are used as cache, unit: GB, range: 0 ~ less than total memory
|
||||
cpu_cache_free_percent: 0.85 # old data will be erased from cache when cache is full, this value specify how much memory should be kept, range: greater than zero ~ 1.0
|
||||
insert_cache_immediately: false # insert data will be load into cache immediately for hot query
|
||||
cpu_mem_capacity: 16 # GB, CPU memory size used for cache
|
||||
cpu_mem_threshold: 0.85 # percent of data kept when cache cleanup triggered
|
||||
cache_insert_data: false # whether load data into cache when insert
|
||||
|
||||
engine_config:
|
||||
use_blas_threshold: 20
|
||||
blas_threshold: 20
|
||||
|
||||
resource_config:
|
||||
mode: simple
|
||||
resources:
|
||||
# - cpu
|
||||
pool:
|
||||
- cpu
|
||||
- gpu0
|
||||
|
||||
28
cpp/src/cache/CpuCacheMgr.cpp
vendored
28
cpp/src/cache/CpuCacheMgr.cpp
vendored
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
#include "CpuCacheMgr.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
#include "utils/Log.h"
|
||||
|
||||
namespace zilliz {
|
||||
@ -29,17 +29,27 @@ namespace {
|
||||
}
|
||||
|
||||
CpuCacheMgr::CpuCacheMgr() {
|
||||
server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
|
||||
int64_t cap = config.GetInt64Value(server::CONFIG_CPU_CACHE_CAPACITY, 16);
|
||||
cap *= unit;
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
Status s;
|
||||
|
||||
int32_t cpu_mem_cap;
|
||||
s = config.GetCacheConfigCpuMemCapacity(cpu_mem_cap);
|
||||
if (!s.ok()) {
|
||||
SERVER_LOG_ERROR << s.message();
|
||||
}
|
||||
int64_t cap = cpu_mem_cap * unit;
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);
|
||||
|
||||
double free_percent = config.GetDoubleValue(server::CACHE_FREE_PERCENT, 0.85);
|
||||
if(free_percent > 0.0 && free_percent <= 1.0) {
|
||||
cache_->set_freemem_percent(free_percent);
|
||||
float cpu_mem_threshold;
|
||||
s = config.GetCacheConfigCpuMemThreshold(cpu_mem_threshold);
|
||||
if (!s.ok()) {
|
||||
SERVER_LOG_ERROR << s.message();
|
||||
}
|
||||
if (cpu_mem_threshold > 0.0 && cpu_mem_threshold <= 1.0) {
|
||||
cache_->set_freemem_percent(cpu_mem_threshold);
|
||||
} else {
|
||||
SERVER_LOG_ERROR << "Invalid cache_free_percent: " << free_percent <<
|
||||
", defaultly set to " << cache_->freemem_percent();
|
||||
SERVER_LOG_ERROR << "Invalid cpu_mem_threshold: " << cpu_mem_threshold
|
||||
<< ", by default set to " << cache_->freemem_percent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
cpp/src/cache/DataObj.h
vendored
2
cpp/src/cache/DataObj.h
vendored
@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "src/wrapper/vec_index.h"
|
||||
#include "src/wrapper/VecIndex.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
27
cpp/src/cache/GpuCacheMgr.cpp
vendored
27
cpp/src/cache/GpuCacheMgr.cpp
vendored
@ -19,7 +19,7 @@
|
||||
#include <sstream>
|
||||
#include "utils/Log.h"
|
||||
#include "GpuCacheMgr.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
@ -33,18 +33,27 @@ namespace {
|
||||
}
|
||||
|
||||
GpuCacheMgr::GpuCacheMgr() {
|
||||
server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
|
||||
server::Config& config = server::Config::GetInstance();
|
||||
Status s;
|
||||
|
||||
int64_t cap = config.GetInt64Value(server::CONFIG_GPU_CACHE_CAPACITY, 0);
|
||||
cap *= G_BYTE;
|
||||
int32_t gpu_mem_cap;
|
||||
s = config.GetCacheConfigGpuMemCapacity(gpu_mem_cap);
|
||||
if (!s.ok()) {
|
||||
SERVER_LOG_ERROR << s.message();
|
||||
}
|
||||
int32_t cap = gpu_mem_cap * G_BYTE;
|
||||
cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);
|
||||
|
||||
double free_percent = config.GetDoubleValue(server::GPU_CACHE_FREE_PERCENT, 0.85);
|
||||
if (free_percent > 0.0 && free_percent <= 1.0) {
|
||||
cache_->set_freemem_percent(free_percent);
|
||||
float gpu_mem_threshold;
|
||||
s = config.GetCacheConfigGpuMemThreshold(gpu_mem_threshold);
|
||||
if (!s.ok()) {
|
||||
SERVER_LOG_ERROR << s.message();
|
||||
}
|
||||
if (gpu_mem_threshold > 0.0 && gpu_mem_threshold <= 1.0) {
|
||||
cache_->set_freemem_percent(gpu_mem_threshold);
|
||||
} else {
|
||||
SERVER_LOG_ERROR << "Invalid gpu_cache_free_percent: " << free_percent <<
|
||||
", defaultly set to " << cache_->freemem_percent();
|
||||
SERVER_LOG_ERROR << "Invalid gpu_mem_threshold: " << gpu_mem_threshold
|
||||
<< ", by default set to " << cache_->freemem_percent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
62
cpp/src/cache/LRU.h
vendored
62
cpp/src/cache/LRU.h
vendored
@ -34,78 +34,78 @@ public:
|
||||
typedef typename std::list<key_value_pair_t>::iterator list_iterator_t;
|
||||
typedef typename std::list<key_value_pair_t>::reverse_iterator reverse_list_iterator_t;
|
||||
|
||||
LRU(size_t max_size) : _max_size(max_size) {}
|
||||
LRU(size_t max_size) : max_size_(max_size) {}
|
||||
|
||||
void put(const key_t& key, const value_t& value) {
|
||||
auto it = _cache_items_map.find(key);
|
||||
_cache_items_list.push_front(key_value_pair_t(key, value));
|
||||
if (it != _cache_items_map.end()) {
|
||||
_cache_items_list.erase(it->second);
|
||||
_cache_items_map.erase(it);
|
||||
auto it = cache_items_map_.find(key);
|
||||
cache_items_list_.push_front(key_value_pair_t(key, value));
|
||||
if (it != cache_items_map_.end()) {
|
||||
cache_items_list_.erase(it->second);
|
||||
cache_items_map_.erase(it);
|
||||
}
|
||||
_cache_items_map[key] = _cache_items_list.begin();
|
||||
cache_items_map_[key] = cache_items_list_.begin();
|
||||
|
||||
if (_cache_items_map.size() > _max_size) {
|
||||
auto last = _cache_items_list.end();
|
||||
if (cache_items_map_.size() > max_size_) {
|
||||
auto last = cache_items_list_.end();
|
||||
last--;
|
||||
_cache_items_map.erase(last->first);
|
||||
_cache_items_list.pop_back();
|
||||
cache_items_map_.erase(last->first);
|
||||
cache_items_list_.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
const value_t& get(const key_t& key) {
|
||||
auto it = _cache_items_map.find(key);
|
||||
if (it == _cache_items_map.end()) {
|
||||
auto it = cache_items_map_.find(key);
|
||||
if (it == cache_items_map_.end()) {
|
||||
throw std::range_error("There is no such key in cache");
|
||||
} else {
|
||||
_cache_items_list.splice(_cache_items_list.begin(), _cache_items_list, it->second);
|
||||
cache_items_list_.splice(cache_items_list_.begin(), cache_items_list_, it->second);
|
||||
return it->second->second;
|
||||
}
|
||||
}
|
||||
|
||||
void erase(const key_t& key) {
|
||||
auto it = _cache_items_map.find(key);
|
||||
if (it != _cache_items_map.end()) {
|
||||
_cache_items_list.erase(it->second);
|
||||
_cache_items_map.erase(it);
|
||||
auto it = cache_items_map_.find(key);
|
||||
if (it != cache_items_map_.end()) {
|
||||
cache_items_list_.erase(it->second);
|
||||
cache_items_map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
bool exists(const key_t& key) const {
|
||||
return _cache_items_map.find(key) != _cache_items_map.end();
|
||||
return cache_items_map_.find(key) != cache_items_map_.end();
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return _cache_items_map.size();
|
||||
return cache_items_map_.size();
|
||||
}
|
||||
|
||||
list_iterator_t begin() {
|
||||
_iter = _cache_items_list.begin();
|
||||
return _iter;
|
||||
iter_ = cache_items_list_.begin();
|
||||
return iter_;
|
||||
}
|
||||
|
||||
list_iterator_t end() {
|
||||
return _cache_items_list.end();
|
||||
return cache_items_list_.end();
|
||||
}
|
||||
|
||||
reverse_list_iterator_t rbegin() {
|
||||
return _cache_items_list.rbegin();
|
||||
return cache_items_list_.rbegin();
|
||||
}
|
||||
|
||||
reverse_list_iterator_t rend() {
|
||||
return _cache_items_list.rend();
|
||||
return cache_items_list_.rend();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_cache_items_list.clear();
|
||||
_cache_items_map.clear();
|
||||
cache_items_list_.clear();
|
||||
cache_items_map_.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<key_value_pair_t> _cache_items_list;
|
||||
std::unordered_map<key_t, list_iterator_t> _cache_items_map;
|
||||
size_t _max_size;
|
||||
list_iterator_t _iter;
|
||||
std::list<key_value_pair_t> cache_items_list_;
|
||||
std::unordered_map<key_t, list_iterator_t> cache_items_map_;
|
||||
size_t max_size_;
|
||||
list_iterator_t iter_;
|
||||
};
|
||||
|
||||
} // cache
|
||||
|
||||
@ -123,9 +123,7 @@ if(NOT DEFINED USE_JFROG_CACHE)
|
||||
set(USE_JFROG_CACHE "OFF")
|
||||
endif()
|
||||
if(USE_JFROG_CACHE STREQUAL "ON")
|
||||
set(JFROG_ARTFACTORY_CACHE_URL "http://192.168.1.201:80/artifactory/generic-local/milvus/thirdparty/cache/${CMAKE_OS_NAME}/${KNOWHERE_BUILD_ARCH}/${BUILD_TYPE}")
|
||||
set(JFROG_USER_NAME "test")
|
||||
set(JFROG_PASSWORD "Fantast1c")
|
||||
set(JFROG_ARTFACTORY_CACHE_URL "${JFROG_ARTFACTORY_URL}/generic-local/milvus/thirdparty/cache/${CMAKE_OS_NAME}/${KNOWHERE_BUILD_ARCH}/${BUILD_TYPE}")
|
||||
set(THIRDPARTY_PACKAGE_CACHE "${THIRDPARTY_DIR}/cache")
|
||||
endif()
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ namespace engine {
|
||||
DBOptions DBFactory::BuildOption() {
|
||||
auto meta = MetaFactory::BuildOption();
|
||||
DBOptions options;
|
||||
options.meta = meta;
|
||||
options.meta_ = meta;
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ DBImpl::DBImpl(const DBOptions& options)
|
||||
shutting_down_(true),
|
||||
compact_thread_pool_(1, 1),
|
||||
index_thread_pool_(1, 1) {
|
||||
meta_ptr_ = MetaFactory::Build(options.meta, options.mode);
|
||||
meta_ptr_ = MetaFactory::Build(options.meta_, options.mode_);
|
||||
mem_mgr_ = MemManagerFactory::Build(meta_ptr_, options_);
|
||||
Start();
|
||||
}
|
||||
@ -77,7 +77,7 @@ Status DBImpl::Start() {
|
||||
shutting_down_.store(false, std::memory_order_release);
|
||||
|
||||
//for distribute version, some nodes are read only
|
||||
if (options_.mode != DBOptions::MODE::READ_ONLY) {
|
||||
if (options_.mode_ != DBOptions::MODE::READ_ONLY) {
|
||||
ENGINE_LOG_TRACE << "StartTimerTasks";
|
||||
bg_timer_thread_ = std::thread(&DBImpl::BackgroundTimerTask, this);
|
||||
}
|
||||
@ -98,7 +98,7 @@ Status DBImpl::Stop() {
|
||||
//wait compaction/buildindex finish
|
||||
bg_timer_thread_.join();
|
||||
|
||||
if (options_.mode != DBOptions::MODE::READ_ONLY) {
|
||||
if (options_.mode_ != DBOptions::MODE::READ_ONLY) {
|
||||
meta_ptr_->CleanUp();
|
||||
}
|
||||
|
||||
@ -133,9 +133,9 @@ Status DBImpl::DeleteTable(const std::string& table_id, const meta::DatesT& date
|
||||
meta_ptr_->DeleteTable(table_id); //soft delete table
|
||||
|
||||
//scheduler will determine when to delete table files
|
||||
auto nres = ResMgrInst::GetInstance()->GetNumOfComputeResource();
|
||||
auto nres = scheduler::ResMgrInst::GetInstance()->GetNumOfComputeResource();
|
||||
scheduler::DeleteJobPtr job = std::make_shared<scheduler::DeleteJob>(0, table_id, meta_ptr_, nres);
|
||||
JobMgrInst::GetInstance()->Put(job);
|
||||
scheduler::JobMgrInst::GetInstance()->Put(job);
|
||||
job->WaitAndDelete();
|
||||
} else {
|
||||
meta_ptr_->DropPartitionsByDates(table_id, dates);
|
||||
@ -649,7 +649,7 @@ Status DBImpl::BackgroundMergeFiles(const std::string& table_id) {
|
||||
bool has_merge = false;
|
||||
for (auto& kv : raw_files) {
|
||||
auto files = kv.second;
|
||||
if (files.size() < options_.merge_trigger_number) {
|
||||
if (files.size() < options_.merge_trigger_number_) {
|
||||
ENGINE_LOG_DEBUG << "Files number not greater equal than merge trigger number, skip merge action";
|
||||
continue;
|
||||
}
|
||||
@ -684,7 +684,7 @@ void DBImpl::BackgroundCompaction(std::set<std::string> table_ids) {
|
||||
meta_ptr_->Archive();
|
||||
|
||||
int ttl = 5*meta::M_SEC;//default: file will be deleted after 5 minutes
|
||||
if (options_.mode == DBOptions::MODE::CLUSTER) {
|
||||
if (options_.mode_ == DBOptions::MODE::CLUSTER) {
|
||||
ttl = meta::D_SEC;
|
||||
}
|
||||
meta_ptr_->CleanUpFilesWithTTL(ttl);
|
||||
|
||||
@ -52,10 +52,10 @@ private:
|
||||
};
|
||||
|
||||
struct DBMetaOptions {
|
||||
std::string path;
|
||||
std::vector<std::string> slave_paths;
|
||||
std::string backend_uri;
|
||||
ArchiveConf archive_conf = ArchiveConf("delete");
|
||||
std::string path_;
|
||||
std::vector<std::string> slave_paths_;
|
||||
std::string backend_uri_;
|
||||
ArchiveConf archive_conf_ = ArchiveConf("delete");
|
||||
}; // DBMetaOptions
|
||||
|
||||
struct DBOptions {
|
||||
@ -65,11 +65,11 @@ struct DBOptions {
|
||||
READ_ONLY
|
||||
} MODE;
|
||||
|
||||
uint16_t merge_trigger_number = 2;
|
||||
DBMetaOptions meta;
|
||||
int mode = MODE::SINGLE;
|
||||
uint16_t merge_trigger_number_ = 2;
|
||||
DBMetaOptions meta_;
|
||||
int mode_ = MODE::SINGLE;
|
||||
|
||||
size_t insert_buffer_size = 4 * ONE_GB;
|
||||
size_t insert_buffer_size_ = 4 * ONE_GB;
|
||||
bool insert_cache_immediately_ = false;
|
||||
}; // Options
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
#include <regex>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace zilliz {
|
||||
@ -42,8 +43,8 @@ std::string ConstructParentFolder(const std::string& db_path, const meta::TableF
|
||||
}
|
||||
|
||||
std::string GetTableFileParentFolder(const DBMetaOptions& options, const meta::TableFileSchema& table_file) {
|
||||
uint64_t path_count = options.slave_paths.size() + 1;
|
||||
std::string target_path = options.path;
|
||||
uint64_t path_count = options.slave_paths_.size() + 1;
|
||||
std::string target_path = options.path_;
|
||||
uint64_t index = 0;
|
||||
|
||||
if(meta::TableFileSchema::NEW_INDEX == table_file.file_type_) {
|
||||
@ -60,7 +61,7 @@ std::string GetTableFileParentFolder(const DBMetaOptions& options, const meta::T
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
target_path = options.slave_paths[index - 1];
|
||||
target_path = options.slave_paths_[index - 1];
|
||||
}
|
||||
|
||||
return ConstructParentFolder(target_path, table_file);
|
||||
@ -77,7 +78,7 @@ long GetMicroSecTimeStamp() {
|
||||
}
|
||||
|
||||
Status CreateTablePath(const DBMetaOptions& options, const std::string& table_id) {
|
||||
std::string db_path = options.path;
|
||||
std::string db_path = options.path_;
|
||||
std::string table_path = db_path + TABLES_FOLDER + table_id;
|
||||
auto status = server::CommonUtil::CreateDirectory(table_path);
|
||||
if (!status.ok()) {
|
||||
@ -85,7 +86,7 @@ Status CreateTablePath(const DBMetaOptions& options, const std::string& table_id
|
||||
return status;
|
||||
}
|
||||
|
||||
for(auto& path : options.slave_paths) {
|
||||
for(auto& path : options.slave_paths_) {
|
||||
table_path = path + TABLES_FOLDER + table_id;
|
||||
status = server::CommonUtil::CreateDirectory(table_path);
|
||||
if (!status.ok()) {
|
||||
@ -98,8 +99,8 @@ Status CreateTablePath(const DBMetaOptions& options, const std::string& table_id
|
||||
}
|
||||
|
||||
Status DeleteTablePath(const DBMetaOptions& options, const std::string& table_id, bool force) {
|
||||
std::vector<std::string> paths = options.slave_paths;
|
||||
paths.push_back(options.path);
|
||||
std::vector<std::string> paths = options.slave_paths_;
|
||||
paths.push_back(options.path_);
|
||||
|
||||
for(auto& path : paths) {
|
||||
std::string table_path = path + TABLES_FOLDER + table_id;
|
||||
@ -131,13 +132,13 @@ Status CreateTableFilePath(const DBMetaOptions& options, meta::TableFileSchema&
|
||||
}
|
||||
|
||||
Status GetTableFilePath(const DBMetaOptions& options, meta::TableFileSchema& table_file) {
|
||||
std::string parent_path = ConstructParentFolder(options.path, table_file);
|
||||
std::string parent_path = ConstructParentFolder(options.path_, table_file);
|
||||
std::string file_path = parent_path + "/" + table_file.file_id_;
|
||||
if(boost::filesystem::exists(file_path)) {
|
||||
table_file.location_ = file_path;
|
||||
return Status::OK();
|
||||
} else {
|
||||
for(auto& path : options.slave_paths) {
|
||||
for(auto& path : options.slave_paths_) {
|
||||
parent_path = ConstructParentFolder(path, table_file);
|
||||
file_path = parent_path + "/" + table_file.file_id_;
|
||||
if(boost::filesystem::exists(file_path)) {
|
||||
@ -148,7 +149,7 @@ Status GetTableFilePath(const DBMetaOptions& options, meta::TableFileSchema& tab
|
||||
}
|
||||
|
||||
std::string msg = "Table file doesn't exist: " + file_path;
|
||||
ENGINE_LOG_ERROR << msg << " in path: " << options.path
|
||||
ENGINE_LOG_ERROR << msg << " in path: " << options.path_
|
||||
<< " for table: " << table_file.table_id_;
|
||||
|
||||
return Status(DB_ERROR, msg);
|
||||
@ -195,6 +196,41 @@ meta::DateT GetDate() {
|
||||
return GetDate(std::time(nullptr), 0);
|
||||
}
|
||||
|
||||
// URI format: dialect://username:password@host:port/database
|
||||
Status ParseMetaUri(const std::string& uri, MetaUriInfo& info) {
|
||||
std::string dialect_regex = "(.*)";
|
||||
std::string username_tegex = "(.*)";
|
||||
std::string password_regex = "(.*)";
|
||||
std::string host_regex = "(.*)";
|
||||
std::string port_regex = "(.*)";
|
||||
std::string db_name_regex = "(.*)";
|
||||
std::string uri_regex_str =
|
||||
dialect_regex + "\\:\\/\\/" +
|
||||
username_tegex + "\\:" +
|
||||
password_regex + "\\@" +
|
||||
host_regex + "\\:" +
|
||||
port_regex + "\\/" +
|
||||
db_name_regex;
|
||||
|
||||
std::regex uri_regex(uri_regex_str);
|
||||
std::smatch pieces_match;
|
||||
|
||||
if (std::regex_match(uri, pieces_match, uri_regex)) {
|
||||
info.dialect_ = pieces_match[1].str();
|
||||
info.username_ = pieces_match[2].str();
|
||||
info.password_ = pieces_match[3].str();
|
||||
info.host_ = pieces_match[4].str();
|
||||
info.port_ = pieces_match[5].str();
|
||||
info.db_name_ = pieces_match[6].str();
|
||||
|
||||
//TODO: verify host, port...
|
||||
} else {
|
||||
return Status(DB_INVALID_META_URI, "Invalid meta uri: " + uri);
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
} // namespace engine
|
||||
} // namespace milvus
|
||||
|
||||
@ -44,6 +44,17 @@ meta::DateT GetDate(const std::time_t &t, int day_delta = 0);
|
||||
meta::DateT GetDate();
|
||||
meta::DateT GetDateWithDelta(int day_delta);
|
||||
|
||||
struct MetaUriInfo {
|
||||
std::string dialect_;
|
||||
std::string username_;
|
||||
std::string password_;
|
||||
std::string host_;
|
||||
std::string port_;
|
||||
std::string db_name_;
|
||||
};
|
||||
|
||||
Status ParseMetaUri(const std::string& uri, MetaUriInfo& info);
|
||||
|
||||
} // namespace utils
|
||||
} // namespace engine
|
||||
} // namespace milvus
|
||||
|
||||
@ -23,9 +23,10 @@
|
||||
#include "utils/CommonUtil.h"
|
||||
#include "utils/Exception.h"
|
||||
|
||||
#include "src/wrapper/vec_index.h"
|
||||
#include "src/wrapper/vec_impl.h"
|
||||
#include "src/wrapper/VecIndex.h"
|
||||
#include "src/wrapper/VecImpl.h"
|
||||
#include "knowhere/common/Exception.h"
|
||||
#include "server/Config.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@ -326,9 +327,9 @@ Status ExecutionEngineImpl::GpuCache(uint64_t gpu_id) {
|
||||
// TODO(linxj): remove.
|
||||
Status ExecutionEngineImpl::Init() {
|
||||
using namespace zilliz::milvus::server;
|
||||
ServerConfig &config = ServerConfig::GetInstance();
|
||||
ConfigNode server_config = config.GetConfig(CONFIG_DB);
|
||||
gpu_num_ = server_config.GetInt32Value(CONFIG_DB_BUILD_INDEX_GPU, 0);
|
||||
server::Config &config = server::Config::GetInstance();
|
||||
Status s = config.GetDBConfigBuildIndexGPU(gpu_num_);
|
||||
if (!s.ok()) return s;
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ExecutionEngine.h"
|
||||
#include "src/wrapper/vec_index.h"
|
||||
#include "src/wrapper/VecIndex.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@ -101,7 +101,7 @@ protected:
|
||||
std::string location_;
|
||||
|
||||
int32_t nlist_ = 0;
|
||||
int64_t gpu_num_ = 0;
|
||||
int32_t gpu_num_ = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Status MemManagerImpl::InsertVectors(const std::string &table_id_,
|
||||
const float *vectors_,
|
||||
IDNumbers &vector_ids_) {
|
||||
|
||||
while (GetCurrentMem() > options_.insert_buffer_size) {
|
||||
while (GetCurrentMem() > options_.insert_buffer_size_) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
|
||||
@ -20,13 +20,14 @@
|
||||
#include "MySQLMetaImpl.h"
|
||||
#include "utils/Log.h"
|
||||
#include "utils/Exception.h"
|
||||
#include "db/Utils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <string.h>
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
@ -42,45 +43,30 @@ namespace engine {
|
||||
}
|
||||
|
||||
DBMetaOptions meta;
|
||||
meta.path = p;
|
||||
meta.path_ = p;
|
||||
return meta;
|
||||
}
|
||||
|
||||
meta::MetaPtr MetaFactory::Build(const DBMetaOptions &metaOptions, const int &mode) {
|
||||
std::string uri = metaOptions.backend_uri;
|
||||
std::string uri = metaOptions.backend_uri_;
|
||||
|
||||
std::string dialectRegex = "(.*)";
|
||||
std::string usernameRegex = "(.*)";
|
||||
std::string passwordRegex = "(.*)";
|
||||
std::string hostRegex = "(.*)";
|
||||
std::string portRegex = "(.*)";
|
||||
std::string dbNameRegex = "(.*)";
|
||||
std::string uriRegexStr = dialectRegex + "\\:\\/\\/" +
|
||||
usernameRegex + "\\:" +
|
||||
passwordRegex + "\\@" +
|
||||
hostRegex + "\\:" +
|
||||
portRegex + "\\/" +
|
||||
dbNameRegex;
|
||||
std::regex uriRegex(uriRegexStr);
|
||||
std::smatch pieces_match;
|
||||
|
||||
if (std::regex_match(uri, pieces_match, uriRegex)) {
|
||||
std::string dialect = pieces_match[1].str();
|
||||
std::transform(dialect.begin(), dialect.end(), dialect.begin(), ::tolower);
|
||||
if (dialect.find("mysql") != std::string::npos) {
|
||||
ENGINE_LOG_INFO << "Using MySQL";
|
||||
return std::make_shared<meta::MySQLMetaImpl>(metaOptions, mode);
|
||||
} else if (dialect.find("sqlite") != std::string::npos) {
|
||||
ENGINE_LOG_INFO << "Using SQLite";
|
||||
return std::make_shared<meta::SqliteMetaImpl>(metaOptions);
|
||||
} else {
|
||||
ENGINE_LOG_ERROR << "Invalid dialect in URI: dialect = " << dialect;
|
||||
throw InvalidArgumentException("URI dialect is not mysql / sqlite");
|
||||
}
|
||||
} else {
|
||||
utils::MetaUriInfo uri_info;
|
||||
auto status = utils::ParseMetaUri(uri, uri_info);
|
||||
if(!status.ok()) {
|
||||
ENGINE_LOG_ERROR << "Wrong URI format: URI = " << uri;
|
||||
throw InvalidArgumentException("Wrong URI format ");
|
||||
}
|
||||
|
||||
if (strcasecmp(uri_info.dialect_.c_str(), "mysql") == 0) {
|
||||
ENGINE_LOG_INFO << "Using MySQL";
|
||||
return std::make_shared<meta::MySQLMetaImpl>(metaOptions, mode);
|
||||
} else if (strcasecmp(uri_info.dialect_.c_str(), "sqlite") == 0) {
|
||||
ENGINE_LOG_INFO << "Using SQLite";
|
||||
return std::make_shared<meta::SqliteMetaImpl>(metaOptions);
|
||||
} else {
|
||||
ENGINE_LOG_ERROR << "Invalid dialect in URI: dialect = " << uri_info.dialect_;
|
||||
throw InvalidArgumentException("URI dialect is not mysql / sqlite");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace engine
|
||||
|
||||
@ -19,21 +19,22 @@
|
||||
#include "db/IDGenerator.h"
|
||||
#include "db/Utils.h"
|
||||
#include "utils/Log.h"
|
||||
#include "utils/Exception.h"
|
||||
#include "MetaConsts.h"
|
||||
#include "metrics/Metrics.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "mysql++/mysql++.h"
|
||||
#include <string.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <mysql++/mysql++.h>
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
@ -56,8 +57,112 @@ Status HandleException(const std::string &desc, const char* what = nullptr) {
|
||||
}
|
||||
}
|
||||
|
||||
class MetaField {
|
||||
public:
|
||||
MetaField(const std::string& name, const std::string& type, const std::string& setting)
|
||||
: name_(name),
|
||||
type_(type),
|
||||
setting_(setting) {
|
||||
}
|
||||
|
||||
std::string name() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
return name_ + " " + type_ + " " + setting_;
|
||||
}
|
||||
|
||||
// mysql field type has additional information. for instance, a filed type is defined as 'BIGINT'
|
||||
// we get the type from sql is 'bigint(20)', so we need to ignore the '(20)'
|
||||
bool IsEqual(const MetaField& field) const {
|
||||
size_t name_len_min = field.name_.length() > name_.length() ? name_.length() : field.name_.length();
|
||||
size_t type_len_min = field.type_.length() > type_.length() ? type_.length() : field.type_.length();
|
||||
return strncasecmp(field.name_.c_str(), name_.c_str(), name_len_min) == 0 &&
|
||||
strncasecmp(field.type_.c_str(), type_.c_str(), type_len_min) == 0;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
std::string type_;
|
||||
std::string setting_;
|
||||
};
|
||||
|
||||
using MetaFields = std::vector<MetaField>;
|
||||
class MetaSchema {
|
||||
public:
|
||||
MetaSchema(const std::string& name, const MetaFields& fields)
|
||||
: name_(name),
|
||||
fields_(fields) {
|
||||
}
|
||||
|
||||
std::string name() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
std::string result;
|
||||
for(auto& field : fields_) {
|
||||
if(!result.empty()) {
|
||||
result += ",";
|
||||
}
|
||||
result += field.ToString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//if the outer fields contains all this MetaSchema fields, return true
|
||||
//otherwise return false
|
||||
bool IsEqual(const MetaFields& fields) const {
|
||||
std::vector<std::string> found_field;
|
||||
for(const auto& this_field : fields_) {
|
||||
for(const auto& outer_field : fields) {
|
||||
if(this_field.IsEqual(outer_field)) {
|
||||
found_field.push_back(this_field.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found_field.size() == fields_.size();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
MetaFields fields_;
|
||||
};
|
||||
|
||||
//Tables schema
|
||||
static const MetaSchema TABLES_SCHEMA(META_TABLES, {
|
||||
MetaField("id", "BIGINT", "PRIMARY KEY AUTO_INCREMENT"),
|
||||
MetaField("table_id", "VARCHAR(255)", "UNIQUE NOT NULL"),
|
||||
MetaField("state", "INT", "NOT NULL"),
|
||||
MetaField("dimension", "SMALLINT", "NOT NULL"),
|
||||
MetaField("created_on", "BIGINT", "NOT NULL"),
|
||||
MetaField("flag", "BIGINT", "DEFAULT 0 NOT NULL"),
|
||||
MetaField("index_file_size", "BIGINT", "DEFAULT 1024 NOT NULL"),
|
||||
MetaField("engine_type", "INT", "DEFAULT 1 NOT NULL"),
|
||||
MetaField("nlist", "INT", "DEFAULT 16384 NOT NULL"),
|
||||
MetaField("metric_type", "INT", "DEFAULT 1 NOT NULL"),
|
||||
});
|
||||
|
||||
//TableFiles schema
|
||||
static const MetaSchema TABLEFILES_SCHEMA(META_TABLEFILES, {
|
||||
MetaField("id", "BIGINT", "PRIMARY KEY AUTO_INCREMENT"),
|
||||
MetaField("table_id", "VARCHAR(255)", "NOT NULL"),
|
||||
MetaField("engine_type", "INT", "DEFAULT 1 NOT NULL"),
|
||||
MetaField("file_id", "VARCHAR(255)", "NOT NULL"),
|
||||
MetaField("file_type", "INT", "DEFAULT 0 NOT NULL"),
|
||||
MetaField("file_size", "BIGINT", "DEFAULT 0 NOT NULL"),
|
||||
MetaField("row_count", "BIGINT", "DEFAULT 0 NOT NULL"),
|
||||
MetaField("updated_time", "BIGINT", "NOT NULL"),
|
||||
MetaField("created_on", "BIGINT", "NOT NULL"),
|
||||
MetaField("date", "INT", "DEFAULT -1 NOT NULL"),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
MySQLMetaImpl::MySQLMetaImpl(const DBMetaOptions &options_, const int &mode)
|
||||
: options_(options_),
|
||||
mode_(mode) {
|
||||
@ -84,120 +189,140 @@ Status MySQLMetaImpl::NextFileId(std::string &file_id) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void MySQLMetaImpl::ValidateMetaSchema() {
|
||||
if(nullptr == mysql_connection_pool_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
if (connectionPtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto validate_func = [&](const MetaSchema& schema) {
|
||||
Query query_statement = connectionPtr->query();
|
||||
query_statement << "DESC " << schema.name() << ";";
|
||||
|
||||
MetaFields exist_fields;
|
||||
|
||||
try {
|
||||
StoreQueryResult res = query_statement.store();
|
||||
for (size_t i = 0; i < res.num_rows(); i++) {
|
||||
const Row &row = res[i];
|
||||
std::string name, type;
|
||||
row["Field"].to_string(name);
|
||||
row["Type"].to_string(type);
|
||||
|
||||
exist_fields.push_back(MetaField(name, type, ""));
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
ENGINE_LOG_DEBUG << "Meta table '" << schema.name() << "' not exist and will be created";
|
||||
}
|
||||
|
||||
if(exist_fields.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return schema.IsEqual(exist_fields);
|
||||
};
|
||||
|
||||
//verify Tables
|
||||
if (!validate_func(TABLES_SCHEMA)) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta Tables schema is created by Milvus old version");
|
||||
}
|
||||
|
||||
//verufy TableFiles
|
||||
if (!validate_func(TABLEFILES_SCHEMA)) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta TableFiles schema is created by Milvus old version");
|
||||
}
|
||||
}
|
||||
|
||||
Status MySQLMetaImpl::Initialize() {
|
||||
if (!boost::filesystem::is_directory(options_.path)) {
|
||||
auto ret = boost::filesystem::create_directory(options_.path);
|
||||
//step 1: create db root path
|
||||
if (!boost::filesystem::is_directory(options_.path_)) {
|
||||
auto ret = boost::filesystem::create_directory(options_.path_);
|
||||
if (!ret) {
|
||||
std::string msg = "Failed to create db directory " + options_.path;
|
||||
std::string msg = "Failed to create db directory " + options_.path_;
|
||||
ENGINE_LOG_ERROR << msg;
|
||||
return Status(DB_META_TRANSACTION_FAILED, msg);
|
||||
}
|
||||
}
|
||||
|
||||
std::string uri = options_.backend_uri;
|
||||
std::string uri = options_.backend_uri_;
|
||||
|
||||
std::string dialectRegex = "(.*)";
|
||||
std::string usernameRegex = "(.*)";
|
||||
std::string passwordRegex = "(.*)";
|
||||
std::string hostRegex = "(.*)";
|
||||
std::string portRegex = "(.*)";
|
||||
std::string dbNameRegex = "(.*)";
|
||||
std::string uriRegexStr = dialectRegex + "\\:\\/\\/" +
|
||||
usernameRegex + "\\:" +
|
||||
passwordRegex + "\\@" +
|
||||
hostRegex + "\\:" +
|
||||
portRegex + "\\/" +
|
||||
dbNameRegex;
|
||||
std::regex uriRegex(uriRegexStr);
|
||||
std::smatch pieces_match;
|
||||
//step 2: parse and check meta uri
|
||||
utils::MetaUriInfo uri_info;
|
||||
auto status = utils::ParseMetaUri(uri, uri_info);
|
||||
if(!status.ok()) {
|
||||
std::string msg = "Wrong URI format: " + uri;
|
||||
ENGINE_LOG_ERROR << msg;
|
||||
throw Exception(DB_INVALID_META_URI, msg);
|
||||
}
|
||||
|
||||
if (std::regex_match(uri, pieces_match, uriRegex)) {
|
||||
std::string dialect = pieces_match[1].str();
|
||||
std::transform(dialect.begin(), dialect.end(), dialect.begin(), ::tolower);
|
||||
if (dialect.find("mysql") == std::string::npos) {
|
||||
return Status(DB_ERROR, "URI's dialect is not MySQL");
|
||||
if (strcasecmp(uri_info.dialect_.c_str(), "mysql") != 0) {
|
||||
std::string msg = "URI's dialect is not MySQL";
|
||||
ENGINE_LOG_ERROR << msg;
|
||||
throw Exception(DB_INVALID_META_URI, msg);
|
||||
}
|
||||
|
||||
//step 3: connect mysql
|
||||
int thread_hint = std::thread::hardware_concurrency();
|
||||
int max_pool_size = (thread_hint == 0) ? 8 : thread_hint;
|
||||
unsigned int port = 0;
|
||||
if (!uri_info.port_.empty()) {
|
||||
port = std::stoi(uri_info.port_);
|
||||
}
|
||||
|
||||
mysql_connection_pool_ =
|
||||
std::make_shared<MySQLConnectionPool>(uri_info.db_name_, uri_info.username_,
|
||||
uri_info.password_, uri_info.host_, port, max_pool_size);
|
||||
ENGINE_LOG_DEBUG << "MySQL connection pool: maximum pool size = " << std::to_string(max_pool_size);
|
||||
|
||||
//step 4: validate to avoid open old version schema
|
||||
ValidateMetaSchema();
|
||||
|
||||
//step 5: create meta tables
|
||||
try {
|
||||
|
||||
if (mode_ != DBOptions::MODE::READ_ONLY) {
|
||||
CleanUp();
|
||||
}
|
||||
std::string username = pieces_match[2].str();
|
||||
std::string password = pieces_match[3].str();
|
||||
std::string serverAddress = pieces_match[4].str();
|
||||
unsigned int port = 0;
|
||||
if (!pieces_match[5].str().empty()) {
|
||||
port = std::stoi(pieces_match[5].str());
|
||||
}
|
||||
std::string dbName = pieces_match[6].str();
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
int threadHint = std::thread::hardware_concurrency();
|
||||
int maxPoolSize = threadHint == 0 ? 8 : threadHint;
|
||||
mysql_connection_pool_ =
|
||||
std::make_shared<MySQLConnectionPool>(dbName, username, password, serverAddress, port, maxPoolSize);
|
||||
|
||||
ENGINE_LOG_DEBUG << "MySQL connection pool: maximum pool size = " << std::to_string(maxPoolSize);
|
||||
try {
|
||||
|
||||
if (mode_ != DBOptions::MODE::READ_ONLY) {
|
||||
CleanUp();
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
}
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
}
|
||||
if (!connectionPtr->thread_aware()) {
|
||||
ENGINE_LOG_ERROR << "MySQL++ wasn't built with thread awareness! Can't run without it.";
|
||||
return Status(DB_ERROR, "MySQL++ wasn't built with thread awareness! Can't run without it.");
|
||||
}
|
||||
Query InitializeQuery = connectionPtr->query();
|
||||
|
||||
InitializeQuery << "CREATE TABLE IF NOT EXISTS " <<
|
||||
TABLES_SCHEMA.name() << " (" << TABLES_SCHEMA.ToString() + ");";
|
||||
|
||||
if (!connectionPtr->thread_aware()) {
|
||||
ENGINE_LOG_ERROR << "MySQL++ wasn't built with thread awareness! Can't run without it.";
|
||||
return Status(DB_ERROR, "MySQL++ wasn't built with thread awareness! Can't run without it.");
|
||||
}
|
||||
Query InitializeQuery = connectionPtr->query();
|
||||
ENGINE_LOG_DEBUG << "MySQLMetaImpl::Initialize: " << InitializeQuery.str();
|
||||
|
||||
InitializeQuery << "CREATE TABLE IF NOT EXISTS " <<
|
||||
META_TABLES << " " <<
|
||||
"(id BIGINT PRIMARY KEY AUTO_INCREMENT, " <<
|
||||
"table_id VARCHAR(255) UNIQUE NOT NULL, " <<
|
||||
"state INT NOT NULL, " <<
|
||||
"dimension SMALLINT NOT NULL, " <<
|
||||
"created_on BIGINT NOT NULL, " <<
|
||||
"flag BIGINT DEFAULT 0 NOT NULL, " <<
|
||||
"index_file_size BIGINT DEFAULT 1024 NOT NULL, " <<
|
||||
"engine_type INT DEFAULT 1 NOT NULL, " <<
|
||||
"nlist INT DEFAULT 16384 NOT NULL, " <<
|
||||
"metric_type INT DEFAULT 1 NOT NULL);";
|
||||
if (!InitializeQuery.exec()) {
|
||||
return HandleException("Initialization Error", InitializeQuery.error());
|
||||
}
|
||||
|
||||
ENGINE_LOG_DEBUG << "MySQLMetaImpl::Initialize: " << InitializeQuery.str();
|
||||
InitializeQuery << "CREATE TABLE IF NOT EXISTS " <<
|
||||
TABLEFILES_SCHEMA.name() << " (" << TABLEFILES_SCHEMA.ToString() + ");";
|
||||
|
||||
if (!InitializeQuery.exec()) {
|
||||
return HandleException("Initialization Error", InitializeQuery.error());
|
||||
}
|
||||
ENGINE_LOG_DEBUG << "MySQLMetaImpl::Initialize: " << InitializeQuery.str();
|
||||
|
||||
InitializeQuery << "CREATE TABLE IF NOT EXISTS " <<
|
||||
META_TABLEFILES << " " <<
|
||||
"(id BIGINT PRIMARY KEY AUTO_INCREMENT, " <<
|
||||
"table_id VARCHAR(255) NOT NULL, " <<
|
||||
"engine_type INT DEFAULT 1 NOT NULL, " <<
|
||||
"file_id VARCHAR(255) NOT NULL, " <<
|
||||
"file_type INT DEFAULT 0 NOT NULL, " <<
|
||||
"file_size BIGINT DEFAULT 0 NOT NULL, " <<
|
||||
"row_count BIGINT DEFAULT 0 NOT NULL, " <<
|
||||
"updated_time BIGINT NOT NULL, " <<
|
||||
"created_on BIGINT NOT NULL, " <<
|
||||
"date INT DEFAULT -1 NOT NULL);";
|
||||
if (!InitializeQuery.exec()) {
|
||||
return HandleException("Initialization Error", InitializeQuery.error());
|
||||
}
|
||||
} //Scoped Connection
|
||||
|
||||
ENGINE_LOG_DEBUG << "MySQLMetaImpl::Initialize: " << InitializeQuery.str();
|
||||
|
||||
if (!InitializeQuery.exec()) {
|
||||
return HandleException("Initialization Error", InitializeQuery.error());
|
||||
}
|
||||
} //Scoped Connection
|
||||
|
||||
} catch (std::exception &e) {
|
||||
return HandleException("GENERAL ERROR DURING INITIALIZATION", e.what());
|
||||
}
|
||||
} else {
|
||||
ENGINE_LOG_ERROR << "Wrong URI format. URI = " << uri;
|
||||
return Status(DB_ERROR, "Wrong URI format");
|
||||
} catch (std::exception &e) {
|
||||
return HandleException("GENERAL ERROR DURING INITIALIZATION", e.what());
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
@ -226,7 +351,7 @@ Status MySQLMetaImpl::DropPartitionsByDates(const std::string &table_id,
|
||||
dateListStr = dateListStr.substr(0, dateListStr.size() - 2); //remove the last ", "
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -258,7 +383,7 @@ Status MySQLMetaImpl::CreateTable(TableSchema &table_schema) {
|
||||
try {
|
||||
server::MetricCollector metric;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -337,7 +462,7 @@ Status MySQLMetaImpl::FilesByType(const std::string &table_id,
|
||||
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -417,7 +542,7 @@ Status MySQLMetaImpl::UpdateTableIndex(const std::string &table_id, const TableI
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -476,7 +601,7 @@ Status MySQLMetaImpl::UpdateTableFlag(const std::string &table_id, int64_t flag)
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -508,7 +633,7 @@ Status MySQLMetaImpl::DescribeTableIndex(const std::string &table_id, TableIndex
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -548,7 +673,7 @@ Status MySQLMetaImpl::DropTableIndex(const std::string &table_id) {
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -611,7 +736,7 @@ Status MySQLMetaImpl::DeleteTable(const std::string &table_id) {
|
||||
try {
|
||||
server::MetricCollector metric;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -648,7 +773,7 @@ Status MySQLMetaImpl::DeleteTableFiles(const std::string &table_id) {
|
||||
try {
|
||||
server::MetricCollector metric;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -682,7 +807,7 @@ Status MySQLMetaImpl::DescribeTable(TableSchema &table_schema) {
|
||||
server::MetricCollector metric;
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -735,7 +860,7 @@ Status MySQLMetaImpl::HasTable(const std::string &table_id, bool &has_or_not) {
|
||||
server::MetricCollector metric;
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -770,7 +895,7 @@ Status MySQLMetaImpl::AllTables(std::vector<TableSchema> &table_schema_array) {
|
||||
server::MetricCollector metric;
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -851,7 +976,7 @@ Status MySQLMetaImpl::CreateTableFile(TableFileSchema &file_schema) {
|
||||
std::string date = std::to_string(file_schema.date_);
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -890,7 +1015,7 @@ Status MySQLMetaImpl::FilesToIndex(TableFilesSchema &files) {
|
||||
server::MetricCollector metric;
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -974,7 +1099,7 @@ Status MySQLMetaImpl::FilesToSearch(const std::string &table_id,
|
||||
server::MetricCollector metric;
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1093,7 +1218,7 @@ Status MySQLMetaImpl::FilesToMerge(const std::string &table_id,
|
||||
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1184,7 +1309,7 @@ Status MySQLMetaImpl::GetTableFiles(const std::string &table_id,
|
||||
try {
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1253,7 +1378,7 @@ Status MySQLMetaImpl::GetTableFiles(const std::string &table_id,
|
||||
|
||||
// PXU TODO: Support Swap
|
||||
Status MySQLMetaImpl::Archive() {
|
||||
auto &criterias = options_.archive_conf.GetCriterias();
|
||||
auto &criterias = options_.archive_conf_.GetCriterias();
|
||||
if (criterias.empty()) {
|
||||
return Status::OK();
|
||||
}
|
||||
@ -1266,7 +1391,7 @@ Status MySQLMetaImpl::Archive() {
|
||||
long now = utils::GetMicroSecTimeStamp();
|
||||
|
||||
try {
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1307,7 +1432,7 @@ Status MySQLMetaImpl::Size(uint64_t &result) {
|
||||
try {
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1347,7 +1472,7 @@ Status MySQLMetaImpl::DiscardFiles(long long to_discard_size) {
|
||||
server::MetricCollector metric;
|
||||
bool status;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1412,7 +1537,7 @@ Status MySQLMetaImpl::UpdateTableFile(TableFileSchema &file_schema) {
|
||||
try {
|
||||
server::MetricCollector metric;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1480,7 +1605,7 @@ Status MySQLMetaImpl::UpdateTableFile(TableFileSchema &file_schema) {
|
||||
|
||||
Status MySQLMetaImpl::UpdateTableFilesToIndex(const std::string &table_id) {
|
||||
try {
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1511,7 +1636,7 @@ Status MySQLMetaImpl::UpdateTableFiles(TableFilesSchema &files) {
|
||||
try {
|
||||
server::MetricCollector metric;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1596,7 +1721,7 @@ Status MySQLMetaImpl::CleanUpFilesWithTTL(uint16_t seconds) {
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1668,7 +1793,7 @@ Status MySQLMetaImpl::CleanUpFilesWithTTL(uint16_t seconds) {
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1719,7 +1844,7 @@ Status MySQLMetaImpl::CleanUpFilesWithTTL(uint16_t seconds) {
|
||||
server::MetricCollector metric;
|
||||
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1749,7 +1874,7 @@ Status MySQLMetaImpl::CleanUpFilesWithTTL(uint16_t seconds) {
|
||||
|
||||
Status MySQLMetaImpl::CleanUp() {
|
||||
try {
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1800,7 +1925,7 @@ Status MySQLMetaImpl::Count(const std::string &table_id, uint64_t &result) {
|
||||
|
||||
StoreQueryResult res;
|
||||
{
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
@ -1836,14 +1961,14 @@ Status MySQLMetaImpl::Count(const std::string &table_id, uint64_t &result) {
|
||||
Status MySQLMetaImpl::DropAll() {
|
||||
try {
|
||||
ENGINE_LOG_DEBUG << "Drop all mysql meta";
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab);
|
||||
ScopedConnection connectionPtr(*mysql_connection_pool_, safe_grab_);
|
||||
|
||||
if (connectionPtr == nullptr) {
|
||||
return Status(DB_ERROR, "Failed to connect to database server");
|
||||
}
|
||||
|
||||
Query dropTableQuery = connectionPtr->query();
|
||||
dropTableQuery << "DROP TABLE IF EXISTS " << META_TABLES << ", " << META_TABLEFILES << ";";
|
||||
dropTableQuery << "DROP TABLE IF EXISTS " << TABLES_SCHEMA.name() << ", " << TABLEFILES_SCHEMA.name() << ";";
|
||||
|
||||
ENGINE_LOG_DEBUG << "MySQLMetaImpl::DropAll: " << dropTableQuery.str();
|
||||
|
||||
|
||||
@ -103,13 +103,16 @@ class MySQLMetaImpl : public Meta {
|
||||
Status NextFileId(std::string &file_id);
|
||||
Status NextTableId(std::string &table_id);
|
||||
Status DiscardFiles(long long to_discard_size);
|
||||
|
||||
void ValidateMetaSchema();
|
||||
Status Initialize();
|
||||
|
||||
private:
|
||||
const DBMetaOptions options_;
|
||||
const int mode_;
|
||||
|
||||
std::shared_ptr<MySQLConnectionPool> mysql_connection_pool_;
|
||||
bool safe_grab = false;
|
||||
bool safe_grab_ = false;
|
||||
|
||||
// std::mutex connectionMutex_;
|
||||
}; // DBMetaImpl
|
||||
|
||||
@ -84,7 +84,6 @@ inline auto StoragePrototype(const std::string &path) {
|
||||
|
||||
using ConnectorT = decltype(StoragePrototype(""));
|
||||
static std::unique_ptr<ConnectorT> ConnectorPtr;
|
||||
using ConditionT = decltype(c(&TableFileSchema::id_) == 1UL);
|
||||
|
||||
SqliteMetaImpl::SqliteMetaImpl(const DBMetaOptions &options_)
|
||||
: options_(options_) {
|
||||
@ -111,28 +110,36 @@ Status SqliteMetaImpl::NextFileId(std::string &file_id) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void SqliteMetaImpl::ValidateMetaSchema() {
|
||||
if(ConnectorPtr == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
//old meta could be recreated since schema changed, throw exception if meta schema is not compatible
|
||||
auto ret = ConnectorPtr->sync_schema_simulate();
|
||||
if(ret.find(META_TABLES) != ret.end()
|
||||
&& sqlite_orm::sync_schema_result::dropped_and_recreated == ret[META_TABLES]) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta Tables schema is created by Milvus old version");
|
||||
}
|
||||
if(ret.find(META_TABLEFILES) != ret.end()
|
||||
&& sqlite_orm::sync_schema_result::dropped_and_recreated == ret[META_TABLEFILES]) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta TableFiles schema is created by Milvus old version");
|
||||
}
|
||||
}
|
||||
|
||||
Status SqliteMetaImpl::Initialize() {
|
||||
if (!boost::filesystem::is_directory(options_.path)) {
|
||||
auto ret = boost::filesystem::create_directory(options_.path);
|
||||
if (!boost::filesystem::is_directory(options_.path_)) {
|
||||
auto ret = boost::filesystem::create_directory(options_.path_);
|
||||
if (!ret) {
|
||||
std::string msg = "Failed to create db directory " + options_.path;
|
||||
std::string msg = "Failed to create db directory " + options_.path_;
|
||||
ENGINE_LOG_ERROR << msg;
|
||||
return Status(DB_INVALID_PATH, msg);
|
||||
}
|
||||
}
|
||||
|
||||
ConnectorPtr = std::make_unique<ConnectorT>(StoragePrototype(options_.path + "/meta.sqlite"));
|
||||
ConnectorPtr = std::make_unique<ConnectorT>(StoragePrototype(options_.path_ + "/meta.sqlite"));
|
||||
|
||||
//old meta could be recreated since schema changed, throw exception if meta schema is not compatible
|
||||
auto ret = ConnectorPtr->sync_schema_simulate();
|
||||
if(ret.find(META_TABLES) != ret.end()
|
||||
&& sqlite_orm::sync_schema_result::dropped_and_recreated == ret[META_TABLES]) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta schema is created by Milvus old version");
|
||||
}
|
||||
if(ret.find(META_TABLEFILES) != ret.end()
|
||||
&& sqlite_orm::sync_schema_result::dropped_and_recreated == ret[META_TABLEFILES]) {
|
||||
throw Exception(DB_INCOMPATIB_META, "Meta schema is created by Milvus old version");
|
||||
}
|
||||
ValidateMetaSchema();
|
||||
|
||||
ConnectorPtr->sync_schema();
|
||||
ConnectorPtr->open_forever(); // thread safe option
|
||||
@ -879,7 +886,7 @@ Status SqliteMetaImpl::GetTableFiles(const std::string& table_id,
|
||||
|
||||
// PXU TODO: Support Swap
|
||||
Status SqliteMetaImpl::Archive() {
|
||||
auto &criterias = options_.archive_conf.GetCriterias();
|
||||
auto &criterias = options_.archive_conf_.GetCriterias();
|
||||
if (criterias.size() == 0) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -97,10 +97,12 @@ class SqliteMetaImpl : public Meta {
|
||||
Status NextFileId(std::string &file_id);
|
||||
Status NextTableId(std::string &table_id);
|
||||
Status DiscardFiles(long to_discard_size);
|
||||
|
||||
void ValidateMetaSchema();
|
||||
Status Initialize();
|
||||
|
||||
private:
|
||||
const DBMetaOptions options_;
|
||||
|
||||
std::mutex meta_mutex_;
|
||||
}; // DBMetaImpl
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ MilvusService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& chan
|
||||
, rpcmethod_SearchInFiles_(MilvusService_method_names[6], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_DescribeTable_(MilvusService_method_names[7], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_CountTable_(MilvusService_method_names[8], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_ShowTables_(MilvusService_method_names[9], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
|
||||
, rpcmethod_ShowTables_(MilvusService_method_names[9], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_Cmd_(MilvusService_method_names[10], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_DeleteByRange_(MilvusService_method_names[11], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_PreloadTable_(MilvusService_method_names[12], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
@ -313,20 +313,32 @@ void MilvusService::Stub::experimental_async::CountTable(::grpc::ClientContext*
|
||||
return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TableRowCount>::Create(channel_.get(), cq, rpcmethod_CountTable_, context, request, false);
|
||||
}
|
||||
|
||||
::grpc::ClientReader< ::milvus::grpc::TableName>* MilvusService::Stub::ShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request) {
|
||||
return ::grpc_impl::internal::ClientReaderFactory< ::milvus::grpc::TableName>::Create(channel_.get(), rpcmethod_ShowTables_, context, request);
|
||||
::grpc::Status MilvusService::Stub::ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::milvus::grpc::TableNameList* response) {
|
||||
return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_ShowTables_, context, request, response);
|
||||
}
|
||||
|
||||
void MilvusService::Stub::experimental_async::ShowTables(::grpc::ClientContext* context, ::milvus::grpc::Command* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TableName>* reactor) {
|
||||
::grpc_impl::internal::ClientCallbackReaderFactory< ::milvus::grpc::TableName>::Create(stub_->channel_.get(), stub_->rpcmethod_ShowTables_, context, request, reactor);
|
||||
void MilvusService::Stub::experimental_async::ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_ShowTables_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncReader< ::milvus::grpc::TableName>* MilvusService::Stub::AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TableName>::Create(channel_.get(), cq, rpcmethod_ShowTables_, context, request, true, tag);
|
||||
void MilvusService::Stub::experimental_async::ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)> f) {
|
||||
::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_ShowTables_, context, request, response, std::move(f));
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncReader< ::milvus::grpc::TableName>* MilvusService::Stub::PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc_impl::internal::ClientAsyncReaderFactory< ::milvus::grpc::TableName>::Create(channel_.get(), cq, rpcmethod_ShowTables_, context, request, false, nullptr);
|
||||
void MilvusService::Stub::experimental_async::ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
|
||||
::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_ShowTables_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
void MilvusService::Stub::experimental_async::ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
|
||||
::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_ShowTables_, context, request, response, reactor);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>* MilvusService::Stub::AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TableNameList>::Create(channel_.get(), cq, rpcmethod_ShowTables_, context, request, true);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>* MilvusService::Stub::PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::milvus::grpc::TableNameList>::Create(channel_.get(), cq, rpcmethod_ShowTables_, context, request, false);
|
||||
}
|
||||
|
||||
::grpc::Status MilvusService::Stub::Cmd(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::milvus::grpc::StringReply* response) {
|
||||
@ -517,8 +529,8 @@ MilvusService::Service::Service() {
|
||||
std::mem_fn(&MilvusService::Service::CountTable), this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
MilvusService_method_names[9],
|
||||
::grpc::internal::RpcMethod::SERVER_STREAMING,
|
||||
new ::grpc::internal::ServerStreamingHandler< MilvusService::Service, ::milvus::grpc::Command, ::milvus::grpc::TableName>(
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< MilvusService::Service, ::milvus::grpc::Command, ::milvus::grpc::TableNameList>(
|
||||
std::mem_fn(&MilvusService::Service::ShowTables), this)));
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
MilvusService_method_names[10],
|
||||
@ -613,10 +625,10 @@ MilvusService::Service::~Service() {
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
::grpc::Status MilvusService::Service::ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) {
|
||||
::grpc::Status MilvusService::Service::ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) {
|
||||
(void) context;
|
||||
(void) request;
|
||||
(void) writer;
|
||||
(void) response;
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
|
||||
|
||||
@ -192,14 +192,12 @@ class MilvusService final {
|
||||
//
|
||||
//
|
||||
// @return table names.
|
||||
std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TableName>> ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReaderInterface< ::milvus::grpc::TableName>>(ShowTablesRaw(context, request));
|
||||
virtual ::grpc::Status ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::milvus::grpc::TableNameList* response) = 0;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>> AsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>>(AsyncShowTablesRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>> AsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>>(AsyncShowTablesRaw(context, request, cq, tag));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>> PrepareAsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>>(PrepareAsyncShowTablesRaw(context, request, cq));
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>> PrepareAsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>>(PrepareAsyncShowTablesRaw(context, request, cq));
|
||||
}
|
||||
// *
|
||||
// @brief Give the server status
|
||||
@ -387,7 +385,10 @@ class MilvusService final {
|
||||
//
|
||||
//
|
||||
// @return table names.
|
||||
virtual void ShowTables(::grpc::ClientContext* context, ::milvus::grpc::Command* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TableName>* reactor) = 0;
|
||||
virtual void ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)>) = 0;
|
||||
virtual void ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)>) = 0;
|
||||
virtual void ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
|
||||
virtual void ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
|
||||
// *
|
||||
// @brief Give the server status
|
||||
//
|
||||
@ -459,9 +460,8 @@ class MilvusService final {
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableSchema>* PrepareAsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableRowCount>* AsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableRowCount>* PrepareAsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientReaderInterface< ::milvus::grpc::TableName>* ShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>* AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< ::milvus::grpc::TableName>* PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>* AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::TableNameList>* PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::StringReply>* AsyncCmdRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::StringReply>* PrepareAsyncCmdRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::milvus::grpc::Status>* AsyncDeleteByRangeRaw(::grpc::ClientContext* context, const ::milvus::grpc::DeleteByRangeParam& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
@ -539,14 +539,12 @@ class MilvusService final {
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableRowCount>> PrepareAsyncCountTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableRowCount>>(PrepareAsyncCountTableRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TableName>> ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReader< ::milvus::grpc::TableName>>(ShowTablesRaw(context, request));
|
||||
::grpc::Status ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::milvus::grpc::TableNameList* response) override;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>> AsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>>(AsyncShowTablesRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TableName>> AsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TableName>>(AsyncShowTablesRaw(context, request, cq, tag));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TableName>> PrepareAsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReader< ::milvus::grpc::TableName>>(PrepareAsyncShowTablesRaw(context, request, cq));
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>> PrepareAsyncShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>>(PrepareAsyncShowTablesRaw(context, request, cq));
|
||||
}
|
||||
::grpc::Status Cmd(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::milvus::grpc::StringReply* response) override;
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::milvus::grpc::StringReply>> AsyncCmd(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) {
|
||||
@ -622,7 +620,10 @@ class MilvusService final {
|
||||
void CountTable(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableRowCount* response, std::function<void(::grpc::Status)>) override;
|
||||
void CountTable(::grpc::ClientContext* context, const ::milvus::grpc::TableName* request, ::milvus::grpc::TableRowCount* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
|
||||
void CountTable(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableRowCount* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
|
||||
void ShowTables(::grpc::ClientContext* context, ::milvus::grpc::Command* request, ::grpc::experimental::ClientReadReactor< ::milvus::grpc::TableName>* reactor) override;
|
||||
void ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)>) override;
|
||||
void ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, std::function<void(::grpc::Status)>) override;
|
||||
void ShowTables(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
|
||||
void ShowTables(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
|
||||
void Cmd(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::StringReply* response, std::function<void(::grpc::Status)>) override;
|
||||
void Cmd(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::milvus::grpc::StringReply* response, std::function<void(::grpc::Status)>) override;
|
||||
void Cmd(::grpc::ClientContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::StringReply* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
|
||||
@ -672,9 +673,8 @@ class MilvusService final {
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableSchema>* PrepareAsyncDescribeTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableRowCount>* AsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableRowCount>* PrepareAsyncCountTableRaw(::grpc::ClientContext* context, const ::milvus::grpc::TableName& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientReader< ::milvus::grpc::TableName>* ShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request) override;
|
||||
::grpc::ClientAsyncReader< ::milvus::grpc::TableName>* AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq, void* tag) override;
|
||||
::grpc::ClientAsyncReader< ::milvus::grpc::TableName>* PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>* AsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::TableNameList>* PrepareAsyncShowTablesRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::StringReply>* AsyncCmdRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::StringReply>* PrepareAsyncCmdRaw(::grpc::ClientContext* context, const ::milvus::grpc::Command& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< ::milvus::grpc::Status>* AsyncDeleteByRangeRaw(::grpc::ClientContext* context, const ::milvus::grpc::DeleteByRangeParam& request, ::grpc::CompletionQueue* cq) override;
|
||||
@ -798,7 +798,7 @@ class MilvusService final {
|
||||
//
|
||||
//
|
||||
// @return table names.
|
||||
virtual ::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer);
|
||||
virtual ::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response);
|
||||
// *
|
||||
// @brief Give the server status
|
||||
//
|
||||
@ -1027,12 +1027,12 @@ class MilvusService final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
void RequestShowTables(::grpc::ServerContext* context, ::milvus::grpc::Command* request, ::grpc::ServerAsyncWriter< ::milvus::grpc::TableName>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncServerStreaming(9, context, request, writer, new_call_cq, notification_cq, tag);
|
||||
void RequestShowTables(::grpc::ServerContext* context, ::milvus::grpc::Command* request, ::grpc::ServerAsyncResponseWriter< ::milvus::grpc::TableNameList>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
@ -1422,20 +1422,29 @@ class MilvusService final {
|
||||
public:
|
||||
ExperimentalWithCallbackMethod_ShowTables() {
|
||||
::grpc::Service::experimental().MarkMethodCallback(9,
|
||||
new ::grpc_impl::internal::CallbackServerStreamingHandler< ::milvus::grpc::Command, ::milvus::grpc::TableName>(
|
||||
[this] { return this->ShowTables(); }));
|
||||
new ::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::Command, ::milvus::grpc::TableNameList>(
|
||||
[this](::grpc::ServerContext* context,
|
||||
const ::milvus::grpc::Command* request,
|
||||
::milvus::grpc::TableNameList* response,
|
||||
::grpc::experimental::ServerCallbackRpcController* controller) {
|
||||
return this->ShowTables(context, request, response, controller);
|
||||
}));
|
||||
}
|
||||
void SetMessageAllocatorFor_ShowTables(
|
||||
::grpc::experimental::MessageAllocator< ::milvus::grpc::Command, ::milvus::grpc::TableNameList>* allocator) {
|
||||
static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::milvus::grpc::Command, ::milvus::grpc::TableNameList>*>(
|
||||
::grpc::Service::experimental().GetHandler(9))
|
||||
->SetMessageAllocator(allocator);
|
||||
}
|
||||
~ExperimentalWithCallbackMethod_ShowTables() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
virtual ::grpc::experimental::ServerWriteReactor< ::milvus::grpc::Command, ::milvus::grpc::TableName>* ShowTables() {
|
||||
return new ::grpc_impl::internal::UnimplementedWriteReactor<
|
||||
::milvus::grpc::Command, ::milvus::grpc::TableName>;}
|
||||
virtual void ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); }
|
||||
};
|
||||
template <class BaseClass>
|
||||
class ExperimentalWithCallbackMethod_Cmd : public BaseClass {
|
||||
@ -1758,7 +1767,7 @@ class MilvusService final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
@ -2040,12 +2049,12 @@ class MilvusService final {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
void RequestShowTables(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncWriter< ::grpc::ByteBuffer>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncServerStreaming(9, context, request, writer, new_call_cq, notification_cq, tag);
|
||||
void RequestShowTables(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
||||
::grpc::Service::RequestAsyncUnary(9, context, request, response, new_call_cq, notification_cq, tag);
|
||||
}
|
||||
};
|
||||
template <class BaseClass>
|
||||
@ -2380,20 +2389,23 @@ class MilvusService final {
|
||||
public:
|
||||
ExperimentalWithRawCallbackMethod_ShowTables() {
|
||||
::grpc::Service::experimental().MarkMethodRawCallback(9,
|
||||
new ::grpc_impl::internal::CallbackServerStreamingHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
|
||||
[this] { return this->ShowTables(); }));
|
||||
new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
|
||||
[this](::grpc::ServerContext* context,
|
||||
const ::grpc::ByteBuffer* request,
|
||||
::grpc::ByteBuffer* response,
|
||||
::grpc::experimental::ServerCallbackRpcController* controller) {
|
||||
this->ShowTables(context, request, response, controller);
|
||||
}));
|
||||
}
|
||||
~ExperimentalWithRawCallbackMethod_ShowTables() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable synchronous version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
virtual ::grpc::experimental::ServerWriteReactor< ::grpc::ByteBuffer, ::grpc::ByteBuffer>* ShowTables() {
|
||||
return new ::grpc_impl::internal::UnimplementedWriteReactor<
|
||||
::grpc::ByteBuffer, ::grpc::ByteBuffer>;}
|
||||
virtual void ShowTables(::grpc::ServerContext* context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response, ::grpc::experimental::ServerCallbackRpcController* controller) { controller->Finish(::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "")); }
|
||||
};
|
||||
template <class BaseClass>
|
||||
class ExperimentalWithRawCallbackMethod_Cmd : public BaseClass {
|
||||
@ -2701,6 +2713,26 @@ class MilvusService final {
|
||||
virtual ::grpc::Status StreamedCountTable(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::TableName,::milvus::grpc::TableRowCount>* server_unary_streamer) = 0;
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithStreamedUnaryMethod_ShowTables : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
||||
public:
|
||||
WithStreamedUnaryMethod_ShowTables() {
|
||||
::grpc::Service::MarkMethodStreamed(9,
|
||||
new ::grpc::internal::StreamedUnaryHandler< ::milvus::grpc::Command, ::milvus::grpc::TableNameList>(std::bind(&WithStreamedUnaryMethod_ShowTables<BaseClass>::StreamedShowTables, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
}
|
||||
~WithStreamedUnaryMethod_ShowTables() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable regular version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::milvus::grpc::TableNameList* response) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedShowTables(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::Command,::milvus::grpc::TableNameList>* server_unary_streamer) = 0;
|
||||
};
|
||||
template <class BaseClass>
|
||||
class WithStreamedUnaryMethod_Cmd : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
||||
@ -2800,29 +2832,9 @@ class MilvusService final {
|
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedDropIndex(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::milvus::grpc::TableName,::milvus::grpc::Status>* server_unary_streamer) = 0;
|
||||
};
|
||||
typedef WithStreamedUnaryMethod_CreateTable<WithStreamedUnaryMethod_HasTable<WithStreamedUnaryMethod_DropTable<WithStreamedUnaryMethod_CreateIndex<WithStreamedUnaryMethod_Insert<WithStreamedUnaryMethod_Search<WithStreamedUnaryMethod_SearchInFiles<WithStreamedUnaryMethod_DescribeTable<WithStreamedUnaryMethod_CountTable<WithStreamedUnaryMethod_Cmd<WithStreamedUnaryMethod_DeleteByRange<WithStreamedUnaryMethod_PreloadTable<WithStreamedUnaryMethod_DescribeIndex<WithStreamedUnaryMethod_DropIndex<Service > > > > > > > > > > > > > > StreamedUnaryService;
|
||||
template <class BaseClass>
|
||||
class WithSplitStreamingMethod_ShowTables : public BaseClass {
|
||||
private:
|
||||
void BaseClassMustBeDerivedFromService(const Service *service) {}
|
||||
public:
|
||||
WithSplitStreamingMethod_ShowTables() {
|
||||
::grpc::Service::MarkMethodStreamed(9,
|
||||
new ::grpc::internal::SplitServerStreamingHandler< ::milvus::grpc::Command, ::milvus::grpc::TableName>(std::bind(&WithSplitStreamingMethod_ShowTables<BaseClass>::StreamedShowTables, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
}
|
||||
~WithSplitStreamingMethod_ShowTables() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
}
|
||||
// disable regular version of this method
|
||||
::grpc::Status ShowTables(::grpc::ServerContext* context, const ::milvus::grpc::Command* request, ::grpc::ServerWriter< ::milvus::grpc::TableName>* writer) override {
|
||||
abort();
|
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
// replace default version of method with split streamed
|
||||
virtual ::grpc::Status StreamedShowTables(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::milvus::grpc::Command,::milvus::grpc::TableName>* server_split_streamer) = 0;
|
||||
};
|
||||
typedef WithSplitStreamingMethod_ShowTables<Service > SplitStreamedService;
|
||||
typedef WithStreamedUnaryMethod_CreateTable<WithStreamedUnaryMethod_HasTable<WithStreamedUnaryMethod_DropTable<WithStreamedUnaryMethod_CreateIndex<WithStreamedUnaryMethod_Insert<WithStreamedUnaryMethod_Search<WithStreamedUnaryMethod_SearchInFiles<WithStreamedUnaryMethod_DescribeTable<WithStreamedUnaryMethod_CountTable<WithSplitStreamingMethod_ShowTables<WithStreamedUnaryMethod_Cmd<WithStreamedUnaryMethod_DeleteByRange<WithStreamedUnaryMethod_PreloadTable<WithStreamedUnaryMethod_DescribeIndex<WithStreamedUnaryMethod_DropIndex<Service > > > > > > > > > > > > > > > StreamedService;
|
||||
typedef WithStreamedUnaryMethod_CreateTable<WithStreamedUnaryMethod_HasTable<WithStreamedUnaryMethod_DropTable<WithStreamedUnaryMethod_CreateIndex<WithStreamedUnaryMethod_Insert<WithStreamedUnaryMethod_Search<WithStreamedUnaryMethod_SearchInFiles<WithStreamedUnaryMethod_DescribeTable<WithStreamedUnaryMethod_CountTable<WithStreamedUnaryMethod_ShowTables<WithStreamedUnaryMethod_Cmd<WithStreamedUnaryMethod_DeleteByRange<WithStreamedUnaryMethod_PreloadTable<WithStreamedUnaryMethod_DescribeIndex<WithStreamedUnaryMethod_DropIndex<Service > > > > > > > > > > > > > > > StreamedUnaryService;
|
||||
typedef Service SplitStreamedService;
|
||||
typedef WithStreamedUnaryMethod_CreateTable<WithStreamedUnaryMethod_HasTable<WithStreamedUnaryMethod_DropTable<WithStreamedUnaryMethod_CreateIndex<WithStreamedUnaryMethod_Insert<WithStreamedUnaryMethod_Search<WithStreamedUnaryMethod_SearchInFiles<WithStreamedUnaryMethod_DescribeTable<WithStreamedUnaryMethod_CountTable<WithStreamedUnaryMethod_ShowTables<WithStreamedUnaryMethod_Cmd<WithStreamedUnaryMethod_DeleteByRange<WithStreamedUnaryMethod_PreloadTable<WithStreamedUnaryMethod_DescribeIndex<WithStreamedUnaryMethod_DropIndex<Service > > > > > > > > > > > > > > > StreamedService;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -48,7 +48,7 @@ struct TableStruct_milvus_2eproto {
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[18]
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[19]
|
||||
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
|
||||
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
|
||||
@ -96,6 +96,9 @@ extern StringReplyDefaultTypeInternal _StringReply_default_instance_;
|
||||
class TableName;
|
||||
class TableNameDefaultTypeInternal;
|
||||
extern TableNameDefaultTypeInternal _TableName_default_instance_;
|
||||
class TableNameList;
|
||||
class TableNameListDefaultTypeInternal;
|
||||
extern TableNameListDefaultTypeInternal _TableNameList_default_instance_;
|
||||
class TableRowCount;
|
||||
class TableRowCountDefaultTypeInternal;
|
||||
extern TableRowCountDefaultTypeInternal _TableRowCount_default_instance_;
|
||||
@ -127,6 +130,7 @@ template<> ::milvus::grpc::SearchInFilesParam* Arena::CreateMaybeMessage<::milvu
|
||||
template<> ::milvus::grpc::SearchParam* Arena::CreateMaybeMessage<::milvus::grpc::SearchParam>(Arena*);
|
||||
template<> ::milvus::grpc::StringReply* Arena::CreateMaybeMessage<::milvus::grpc::StringReply>(Arena*);
|
||||
template<> ::milvus::grpc::TableName* Arena::CreateMaybeMessage<::milvus::grpc::TableName>(Arena*);
|
||||
template<> ::milvus::grpc::TableNameList* Arena::CreateMaybeMessage<::milvus::grpc::TableNameList>(Arena*);
|
||||
template<> ::milvus::grpc::TableRowCount* Arena::CreateMaybeMessage<::milvus::grpc::TableRowCount>(Arena*);
|
||||
template<> ::milvus::grpc::TableSchema* Arena::CreateMaybeMessage<::milvus::grpc::TableSchema>(Arena*);
|
||||
template<> ::milvus::grpc::TopKQueryResult* Arena::CreateMaybeMessage<::milvus::grpc::TopKQueryResult>(Arena*);
|
||||
@ -251,10 +255,9 @@ class TableName :
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTableNameFieldNumber = 2,
|
||||
kStatusFieldNumber = 1,
|
||||
kTableNameFieldNumber = 1,
|
||||
};
|
||||
// string table_name = 2;
|
||||
// string table_name = 1;
|
||||
void clear_table_name();
|
||||
const std::string& table_name() const;
|
||||
void set_table_name(const std::string& value);
|
||||
@ -265,6 +268,150 @@ class TableName :
|
||||
std::string* release_table_name();
|
||||
void set_allocated_table_name(std::string* table_name);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:milvus.grpc.TableName)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr table_name_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_milvus_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class TableNameList :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.grpc.TableNameList) */ {
|
||||
public:
|
||||
TableNameList();
|
||||
virtual ~TableNameList();
|
||||
|
||||
TableNameList(const TableNameList& from);
|
||||
TableNameList(TableNameList&& from) noexcept
|
||||
: TableNameList() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline TableNameList& operator=(const TableNameList& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline TableNameList& operator=(TableNameList&& from) noexcept {
|
||||
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
|
||||
if (this != &from) InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return GetMetadataStatic().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return GetMetadataStatic().reflection;
|
||||
}
|
||||
static const TableNameList& default_instance();
|
||||
|
||||
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
|
||||
static inline const TableNameList* internal_default_instance() {
|
||||
return reinterpret_cast<const TableNameList*>(
|
||||
&_TableNameList_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
1;
|
||||
|
||||
friend void swap(TableNameList& a, TableNameList& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(TableNameList* other) {
|
||||
if (other == this) return;
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
inline TableNameList* New() const final {
|
||||
return CreateMaybeMessage<TableNameList>(nullptr);
|
||||
}
|
||||
|
||||
TableNameList* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
|
||||
return CreateMaybeMessage<TableNameList>(arena);
|
||||
}
|
||||
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
|
||||
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
|
||||
void CopyFrom(const TableNameList& from);
|
||||
void MergeFrom(const TableNameList& from);
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
#else
|
||||
bool MergePartialFromCodedStream(
|
||||
::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) final;
|
||||
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
|
||||
void SerializeWithCachedSizes(
|
||||
::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const final;
|
||||
::PROTOBUF_NAMESPACE_ID::uint8* InternalSerializeWithCachedSizesToArray(
|
||||
::PROTOBUF_NAMESPACE_ID::uint8* target) const final;
|
||||
int GetCachedSize() const final { return _cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
inline void SharedCtor();
|
||||
inline void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(TableNameList* other);
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "milvus.grpc.TableNameList";
|
||||
}
|
||||
private:
|
||||
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
|
||||
return nullptr;
|
||||
}
|
||||
inline void* MaybeArenaPtr() const {
|
||||
return nullptr;
|
||||
}
|
||||
public:
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
private:
|
||||
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_milvus_2eproto);
|
||||
return ::descriptor_table_milvus_2eproto.file_level_metadata[kIndexInFileMessages];
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTableNamesFieldNumber = 2,
|
||||
kStatusFieldNumber = 1,
|
||||
};
|
||||
// repeated string table_names = 2;
|
||||
int table_names_size() const;
|
||||
void clear_table_names();
|
||||
const std::string& table_names(int index) const;
|
||||
std::string* mutable_table_names(int index);
|
||||
void set_table_names(int index, const std::string& value);
|
||||
void set_table_names(int index, std::string&& value);
|
||||
void set_table_names(int index, const char* value);
|
||||
void set_table_names(int index, const char* value, size_t size);
|
||||
std::string* add_table_names();
|
||||
void add_table_names(const std::string& value);
|
||||
void add_table_names(std::string&& value);
|
||||
void add_table_names(const char* value);
|
||||
void add_table_names(const char* value, size_t size);
|
||||
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& table_names() const;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_table_names();
|
||||
|
||||
// .milvus.grpc.Status status = 1;
|
||||
bool has_status() const;
|
||||
void clear_status();
|
||||
@ -273,12 +420,12 @@ class TableName :
|
||||
::milvus::grpc::Status* mutable_status();
|
||||
void set_allocated_status(::milvus::grpc::Status* status);
|
||||
|
||||
// @@protoc_insertion_point(class_scope:milvus.grpc.TableName)
|
||||
// @@protoc_insertion_point(class_scope:milvus.grpc.TableNameList)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr table_name_;
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> table_names_;
|
||||
::milvus::grpc::Status* status_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_milvus_2eproto;
|
||||
@ -327,7 +474,7 @@ class TableSchema :
|
||||
&_TableSchema_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
1;
|
||||
2;
|
||||
|
||||
friend void swap(TableSchema& a, TableSchema& b) {
|
||||
a.Swap(&b);
|
||||
@ -398,30 +545,42 @@ class TableSchema :
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTableNameFieldNumber = 1,
|
||||
kDimensionFieldNumber = 2,
|
||||
kIndexFileSizeFieldNumber = 3,
|
||||
kMetricTypeFieldNumber = 4,
|
||||
kTableNameFieldNumber = 2,
|
||||
kStatusFieldNumber = 1,
|
||||
kDimensionFieldNumber = 3,
|
||||
kIndexFileSizeFieldNumber = 4,
|
||||
kMetricTypeFieldNumber = 5,
|
||||
};
|
||||
// .milvus.grpc.TableName table_name = 1;
|
||||
bool has_table_name() const;
|
||||
// string table_name = 2;
|
||||
void clear_table_name();
|
||||
const ::milvus::grpc::TableName& table_name() const;
|
||||
::milvus::grpc::TableName* release_table_name();
|
||||
::milvus::grpc::TableName* mutable_table_name();
|
||||
void set_allocated_table_name(::milvus::grpc::TableName* table_name);
|
||||
const std::string& table_name() const;
|
||||
void set_table_name(const std::string& value);
|
||||
void set_table_name(std::string&& value);
|
||||
void set_table_name(const char* value);
|
||||
void set_table_name(const char* value, size_t size);
|
||||
std::string* mutable_table_name();
|
||||
std::string* release_table_name();
|
||||
void set_allocated_table_name(std::string* table_name);
|
||||
|
||||
// int64 dimension = 2;
|
||||
// .milvus.grpc.Status status = 1;
|
||||
bool has_status() const;
|
||||
void clear_status();
|
||||
const ::milvus::grpc::Status& status() const;
|
||||
::milvus::grpc::Status* release_status();
|
||||
::milvus::grpc::Status* mutable_status();
|
||||
void set_allocated_status(::milvus::grpc::Status* status);
|
||||
|
||||
// int64 dimension = 3;
|
||||
void clear_dimension();
|
||||
::PROTOBUF_NAMESPACE_ID::int64 dimension() const;
|
||||
void set_dimension(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
|
||||
// int64 index_file_size = 3;
|
||||
// int64 index_file_size = 4;
|
||||
void clear_index_file_size();
|
||||
::PROTOBUF_NAMESPACE_ID::int64 index_file_size() const;
|
||||
void set_index_file_size(::PROTOBUF_NAMESPACE_ID::int64 value);
|
||||
|
||||
// int32 metric_type = 4;
|
||||
// int32 metric_type = 5;
|
||||
void clear_metric_type();
|
||||
::PROTOBUF_NAMESPACE_ID::int32 metric_type() const;
|
||||
void set_metric_type(::PROTOBUF_NAMESPACE_ID::int32 value);
|
||||
@ -431,7 +590,8 @@ class TableSchema :
|
||||
class _Internal;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
|
||||
::milvus::grpc::TableName* table_name_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr table_name_;
|
||||
::milvus::grpc::Status* status_;
|
||||
::PROTOBUF_NAMESPACE_ID::int64 dimension_;
|
||||
::PROTOBUF_NAMESPACE_ID::int64 index_file_size_;
|
||||
::PROTOBUF_NAMESPACE_ID::int32 metric_type_;
|
||||
@ -482,7 +642,7 @@ class Range :
|
||||
&_Range_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
2;
|
||||
3;
|
||||
|
||||
friend void swap(Range& a, Range& b) {
|
||||
a.Swap(&b);
|
||||
@ -632,7 +792,7 @@ class RowRecord :
|
||||
&_RowRecord_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
3;
|
||||
4;
|
||||
|
||||
friend void swap(RowRecord& a, RowRecord& b) {
|
||||
a.Swap(&b);
|
||||
@ -770,7 +930,7 @@ class InsertParam :
|
||||
&_InsertParam_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
4;
|
||||
5;
|
||||
|
||||
friend void swap(InsertParam& a, InsertParam& b) {
|
||||
a.Swap(&b);
|
||||
@ -934,7 +1094,7 @@ class VectorIds :
|
||||
&_VectorIds_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
5;
|
||||
6;
|
||||
|
||||
friend void swap(VectorIds& a, VectorIds& b) {
|
||||
a.Swap(&b);
|
||||
@ -1082,7 +1242,7 @@ class SearchParam :
|
||||
&_SearchParam_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
6;
|
||||
7;
|
||||
|
||||
friend void swap(SearchParam& a, SearchParam& b) {
|
||||
a.Swap(&b);
|
||||
@ -1259,7 +1419,7 @@ class SearchInFilesParam :
|
||||
&_SearchInFilesParam_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
7;
|
||||
8;
|
||||
|
||||
friend void swap(SearchInFilesParam& a, SearchInFilesParam& b) {
|
||||
a.Swap(&b);
|
||||
@ -1412,7 +1572,7 @@ class QueryResult :
|
||||
&_QueryResult_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
8;
|
||||
9;
|
||||
|
||||
friend void swap(QueryResult& a, QueryResult& b) {
|
||||
a.Swap(&b);
|
||||
@ -1550,7 +1710,7 @@ class TopKQueryResult :
|
||||
&_TopKQueryResult_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
9;
|
||||
10;
|
||||
|
||||
friend void swap(TopKQueryResult& a, TopKQueryResult& b) {
|
||||
a.Swap(&b);
|
||||
@ -1687,7 +1847,7 @@ class TopKQueryResultList :
|
||||
&_TopKQueryResultList_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
10;
|
||||
11;
|
||||
|
||||
friend void swap(TopKQueryResultList& a, TopKQueryResultList& b) {
|
||||
a.Swap(&b);
|
||||
@ -1834,7 +1994,7 @@ class StringReply :
|
||||
&_StringReply_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
11;
|
||||
12;
|
||||
|
||||
friend void swap(StringReply& a, StringReply& b) {
|
||||
a.Swap(&b);
|
||||
@ -1981,7 +2141,7 @@ class BoolReply :
|
||||
&_BoolReply_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
12;
|
||||
13;
|
||||
|
||||
friend void swap(BoolReply& a, BoolReply& b) {
|
||||
a.Swap(&b);
|
||||
@ -2122,7 +2282,7 @@ class TableRowCount :
|
||||
&_TableRowCount_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
13;
|
||||
14;
|
||||
|
||||
friend void swap(TableRowCount& a, TableRowCount& b) {
|
||||
a.Swap(&b);
|
||||
@ -2263,7 +2423,7 @@ class Command :
|
||||
&_Command_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
14;
|
||||
15;
|
||||
|
||||
friend void swap(Command& a, Command& b) {
|
||||
a.Swap(&b);
|
||||
@ -2400,7 +2560,7 @@ class Index :
|
||||
&_Index_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
15;
|
||||
16;
|
||||
|
||||
friend void swap(Index& a, Index& b) {
|
||||
a.Swap(&b);
|
||||
@ -2538,7 +2698,7 @@ class IndexParam :
|
||||
&_IndexParam_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
16;
|
||||
17;
|
||||
|
||||
friend void swap(IndexParam& a, IndexParam& b) {
|
||||
a.Swap(&b);
|
||||
@ -2609,18 +2769,30 @@ class IndexParam :
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kTableNameFieldNumber = 1,
|
||||
kIndexFieldNumber = 2,
|
||||
kTableNameFieldNumber = 2,
|
||||
kStatusFieldNumber = 1,
|
||||
kIndexFieldNumber = 3,
|
||||
};
|
||||
// .milvus.grpc.TableName table_name = 1;
|
||||
bool has_table_name() const;
|
||||
// string table_name = 2;
|
||||
void clear_table_name();
|
||||
const ::milvus::grpc::TableName& table_name() const;
|
||||
::milvus::grpc::TableName* release_table_name();
|
||||
::milvus::grpc::TableName* mutable_table_name();
|
||||
void set_allocated_table_name(::milvus::grpc::TableName* table_name);
|
||||
const std::string& table_name() const;
|
||||
void set_table_name(const std::string& value);
|
||||
void set_table_name(std::string&& value);
|
||||
void set_table_name(const char* value);
|
||||
void set_table_name(const char* value, size_t size);
|
||||
std::string* mutable_table_name();
|
||||
std::string* release_table_name();
|
||||
void set_allocated_table_name(std::string* table_name);
|
||||
|
||||
// .milvus.grpc.Index index = 2;
|
||||
// .milvus.grpc.Status status = 1;
|
||||
bool has_status() const;
|
||||
void clear_status();
|
||||
const ::milvus::grpc::Status& status() const;
|
||||
::milvus::grpc::Status* release_status();
|
||||
::milvus::grpc::Status* mutable_status();
|
||||
void set_allocated_status(::milvus::grpc::Status* status);
|
||||
|
||||
// .milvus.grpc.Index index = 3;
|
||||
bool has_index() const;
|
||||
void clear_index();
|
||||
const ::milvus::grpc::Index& index() const;
|
||||
@ -2633,7 +2805,8 @@ class IndexParam :
|
||||
class _Internal;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
|
||||
::milvus::grpc::TableName* table_name_;
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr table_name_;
|
||||
::milvus::grpc::Status* status_;
|
||||
::milvus::grpc::Index* index_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
friend struct ::TableStruct_milvus_2eproto;
|
||||
@ -2682,7 +2855,7 @@ class DeleteByRangeParam :
|
||||
&_DeleteByRangeParam_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
17;
|
||||
18;
|
||||
|
||||
friend void swap(DeleteByRangeParam& a, DeleteByRangeParam& b) {
|
||||
a.Swap(&b);
|
||||
@ -2796,52 +2969,7 @@ class DeleteByRangeParam :
|
||||
#endif // __GNUC__
|
||||
// TableName
|
||||
|
||||
// .milvus.grpc.Status status = 1;
|
||||
inline bool TableName::has_status() const {
|
||||
return this != internal_default_instance() && status_ != nullptr;
|
||||
}
|
||||
inline const ::milvus::grpc::Status& TableName::status() const {
|
||||
const ::milvus::grpc::Status* p = status_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableName.status)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::Status*>(
|
||||
&::milvus::grpc::_Status_default_instance_);
|
||||
}
|
||||
inline ::milvus::grpc::Status* TableName::release_status() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.TableName.status)
|
||||
|
||||
::milvus::grpc::Status* temp = status_;
|
||||
status_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::milvus::grpc::Status* TableName::mutable_status() {
|
||||
|
||||
if (status_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::Status>(GetArenaNoVirtual());
|
||||
status_ = p;
|
||||
}
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableName.status)
|
||||
return status_;
|
||||
}
|
||||
inline void TableName::set_allocated_status(::milvus::grpc::Status* status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
|
||||
if (message_arena == nullptr) {
|
||||
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(status_);
|
||||
}
|
||||
if (status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
|
||||
if (message_arena != submessage_arena) {
|
||||
status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, status, submessage_arena);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
status_ = status;
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.TableName.status)
|
||||
}
|
||||
|
||||
// string table_name = 2;
|
||||
// string table_name = 1;
|
||||
inline void TableName::clear_table_name() {
|
||||
table_name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
@ -2894,60 +3022,219 @@ inline void TableName::set_allocated_table_name(std::string* table_name) {
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// TableSchema
|
||||
// TableNameList
|
||||
|
||||
// .milvus.grpc.TableName table_name = 1;
|
||||
inline bool TableSchema::has_table_name() const {
|
||||
return this != internal_default_instance() && table_name_ != nullptr;
|
||||
// .milvus.grpc.Status status = 1;
|
||||
inline bool TableNameList::has_status() const {
|
||||
return this != internal_default_instance() && status_ != nullptr;
|
||||
}
|
||||
inline void TableSchema::clear_table_name() {
|
||||
if (GetArenaNoVirtual() == nullptr && table_name_ != nullptr) {
|
||||
delete table_name_;
|
||||
}
|
||||
table_name_ = nullptr;
|
||||
inline const ::milvus::grpc::Status& TableNameList::status() const {
|
||||
const ::milvus::grpc::Status* p = status_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableNameList.status)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::Status*>(
|
||||
&::milvus::grpc::_Status_default_instance_);
|
||||
}
|
||||
inline const ::milvus::grpc::TableName& TableSchema::table_name() const {
|
||||
const ::milvus::grpc::TableName* p = table_name_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableSchema.table_name)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::TableName*>(
|
||||
&::milvus::grpc::_TableName_default_instance_);
|
||||
}
|
||||
inline ::milvus::grpc::TableName* TableSchema::release_table_name() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.TableSchema.table_name)
|
||||
inline ::milvus::grpc::Status* TableNameList::release_status() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.TableNameList.status)
|
||||
|
||||
::milvus::grpc::TableName* temp = table_name_;
|
||||
table_name_ = nullptr;
|
||||
::milvus::grpc::Status* temp = status_;
|
||||
status_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::milvus::grpc::TableName* TableSchema::mutable_table_name() {
|
||||
inline ::milvus::grpc::Status* TableNameList::mutable_status() {
|
||||
|
||||
if (table_name_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::TableName>(GetArenaNoVirtual());
|
||||
table_name_ = p;
|
||||
if (status_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::Status>(GetArenaNoVirtual());
|
||||
status_ = p;
|
||||
}
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableSchema.table_name)
|
||||
return table_name_;
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableNameList.status)
|
||||
return status_;
|
||||
}
|
||||
inline void TableSchema::set_allocated_table_name(::milvus::grpc::TableName* table_name) {
|
||||
inline void TableNameList::set_allocated_status(::milvus::grpc::Status* status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
|
||||
if (message_arena == nullptr) {
|
||||
delete table_name_;
|
||||
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(status_);
|
||||
}
|
||||
if (table_name) {
|
||||
if (status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
|
||||
if (message_arena != submessage_arena) {
|
||||
table_name = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, table_name, submessage_arena);
|
||||
status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, status, submessage_arena);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
table_name_ = table_name;
|
||||
status_ = status;
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.TableNameList.status)
|
||||
}
|
||||
|
||||
// repeated string table_names = 2;
|
||||
inline int TableNameList::table_names_size() const {
|
||||
return table_names_.size();
|
||||
}
|
||||
inline void TableNameList::clear_table_names() {
|
||||
table_names_.Clear();
|
||||
}
|
||||
inline const std::string& TableNameList::table_names(int index) const {
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableNameList.table_names)
|
||||
return table_names_.Get(index);
|
||||
}
|
||||
inline std::string* TableNameList::mutable_table_names(int index) {
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableNameList.table_names)
|
||||
return table_names_.Mutable(index);
|
||||
}
|
||||
inline void TableNameList::set_table_names(int index, const std::string& value) {
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TableNameList.table_names)
|
||||
table_names_.Mutable(index)->assign(value);
|
||||
}
|
||||
inline void TableNameList::set_table_names(int index, std::string&& value) {
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TableNameList.table_names)
|
||||
table_names_.Mutable(index)->assign(std::move(value));
|
||||
}
|
||||
inline void TableNameList::set_table_names(int index, const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
table_names_.Mutable(index)->assign(value);
|
||||
// @@protoc_insertion_point(field_set_char:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline void TableNameList::set_table_names(int index, const char* value, size_t size) {
|
||||
table_names_.Mutable(index)->assign(
|
||||
reinterpret_cast<const char*>(value), size);
|
||||
// @@protoc_insertion_point(field_set_pointer:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline std::string* TableNameList::add_table_names() {
|
||||
// @@protoc_insertion_point(field_add_mutable:milvus.grpc.TableNameList.table_names)
|
||||
return table_names_.Add();
|
||||
}
|
||||
inline void TableNameList::add_table_names(const std::string& value) {
|
||||
table_names_.Add()->assign(value);
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline void TableNameList::add_table_names(std::string&& value) {
|
||||
table_names_.Add(std::move(value));
|
||||
// @@protoc_insertion_point(field_add:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline void TableNameList::add_table_names(const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
table_names_.Add()->assign(value);
|
||||
// @@protoc_insertion_point(field_add_char:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline void TableNameList::add_table_names(const char* value, size_t size) {
|
||||
table_names_.Add()->assign(reinterpret_cast<const char*>(value), size);
|
||||
// @@protoc_insertion_point(field_add_pointer:milvus.grpc.TableNameList.table_names)
|
||||
}
|
||||
inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>&
|
||||
TableNameList::table_names() const {
|
||||
// @@protoc_insertion_point(field_list:milvus.grpc.TableNameList.table_names)
|
||||
return table_names_;
|
||||
}
|
||||
inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>*
|
||||
TableNameList::mutable_table_names() {
|
||||
// @@protoc_insertion_point(field_mutable_list:milvus.grpc.TableNameList.table_names)
|
||||
return &table_names_;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// TableSchema
|
||||
|
||||
// .milvus.grpc.Status status = 1;
|
||||
inline bool TableSchema::has_status() const {
|
||||
return this != internal_default_instance() && status_ != nullptr;
|
||||
}
|
||||
inline const ::milvus::grpc::Status& TableSchema::status() const {
|
||||
const ::milvus::grpc::Status* p = status_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableSchema.status)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::Status*>(
|
||||
&::milvus::grpc::_Status_default_instance_);
|
||||
}
|
||||
inline ::milvus::grpc::Status* TableSchema::release_status() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.TableSchema.status)
|
||||
|
||||
::milvus::grpc::Status* temp = status_;
|
||||
status_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::milvus::grpc::Status* TableSchema::mutable_status() {
|
||||
|
||||
if (status_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::Status>(GetArenaNoVirtual());
|
||||
status_ = p;
|
||||
}
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableSchema.status)
|
||||
return status_;
|
||||
}
|
||||
inline void TableSchema::set_allocated_status(::milvus::grpc::Status* status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
|
||||
if (message_arena == nullptr) {
|
||||
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(status_);
|
||||
}
|
||||
if (status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
|
||||
if (message_arena != submessage_arena) {
|
||||
status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, status, submessage_arena);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
status_ = status;
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.TableSchema.status)
|
||||
}
|
||||
|
||||
// string table_name = 2;
|
||||
inline void TableSchema::clear_table_name() {
|
||||
table_name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const std::string& TableSchema::table_name() const {
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.TableSchema.table_name)
|
||||
return table_name_.GetNoArena();
|
||||
}
|
||||
inline void TableSchema::set_table_name(const std::string& value) {
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TableSchema.table_name)
|
||||
}
|
||||
inline void TableSchema::set_table_name(std::string&& value) {
|
||||
|
||||
table_name_.SetNoArena(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:milvus.grpc.TableSchema.table_name)
|
||||
}
|
||||
inline void TableSchema::set_table_name(const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:milvus.grpc.TableSchema.table_name)
|
||||
}
|
||||
inline void TableSchema::set_table_name(const char* value, size_t size) {
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:milvus.grpc.TableSchema.table_name)
|
||||
}
|
||||
inline std::string* TableSchema::mutable_table_name() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.TableSchema.table_name)
|
||||
return table_name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline std::string* TableSchema::release_table_name() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.TableSchema.table_name)
|
||||
|
||||
return table_name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void TableSchema::set_allocated_table_name(std::string* table_name) {
|
||||
if (table_name != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
table_name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), table_name);
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.TableSchema.table_name)
|
||||
}
|
||||
|
||||
// int64 dimension = 2;
|
||||
// int64 dimension = 3;
|
||||
inline void TableSchema::clear_dimension() {
|
||||
dimension_ = PROTOBUF_LONGLONG(0);
|
||||
}
|
||||
@ -2961,7 +3248,7 @@ inline void TableSchema::set_dimension(::PROTOBUF_NAMESPACE_ID::int64 value) {
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TableSchema.dimension)
|
||||
}
|
||||
|
||||
// int64 index_file_size = 3;
|
||||
// int64 index_file_size = 4;
|
||||
inline void TableSchema::clear_index_file_size() {
|
||||
index_file_size_ = PROTOBUF_LONGLONG(0);
|
||||
}
|
||||
@ -2975,7 +3262,7 @@ inline void TableSchema::set_index_file_size(::PROTOBUF_NAMESPACE_ID::int64 valu
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.TableSchema.index_file_size)
|
||||
}
|
||||
|
||||
// int32 metric_type = 4;
|
||||
// int32 metric_type = 5;
|
||||
inline void TableSchema::clear_metric_type() {
|
||||
metric_type_ = 0;
|
||||
}
|
||||
@ -4048,58 +4335,103 @@ inline void Index::set_nlist(::PROTOBUF_NAMESPACE_ID::int32 value) {
|
||||
|
||||
// IndexParam
|
||||
|
||||
// .milvus.grpc.TableName table_name = 1;
|
||||
inline bool IndexParam::has_table_name() const {
|
||||
return this != internal_default_instance() && table_name_ != nullptr;
|
||||
// .milvus.grpc.Status status = 1;
|
||||
inline bool IndexParam::has_status() const {
|
||||
return this != internal_default_instance() && status_ != nullptr;
|
||||
}
|
||||
inline void IndexParam::clear_table_name() {
|
||||
if (GetArenaNoVirtual() == nullptr && table_name_ != nullptr) {
|
||||
delete table_name_;
|
||||
}
|
||||
table_name_ = nullptr;
|
||||
inline const ::milvus::grpc::Status& IndexParam::status() const {
|
||||
const ::milvus::grpc::Status* p = status_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.IndexParam.status)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::Status*>(
|
||||
&::milvus::grpc::_Status_default_instance_);
|
||||
}
|
||||
inline const ::milvus::grpc::TableName& IndexParam::table_name() const {
|
||||
const ::milvus::grpc::TableName* p = table_name_;
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.IndexParam.table_name)
|
||||
return p != nullptr ? *p : *reinterpret_cast<const ::milvus::grpc::TableName*>(
|
||||
&::milvus::grpc::_TableName_default_instance_);
|
||||
}
|
||||
inline ::milvus::grpc::TableName* IndexParam::release_table_name() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.IndexParam.table_name)
|
||||
inline ::milvus::grpc::Status* IndexParam::release_status() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.IndexParam.status)
|
||||
|
||||
::milvus::grpc::TableName* temp = table_name_;
|
||||
table_name_ = nullptr;
|
||||
::milvus::grpc::Status* temp = status_;
|
||||
status_ = nullptr;
|
||||
return temp;
|
||||
}
|
||||
inline ::milvus::grpc::TableName* IndexParam::mutable_table_name() {
|
||||
inline ::milvus::grpc::Status* IndexParam::mutable_status() {
|
||||
|
||||
if (table_name_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::TableName>(GetArenaNoVirtual());
|
||||
table_name_ = p;
|
||||
if (status_ == nullptr) {
|
||||
auto* p = CreateMaybeMessage<::milvus::grpc::Status>(GetArenaNoVirtual());
|
||||
status_ = p;
|
||||
}
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.IndexParam.table_name)
|
||||
return table_name_;
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.IndexParam.status)
|
||||
return status_;
|
||||
}
|
||||
inline void IndexParam::set_allocated_table_name(::milvus::grpc::TableName* table_name) {
|
||||
inline void IndexParam::set_allocated_status(::milvus::grpc::Status* status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
|
||||
if (message_arena == nullptr) {
|
||||
delete table_name_;
|
||||
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(status_);
|
||||
}
|
||||
if (table_name) {
|
||||
if (status) {
|
||||
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
|
||||
if (message_arena != submessage_arena) {
|
||||
table_name = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, table_name, submessage_arena);
|
||||
status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
|
||||
message_arena, status, submessage_arena);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
table_name_ = table_name;
|
||||
status_ = status;
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.IndexParam.status)
|
||||
}
|
||||
|
||||
// string table_name = 2;
|
||||
inline void IndexParam::clear_table_name() {
|
||||
table_name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline const std::string& IndexParam::table_name() const {
|
||||
// @@protoc_insertion_point(field_get:milvus.grpc.IndexParam.table_name)
|
||||
return table_name_.GetNoArena();
|
||||
}
|
||||
inline void IndexParam::set_table_name(const std::string& value) {
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
|
||||
// @@protoc_insertion_point(field_set:milvus.grpc.IndexParam.table_name)
|
||||
}
|
||||
inline void IndexParam::set_table_name(std::string&& value) {
|
||||
|
||||
table_name_.SetNoArena(
|
||||
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
|
||||
// @@protoc_insertion_point(field_set_rvalue:milvus.grpc.IndexParam.table_name)
|
||||
}
|
||||
inline void IndexParam::set_table_name(const char* value) {
|
||||
GOOGLE_DCHECK(value != nullptr);
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
|
||||
// @@protoc_insertion_point(field_set_char:milvus.grpc.IndexParam.table_name)
|
||||
}
|
||||
inline void IndexParam::set_table_name(const char* value, size_t size) {
|
||||
|
||||
table_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
|
||||
::std::string(reinterpret_cast<const char*>(value), size));
|
||||
// @@protoc_insertion_point(field_set_pointer:milvus.grpc.IndexParam.table_name)
|
||||
}
|
||||
inline std::string* IndexParam::mutable_table_name() {
|
||||
|
||||
// @@protoc_insertion_point(field_mutable:milvus.grpc.IndexParam.table_name)
|
||||
return table_name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline std::string* IndexParam::release_table_name() {
|
||||
// @@protoc_insertion_point(field_release:milvus.grpc.IndexParam.table_name)
|
||||
|
||||
return table_name_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
|
||||
}
|
||||
inline void IndexParam::set_allocated_table_name(std::string* table_name) {
|
||||
if (table_name != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
table_name_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), table_name);
|
||||
// @@protoc_insertion_point(field_set_allocated:milvus.grpc.IndexParam.table_name)
|
||||
}
|
||||
|
||||
// .milvus.grpc.Index index = 2;
|
||||
// .milvus.grpc.Index index = 3;
|
||||
inline bool IndexParam::has_index() const {
|
||||
return this != internal_default_instance() && index_ != nullptr;
|
||||
}
|
||||
@ -4293,6 +4625,8 @@ inline void DeleteByRangeParam::set_allocated_table_name(std::string* table_name
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
|
||||
@ -8,18 +8,26 @@ package milvus.grpc;
|
||||
* @brief Table Name
|
||||
*/
|
||||
message TableName {
|
||||
string table_name = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Table Name List
|
||||
*/
|
||||
message TableNameList {
|
||||
Status status = 1;
|
||||
string table_name = 2;
|
||||
repeated string table_names = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Table Schema
|
||||
*/
|
||||
message TableSchema {
|
||||
TableName table_name = 1;
|
||||
int64 dimension = 2;
|
||||
int64 index_file_size = 3;
|
||||
int32 metric_type = 4;
|
||||
Status status = 1;
|
||||
string table_name = 2;
|
||||
int64 dimension = 3;
|
||||
int64 index_file_size = 4;
|
||||
int32 metric_type = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,8 +149,9 @@ message Index {
|
||||
* @brief Index params
|
||||
*/
|
||||
message IndexParam {
|
||||
TableName table_name = 1;
|
||||
Index index = 2;
|
||||
Status status = 1;
|
||||
string table_name = 2;
|
||||
Index index = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,7 +273,7 @@ service MilvusService {
|
||||
*
|
||||
* @return table names.
|
||||
*/
|
||||
rpc ShowTables(Command) returns (stream TableName) {}
|
||||
rpc ShowTables(Command) returns (TableNameList) {}
|
||||
|
||||
/**
|
||||
* @brief Give the server status
|
||||
|
||||
@ -110,7 +110,7 @@ main(int argc, char *argv[]) {
|
||||
signal(SIGUSR2, server::SignalUtil::HandleSignal);
|
||||
signal(SIGTERM, server::SignalUtil::HandleSignal);
|
||||
|
||||
server::Server &server = server::Server::Instance();
|
||||
server::Server &server = server::Server::GetInstance();
|
||||
server.Init(start_daemonized, pid_filename, config_filename, log_config_file);
|
||||
server.Start();
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils/Error.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "SystemInfo.h"
|
||||
|
||||
namespace zilliz {
|
||||
@ -83,11 +82,6 @@ class MetricsBase{
|
||||
virtual void CPUTemperature() {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
|
||||
#include "Metrics.h"
|
||||
#include "server/Config.h"
|
||||
#include "PrometheusMetrics.h"
|
||||
|
||||
|
||||
@ -31,8 +32,10 @@ Metrics::GetInstance() {
|
||||
|
||||
MetricsBase &
|
||||
Metrics::CreateMetricsCollector() {
|
||||
ConfigNode &config = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC);
|
||||
std::string collector_type_str = config.GetValue(CONFIG_METRIC_COLLECTOR);
|
||||
Config &config = Config::GetInstance();
|
||||
std::string collector_type_str;
|
||||
|
||||
config.GetMetricConfigCollector(collector_type_str);
|
||||
|
||||
if (collector_type_str == "prometheus") {
|
||||
return PrometheusMetrics::GetInstance();
|
||||
|
||||
@ -16,8 +16,9 @@
|
||||
// under the License.
|
||||
|
||||
|
||||
#include <cache/GpuCacheMgr.h>
|
||||
#include "cache/GpuCacheMgr.h"
|
||||
#include "PrometheusMetrics.h"
|
||||
#include "server/Config.h"
|
||||
#include "utils/Log.h"
|
||||
#include "SystemInfo.h"
|
||||
|
||||
@ -26,15 +27,19 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace server {
|
||||
|
||||
ErrorCode
|
||||
ErrorCode
|
||||
PrometheusMetrics::Init() {
|
||||
try {
|
||||
ConfigNode &configNode = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC);
|
||||
startup_ = configNode.GetValue(CONFIG_METRIC_IS_STARTUP) == "on";
|
||||
if(!startup_) return SERVER_SUCCESS;
|
||||
Config &config = Config::GetInstance();
|
||||
Status s = config.GetMetricConfigAutoBootup(startup_);
|
||||
if (!s.ok()) return s.code();
|
||||
if (!startup_) return SERVER_SUCCESS;
|
||||
|
||||
// Following should be read from config file.
|
||||
const std::string bind_address = configNode.GetChild(CONFIG_PROMETHEUS).GetValue(CONFIG_METRIC_PROMETHEUS_PORT);
|
||||
const std::string uri = std::string("/metrics");
|
||||
std::string bind_address;
|
||||
s = config.GetMetricConfigPrometheusPort(bind_address);
|
||||
if (!s.ok()) return s.code();
|
||||
const std::string uri = std::string("/tmp/metrics");
|
||||
const std::size_t num_threads = 2;
|
||||
|
||||
// Init Exposer
|
||||
|
||||
@ -17,15 +17,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utils/Error.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include <prometheus/registry.h>
|
||||
#include <prometheus/exposer.h>
|
||||
#include <iostream>
|
||||
#include "server/ServerConfig.h"
|
||||
|
||||
#include "utils/Error.h"
|
||||
#include "MetricBase.h"
|
||||
|
||||
|
||||
@ -38,10 +36,6 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace server {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PrometheusMetrics: public MetricsBase {
|
||||
|
||||
public:
|
||||
@ -107,11 +101,6 @@ class PrometheusMetrics: public MetricsBase {
|
||||
void GPUTemperature() override;
|
||||
void CPUTemperature() override;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<prometheus::Exposer> &exposer_ptr() {return exposer_ptr_; }
|
||||
// prometheus::Exposer& exposer() { return exposer_;}
|
||||
std::shared_ptr<prometheus::Registry> ®istry_ptr() {return registry_; }
|
||||
@ -125,8 +114,6 @@ class PrometheusMetrics: public MetricsBase {
|
||||
// .Register(*registry_);
|
||||
// prometheus::Counter &connection_total_ = connect_request_.Add({});
|
||||
|
||||
|
||||
|
||||
////all from DBImpl.cpp
|
||||
using BucketBoundaries = std::vector<double>;
|
||||
//record add_group request
|
||||
@ -472,10 +459,8 @@ class PrometheusMetrics: public MetricsBase {
|
||||
.Name("CPU_temperature")
|
||||
.Help("CPU temperature")
|
||||
.Register(*registry_);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
constexpr uint64_t MAXINT = std::numeric_limits<uint32_t >::max();
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
uint64_t
|
||||
ShortestPath(const ResourcePtr &src,
|
||||
|
||||
48
cpp/src/scheduler/Definition.h
Normal file
48
cpp/src/scheduler/Definition.h
Normal file
@ -0,0 +1,48 @@
|
||||
// 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.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
|
||||
#include "db/meta/MetaTypes.h"
|
||||
#include "db/engine/EngineFactory.h"
|
||||
#include "db/engine/ExecutionEngine.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace scheduler {
|
||||
|
||||
using TableFileSchemaPtr = engine::meta::TableFileSchemaPtr;
|
||||
using TableFileSchema = engine::meta::TableFileSchema;
|
||||
|
||||
using ExecutionEnginePtr = engine::ExecutionEnginePtr;
|
||||
using EngineFactory = engine::EngineFactory;
|
||||
using EngineType = engine::EngineType;
|
||||
using MetricType = engine::MetricType;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -36,9 +36,6 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace scheduler {
|
||||
|
||||
using engine::TaskPtr;
|
||||
using engine::ResourceMgrPtr;
|
||||
|
||||
class JobMgr {
|
||||
public:
|
||||
explicit
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::shared_ptr<Resource>
|
||||
ResourceFactory::Create(const std::string &name,
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class ResourceFactory {
|
||||
public:
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
|
||||
void
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class ResourceMgr {
|
||||
public:
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
#include "SchedInst.h"
|
||||
#include "server/ServerConfig.h"
|
||||
#include "server/Config.h"
|
||||
#include "ResourceFactory.h"
|
||||
#include "knowhere/index/vector_index/IndexGPUIVF.h"
|
||||
#include "Utils.h"
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
ResourceMgrPtr ResMgrInst::instance = nullptr;
|
||||
std::mutex ResMgrInst::mutex_;
|
||||
@ -38,13 +38,15 @@ std::mutex JobMgrInst::mutex_;
|
||||
|
||||
void
|
||||
load_simple_config() {
|
||||
server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE);
|
||||
auto mode = config.GetValue("mode", "simple");
|
||||
server::Config &config = server::Config::GetInstance();
|
||||
std::string mode;
|
||||
config.GetResourceConfigMode(mode);
|
||||
std::vector<std::string> pool;
|
||||
config.GetResourceConfigPool(pool);
|
||||
|
||||
auto resources = config.GetSequence("resources");
|
||||
bool cpu = false;
|
||||
std::set<uint64_t> gpu_ids;
|
||||
for (auto &resource : resources) {
|
||||
for (auto &resource : pool) {
|
||||
if (resource == "cpu") {
|
||||
cpu = true;
|
||||
break;
|
||||
@ -82,7 +84,7 @@ load_simple_config() {
|
||||
void
|
||||
load_advance_config() {
|
||||
// try {
|
||||
// server::ConfigNode &config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_RESOURCE);
|
||||
// server::ConfigNode &config = server::Config::GetInstance().GetConfig(server::CONFIG_RESOURCE);
|
||||
//
|
||||
// if (config.GetChildren().empty()) throw "resource_config null exception";
|
||||
//
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class ResMgrInst {
|
||||
public:
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
// under the License.
|
||||
|
||||
|
||||
#include <src/cache/GpuCacheMgr.h>
|
||||
#include "src/cache/GpuCacheMgr.h"
|
||||
#include "event/LoadCompletedEvent.h"
|
||||
#include "Scheduler.h"
|
||||
#include "action/Action.h"
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
Scheduler::Scheduler(ResourceMgrWPtr res_mgr)
|
||||
: running_(false),
|
||||
@ -33,6 +33,14 @@ Scheduler::Scheduler(ResourceMgrWPtr res_mgr)
|
||||
if (auto mgr = res_mgr_.lock()) {
|
||||
mgr->RegisterSubscriber(std::bind(&Scheduler::PostEvent, this, std::placeholders::_1));
|
||||
}
|
||||
event_register_.insert(std::make_pair(static_cast<uint64_t>(EventType::START_UP),
|
||||
std::bind(&Scheduler::OnStartUp, this, std::placeholders::_1)));
|
||||
event_register_.insert(std::make_pair(static_cast<uint64_t>(EventType::LOAD_COMPLETED),
|
||||
std::bind(&Scheduler::OnLoadCompleted, this, std::placeholders::_1)));
|
||||
event_register_.insert(std::make_pair(static_cast<uint64_t>(EventType::TASK_TABLE_UPDATED),
|
||||
std::bind(&Scheduler::OnTaskTableUpdated, this, std::placeholders::_1)));
|
||||
event_register_.insert(std::make_pair(static_cast<uint64_t>(EventType::FINISH_TASK),
|
||||
std::bind(&Scheduler::OnFinishTask, this, std::placeholders::_1)));
|
||||
}
|
||||
|
||||
|
||||
@ -84,40 +92,8 @@ Scheduler::worker_function() {
|
||||
|
||||
void
|
||||
Scheduler::Process(const EventPtr &event) {
|
||||
switch (event->Type()) {
|
||||
case EventType::START_UP: {
|
||||
OnStartUp(event);
|
||||
break;
|
||||
}
|
||||
case EventType::LOAD_COMPLETED: {
|
||||
OnLoadCompleted(event);
|
||||
break;
|
||||
}
|
||||
case EventType::FINISH_TASK: {
|
||||
OnFinishTask(event);
|
||||
break;
|
||||
}
|
||||
case EventType::TASK_TABLE_UPDATED: {
|
||||
OnTaskTableUpdated(event);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// TODO: logging
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Scheduler::OnStartUp(const EventPtr &event) {
|
||||
if (auto resource = event->resource_.lock()) {
|
||||
resource->WakeupLoader();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Scheduler::OnFinishTask(const EventPtr &event) {
|
||||
auto process_event = event_register_.at(static_cast<int>(event->Type()));
|
||||
process_event(event);
|
||||
}
|
||||
|
||||
// TODO: refactor the function
|
||||
@ -130,79 +106,11 @@ Scheduler::OnLoadCompleted(const EventPtr &event) {
|
||||
auto task_table_type = load_completed_event->task_table_item_->task->label()->Type();
|
||||
switch (task_table_type) {
|
||||
case TaskLabelType::DEFAULT: {
|
||||
if (not resource->HasExecutor() && load_completed_event->task_table_item_->Move()) {
|
||||
auto task = load_completed_event->task_table_item_->task;
|
||||
auto search_task = std::static_pointer_cast<XSearchTask>(task);
|
||||
bool moved = false;
|
||||
|
||||
// to support test task, REFACTOR
|
||||
if (auto index_engine = search_task->index_engine_) {
|
||||
auto location = index_engine->GetLocation();
|
||||
|
||||
for (auto i = 0; i < res_mgr_.lock()->GetNumGpuResource(); ++i) {
|
||||
auto index = zilliz::milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location);
|
||||
if (index != nullptr) {
|
||||
moved = true;
|
||||
auto dest_resource = res_mgr_.lock()->GetResource(ResourceType::GPU, i);
|
||||
Action::PushTaskToResource(load_completed_event->task_table_item_->task, dest_resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (not moved) {
|
||||
Action::PushTaskToNeighbourRandomly(task, resource);
|
||||
}
|
||||
}
|
||||
Action::DefaultLabelTaskScheduler(res_mgr_, resource, load_completed_event);
|
||||
break;
|
||||
}
|
||||
case TaskLabelType::SPECIFIED_RESOURCE: {
|
||||
// support next version
|
||||
// auto self = event->resource_.lock();
|
||||
// auto task = load_completed_event->task_table_item_->task;
|
||||
//
|
||||
// // if this resource is disk, assign it to smallest cost resource
|
||||
// if (self->type() == ResourceType::DISK) {
|
||||
// // step 1: calculate shortest path per resource, from disk to compute resource
|
||||
// auto compute_resources = res_mgr_.lock()->GetComputeResources();
|
||||
// std::vector<std::vector<std::string>> paths;
|
||||
// std::vector<uint64_t> transport_costs;
|
||||
// for (auto &res : compute_resources) {
|
||||
// std::vector<std::string> path;
|
||||
// uint64_t transport_cost = ShortestPath(self, res, res_mgr_.lock(), path);
|
||||
// transport_costs.push_back(transport_cost);
|
||||
// paths.emplace_back(path);
|
||||
// }
|
||||
//
|
||||
// // step 2: select min cost, cost(resource) = avg_cost * task_to_do + transport_cost
|
||||
// uint64_t min_cost = std::numeric_limits<uint64_t>::max();
|
||||
// uint64_t min_cost_idx = 0;
|
||||
// for (uint64_t i = 0; i < compute_resources.size(); ++i) {
|
||||
// if (compute_resources[i]->TotalTasks() == 0) {
|
||||
// min_cost_idx = i;
|
||||
// break;
|
||||
// }
|
||||
// uint64_t cost = compute_resources[i]->TaskAvgCost() * compute_resources[i]->NumOfTaskToExec()
|
||||
// + transport_costs[i];
|
||||
// if (min_cost > cost) {
|
||||
// min_cost = cost;
|
||||
// min_cost_idx = i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // step 3: set path in task
|
||||
// Path task_path(paths[min_cost_idx], paths[min_cost_idx].size() - 1);
|
||||
// task->path() = task_path;
|
||||
// }
|
||||
//
|
||||
// if (self->name() == task->path().Last()) {
|
||||
// self->WakeupLoader();
|
||||
// } else {
|
||||
// auto next_res_name = task->path().Next();
|
||||
// auto next_res = res_mgr_.lock()->GetResource(next_res_name);
|
||||
// load_completed_event->task_table_item_->Move();
|
||||
// next_res->task_table().Put(task);
|
||||
// }
|
||||
Action::SpecifiedResourceLabelTaskScheduler(res_mgr_, resource, load_completed_event);
|
||||
break;
|
||||
}
|
||||
case TaskLabelType::BROADCAST: {
|
||||
@ -216,6 +124,17 @@ Scheduler::OnLoadCompleted(const EventPtr &event) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Scheduler::OnStartUp(const EventPtr &event) {
|
||||
if (auto resource = event->resource_.lock()) {
|
||||
resource->WakeupLoader();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Scheduler::OnFinishTask(const EventPtr &event) {
|
||||
}
|
||||
|
||||
void
|
||||
Scheduler::OnTaskTableUpdated(const EventPtr &event) {
|
||||
if (auto resource = event->resource_.lock()) {
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
|
||||
// TODO: refactor, not friendly to unittest, logical in framework code
|
||||
@ -122,6 +122,8 @@ private:
|
||||
private:
|
||||
bool running_;
|
||||
|
||||
std::unordered_map<uint64_t, std::function<void(EventPtr)>> event_register_;
|
||||
|
||||
ResourceMgrWPtr res_mgr_;
|
||||
std::queue<EventPtr> event_queue_;
|
||||
std::thread worker_thread_;
|
||||
|
||||
@ -45,7 +45,7 @@ TaskCreator::Create(const SearchJobPtr &job) {
|
||||
std::vector<TaskPtr> tasks;
|
||||
for (auto &index_file : job->index_files()) {
|
||||
auto task = std::make_shared<XSearchTask>(index_file.second);
|
||||
task->label() = std::make_shared<engine::DefaultLabel>();
|
||||
task->label() = std::make_shared<DefaultLabel>();
|
||||
task->job_ = job;
|
||||
tasks.emplace_back(task);
|
||||
}
|
||||
@ -57,7 +57,7 @@ std::vector<TaskPtr>
|
||||
TaskCreator::Create(const DeleteJobPtr &job) {
|
||||
std::vector<TaskPtr> tasks;
|
||||
auto task = std::make_shared<XDeleteTask>(job);
|
||||
task->label() = std::make_shared<engine::BroadcastLabel>();
|
||||
task->label() = std::make_shared<BroadcastLabel>();
|
||||
task->job_ = job;
|
||||
tasks.emplace_back(task);
|
||||
|
||||
|
||||
@ -39,10 +39,6 @@ namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace scheduler {
|
||||
|
||||
using engine::TaskPtr;
|
||||
using engine::XSearchTask;
|
||||
using engine::XDeleteTask;
|
||||
|
||||
class TaskCreator {
|
||||
public:
|
||||
static std::vector<TaskPtr>
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::string
|
||||
ToString(TaskTableItemState state) {
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
enum class TaskTableItemState {
|
||||
INVALID,
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
uint64_t
|
||||
get_current_timestamp() {
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
uint64_t
|
||||
get_current_timestamp();
|
||||
|
||||
@ -18,11 +18,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "../resource/Resource.h"
|
||||
#include "../ResourceMgr.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class Action {
|
||||
public:
|
||||
@ -34,6 +35,15 @@ public:
|
||||
|
||||
static void
|
||||
PushTaskToResource(const TaskPtr &task, const ResourcePtr &dest);
|
||||
|
||||
static void
|
||||
DefaultLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr resource, std::shared_ptr<LoadCompletedEvent> event);
|
||||
|
||||
static void
|
||||
SpecifiedResourceLabelTaskScheduler(ResourceMgrWPtr res_mgr,
|
||||
ResourcePtr resource,
|
||||
std::shared_ptr<LoadCompletedEvent> event);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -18,12 +18,14 @@
|
||||
|
||||
#include <list>
|
||||
#include <random>
|
||||
#include "../Algorithm.h"
|
||||
#include "src/cache/GpuCacheMgr.h"
|
||||
#include "Action.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::vector<ResourcePtr>
|
||||
get_neighbours(const ResourcePtr &self) {
|
||||
@ -101,6 +103,84 @@ Action::PushTaskToResource(const TaskPtr& task, const ResourcePtr& dest) {
|
||||
dest->task_table().Put(task);
|
||||
}
|
||||
|
||||
void
|
||||
Action::DefaultLabelTaskScheduler(ResourceMgrWPtr res_mgr,
|
||||
ResourcePtr resource,
|
||||
std::shared_ptr<LoadCompletedEvent> event) {
|
||||
if (not resource->HasExecutor() && event->task_table_item_->Move()) {
|
||||
auto task = event->task_table_item_->task;
|
||||
auto search_task = std::static_pointer_cast<XSearchTask>(task);
|
||||
bool moved = false;
|
||||
|
||||
//to support test task, REFACTOR
|
||||
if (auto index_engine = search_task->index_engine_) {
|
||||
auto location = index_engine->GetLocation();
|
||||
|
||||
for (auto i = 0; i < res_mgr.lock()->GetNumGpuResource(); ++i) {
|
||||
auto index = zilliz::milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location);
|
||||
if (index != nullptr) {
|
||||
moved = true;
|
||||
auto dest_resource = res_mgr.lock()->GetResource(ResourceType::GPU, i);
|
||||
PushTaskToResource(event->task_table_item_->task, dest_resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (not moved) {
|
||||
PushTaskToNeighbourRandomly(task, resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Action::SpecifiedResourceLabelTaskScheduler(ResourceMgrWPtr res_mgr,
|
||||
ResourcePtr resource,
|
||||
std::shared_ptr<LoadCompletedEvent> event) {
|
||||
auto task = event->task_table_item_->task;
|
||||
if (resource->type() == ResourceType::DISK) {
|
||||
// step 1: calculate shortest path per resource, from disk to compute resource
|
||||
auto compute_resources = res_mgr.lock()->GetComputeResources();
|
||||
std::vector<std::vector<std::string>> paths;
|
||||
std::vector<uint64_t> transport_costs;
|
||||
for (auto &res : compute_resources) {
|
||||
std::vector<std::string> path;
|
||||
uint64_t transport_cost = ShortestPath(resource, res, res_mgr.lock(), path);
|
||||
transport_costs.push_back(transport_cost);
|
||||
paths.emplace_back(path);
|
||||
}
|
||||
|
||||
// step 2: select min cost, cost(resource) = avg_cost * task_to_do + transport_cost
|
||||
uint64_t min_cost = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t min_cost_idx = 0;
|
||||
for (uint64_t i = 0; i < compute_resources.size(); ++i) {
|
||||
if (compute_resources[i]->TotalTasks() == 0) {
|
||||
min_cost_idx = i;
|
||||
break;
|
||||
}
|
||||
uint64_t cost = compute_resources[i]->TaskAvgCost() * compute_resources[i]->NumOfTaskToExec()
|
||||
+ transport_costs[i];
|
||||
if (min_cost > cost) {
|
||||
min_cost = cost;
|
||||
min_cost_idx = i;
|
||||
}
|
||||
}
|
||||
|
||||
// step 3: set path in task
|
||||
Path task_path(paths[min_cost_idx], paths[min_cost_idx].size() - 1);
|
||||
task->path() = task_path;
|
||||
}
|
||||
|
||||
if (resource->name() == task->path().Last()) {
|
||||
resource->WakeupLoader();
|
||||
} else {
|
||||
auto next_res_name = task->path().Next();
|
||||
auto next_res = res_mgr.lock()->GetResource(next_res_name);
|
||||
event->task_table_item_->Move();
|
||||
next_res->task_table().Put(task);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
enum class EventType {
|
||||
START_UP,
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Event &event) {
|
||||
out << event.Dump();
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class FinishTaskEvent : public Event {
|
||||
public:
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class LoadCompletedEvent : public Event {
|
||||
public:
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class StartUpEvent : public Event {
|
||||
public:
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class TaskTableUpdatedEvent : public Event {
|
||||
public:
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class Connection {
|
||||
public:
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const CpuResource &resource) {
|
||||
out << resource.Dump();
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class CpuResource : public Resource {
|
||||
public:
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const DiskResource &resource) {
|
||||
out << resource.Dump();
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class DiskResource : public Resource {
|
||||
public:
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const GpuResource &resource) {
|
||||
out << resource.Dump();
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class GpuResource : public Resource {
|
||||
public:
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
Node::Node() {
|
||||
static std::atomic_uint_fast8_t counter(0);
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class Node;
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &
|
||||
operator<<(std::ostream &out, const Resource &resource) {
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
// TODO(wxyu): Storage, Route, Executor
|
||||
enum class ResourceType {
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const TestResource &resource) {
|
||||
out << resource.Dump();
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class TestResource : public Resource {
|
||||
public:
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
XDeleteTask::XDeleteTask(const scheduler::DeleteJobPtr &delete_job)
|
||||
: Task(TaskType::DeleteTask), delete_job_(delete_job) {}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class XDeleteTask : public Task {
|
||||
public:
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class Path {
|
||||
public:
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
static constexpr size_t PARALLEL_REDUCE_THRESHOLD = 10000;
|
||||
static constexpr size_t PARALLEL_REDUCE_BATCH = 1000;
|
||||
@ -79,8 +79,8 @@ std::mutex XSearchTask::merge_mutex_;
|
||||
void
|
||||
CollectFileMetrics(int file_type, size_t file_size) {
|
||||
switch (file_type) {
|
||||
case meta::TableFileSchema::RAW:
|
||||
case meta::TableFileSchema::TO_INDEX: {
|
||||
case TableFileSchema::RAW:
|
||||
case TableFileSchema::TO_INDEX: {
|
||||
server::Metrics::GetInstance().RawFileSizeHistogramObserve(file_size);
|
||||
server::Metrics::GetInstance().RawFileSizeTotalIncrement(file_size);
|
||||
server::Metrics::GetInstance().RawFileSizeGaugeSet(file_size);
|
||||
@ -95,7 +95,7 @@ CollectFileMetrics(int file_type, size_t file_size) {
|
||||
}
|
||||
}
|
||||
|
||||
XSearchTask::XSearchTask(meta::TableFileSchemaPtr file)
|
||||
XSearchTask::XSearchTask(TableFileSchemaPtr file)
|
||||
: Task(TaskType::SearchTask), file_(file) {
|
||||
if (file_) {
|
||||
index_engine_ = EngineFactory::Build(file_->dimension_,
|
||||
|
||||
@ -18,19 +18,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "Task.h"
|
||||
#include "db/meta/MetaTypes.h"
|
||||
#include "scheduler/job/SearchJob.h"
|
||||
#include "scheduler/Definition.h"
|
||||
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
// TODO: rewrite
|
||||
class XSearchTask : public Task {
|
||||
public:
|
||||
explicit
|
||||
XSearchTask(meta::TableFileSchemaPtr file);
|
||||
XSearchTask(TableFileSchemaPtr file);
|
||||
|
||||
void
|
||||
Load(LoadType type, uint8_t device_id) override;
|
||||
@ -56,7 +56,7 @@ public:
|
||||
scheduler::ResultSet &result_target);
|
||||
|
||||
public:
|
||||
meta::TableFileSchemaPtr file_;
|
||||
TableFileSchemaPtr file_;
|
||||
|
||||
size_t index_id_ = 0;
|
||||
int index_type_ = 0;
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
enum class LoadType {
|
||||
DISK2CPU,
|
||||
|
||||
@ -22,10 +22,9 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
|
||||
TestTask::TestTask(meta::TableFileSchemaPtr &file) : XSearchTask(file) {}
|
||||
TestTask::TestTask(TableFileSchemaPtr &file) : XSearchTask(file) {}
|
||||
|
||||
void
|
||||
TestTask::Load(LoadType type, uint8_t device_id) {
|
||||
|
||||
@ -22,12 +22,12 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
class TestTask : public XSearchTask {
|
||||
public:
|
||||
explicit
|
||||
TestTask(meta::TableFileSchemaPtr& file);
|
||||
TestTask(TableFileSchemaPtr& file);
|
||||
|
||||
public:
|
||||
void
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
namespace zilliz {
|
||||
namespace milvus {
|
||||
namespace engine {
|
||||
namespace scheduler {
|
||||
|
||||
|
||||
class BroadcastLabel : public TaskLabel {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user