Merge remote-tracking branch 'upstream/0.6.0' into 0.6.0-yk-refactor-scheduler

pull/608/head
fishpenguin 2019-11-29 11:38:40 +08:00
commit 1b6d90a5e1
8 changed files with 78 additions and 4 deletions

View File

@ -21,6 +21,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#440 - Server cannot startup with gpu_resource_config.enable=false in GPU version - \#440 - Server cannot startup with gpu_resource_config.enable=false in GPU version
- \#458 - Index data is not compatible between 0.5 and 0.6 - \#458 - Index data is not compatible between 0.5 and 0.6
- \#465 - Server hang caused by searching with nsg index - \#465 - Server hang caused by searching with nsg index
- \#485 - Increase code coverage rate
- \#486 - gpu no usage during index building - \#486 - gpu no usage during index building
- \#497 - CPU-version search performance decreased - \#497 - CPU-version search performance decreased
- \#504 - The code coverage rate of core/src/scheduler/optimizer is too low - \#504 - The code coverage rate of core/src/scheduler/optimizer is too low
@ -49,6 +50,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#420 - Update shards merge part to match v0.5.3 - \#420 - Update shards merge part to match v0.5.3
- \#488 - Add log in scheduler/optimizer - \#488 - Add log in scheduler/optimizer
- \#502 - C++ SDK support IVFPQ and SPTAG - \#502 - C++ SDK support IVFPQ and SPTAG
- \#560 - Add version in server config file
## Improvement ## Improvement
- \#255 - Add ivfsq8 test report detailed version - \#255 - Add ivfsq8 test report detailed version

View File

@ -1,5 +1,7 @@
# Default values are used when you make no changes to the following parameters. # Default values are used when you make no changes to the following parameters.
version: 0.1 # config version
server_config: server_config:
address: 0.0.0.0 # milvus server ip address (IPv4) address: 0.0.0.0 # milvus server ip address (IPv4)
port: 19530 # milvus server port, must in range [1025, 65534] port: 19530 # milvus server port, must in range [1025, 65534]

View File

@ -1,5 +1,7 @@
# Default values are used when you make no changes to the following parameters. # Default values are used when you make no changes to the following parameters.
version: 0.1 # config version
server_config: server_config:
address: 0.0.0.0 # milvus server ip address (IPv4) address: 0.0.0.0 # milvus server ip address (IPv4)
port: 19530 # milvus server port, must in range [1025, 65534] port: 19530 # milvus server port, must in range [1025, 65534]

View File

@ -112,10 +112,12 @@ ExecutionEngineImpl::CreatetVecIndex(EngineType type) {
index = GetVecIndexFactory(IndexType::NSG_MIX); index = GetVecIndexFactory(IndexType::NSG_MIX);
break; break;
} }
#ifdef CUSTOMIZATION
case EngineType::FAISS_IVFSQ8H: { case EngineType::FAISS_IVFSQ8H: {
index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_HYBRID); index = GetVecIndexFactory(IndexType::FAISS_IVFSQ8_HYBRID);
break; break;
} }
#endif
case EngineType::FAISS_PQ: { case EngineType::FAISS_PQ: {
#ifdef MILVUS_CPU_VERSION #ifdef MILVUS_CPU_VERSION
index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_CPU); index = GetVecIndexFactory(IndexType::FAISS_IVFPQ_CPU);

View File

@ -20,6 +20,7 @@
#include <iostream> #include <iostream>
#include <regex> #include <regex>
#include <string> #include <string>
#include <unordered_map>
#include <vector> #include <vector>
#include "config/YamlConfigMgr.h" #include "config/YamlConfigMgr.h"
@ -33,6 +34,8 @@ namespace server {
constexpr uint64_t GB = 1UL << 30; constexpr uint64_t GB = 1UL << 30;
static const std::unordered_map<std::string, std::string> milvus_config_version_map({{"0.6.0", "0.1"}});
Config& Config&
Config::GetInstance() { Config::GetInstance() {
static Config config_inst; static Config config_inst;
@ -69,6 +72,12 @@ Status
Config::ValidateConfig() { Config::ValidateConfig() {
Status s; Status s;
std::string config_version;
s = GetConfigVersion(config_version);
if (!s.ok()) {
return s;
}
/* server config */ /* server config */
std::string server_addr; std::string server_addr;
s = GetServerConfigAddress(server_addr); s = GetServerConfigAddress(server_addr);
@ -383,6 +392,16 @@ Config::PrintAll() {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Status
Config::CheckConfigVersion(const std::string& value) {
if (milvus_config_version_map.at(MILVUS_VERSION) != value) {
std::string msg = "Invalid config version: " + value +
". Expected config version: " + milvus_config_version_map.at(MILVUS_VERSION);
return Status(SERVER_INVALID_ARGUMENT, msg);
}
return Status::OK();
}
Status Status
Config::CheckServerConfigAddress(const std::string& value) { Config::CheckServerConfigAddress(const std::string& value) {
if (!ValidationUtil::ValidateIpAddress(value).ok()) { if (!ValidationUtil::ValidateIpAddress(value).ok()) {
@ -766,10 +785,14 @@ Config::CheckGpuResourceConfigBuildIndexResources(const std::vector<std::string>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ConfigNode& ConfigNode&
Config::GetConfigNode(const std::string& name) { Config::GetConfigRoot() {
ConfigMgr* mgr = YamlConfigMgr::GetInstance(); ConfigMgr* mgr = YamlConfigMgr::GetInstance();
ConfigNode& root_node = mgr->GetRootNode(); return mgr->GetRootNode();
return root_node.GetChild(name); }
ConfigNode&
Config::GetConfigNode(const std::string& name) {
return GetConfigRoot().GetChild(name);
} }
Status Status
@ -816,6 +839,12 @@ Config::GetConfigSequenceStr(const std::string& parent_key, const std::string& c
return value; return value;
} }
Status
Config::GetConfigVersion(std::string& value) {
value = GetConfigRoot().GetValue(CONFIG_VERSION);
return CheckConfigVersion(value);
}
Status Status
Config::GetServerConfigAddress(std::string& value) { Config::GetServerConfigAddress(std::string& value) {
value = GetConfigStr(CONFIG_SERVER, CONFIG_SERVER_ADDRESS, CONFIG_SERVER_ADDRESS_DEFAULT); value = GetConfigStr(CONFIG_SERVER, CONFIG_SERVER_ADDRESS, CONFIG_SERVER_ADDRESS_DEFAULT);

View File

@ -28,6 +28,8 @@
namespace milvus { namespace milvus {
namespace server { namespace server {
static const char* CONFIG_VERSION = "version";
/* server config */ /* server config */
static const char* CONFIG_SERVER = "server_config"; static const char* CONFIG_SERVER = "server_config";
static const char* CONFIG_SERVER_ADDRESS = "address"; static const char* CONFIG_SERVER_ADDRESS = "address";
@ -115,6 +117,8 @@ class Config {
PrintAll(); PrintAll();
private: private:
ConfigNode&
GetConfigRoot();
ConfigNode& ConfigNode&
GetConfigNode(const std::string& name); GetConfigNode(const std::string& name);
Status Status
@ -125,6 +129,9 @@ class Config {
PrintConfigSection(const std::string& config_node_name); PrintConfigSection(const std::string& config_node_name);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
Status
CheckConfigVersion(const std::string& value);
/* server config */ /* server config */
Status Status
CheckServerConfigAddress(const std::string& value); CheckServerConfigAddress(const std::string& value);
@ -193,6 +200,8 @@ class Config {
std::string std::string
GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim = ",", GetConfigSequenceStr(const std::string& parent_key, const std::string& child_key, const std::string& delim = ",",
const std::string& default_value = ""); const std::string& default_value = "");
Status
GetConfigVersion(std::string& value);
public: public:
/* server config */ /* server config */

View File

@ -59,6 +59,29 @@ TEST_F(EngineTest, FACTORY_TEST) {
ASSERT_TRUE(engine_ptr != nullptr); ASSERT_TRUE(engine_ptr != nullptr);
} }
{
auto engine_ptr = milvus::engine::EngineFactory::Build(
512, "/tmp/milvus_index_1", milvus::engine::EngineType::FAISS_PQ, milvus::engine::MetricType::IP, 1024);
ASSERT_TRUE(engine_ptr != nullptr);
}
{
auto engine_ptr = milvus::engine::EngineFactory::Build(
512, "/tmp/milvus_index_1", milvus::engine::EngineType::SPTAG_KDT,
milvus::engine::MetricType::L2, 1024);
ASSERT_TRUE(engine_ptr != nullptr);
}
{
auto engine_ptr = milvus::engine::EngineFactory::Build(
512, "/tmp/milvus_index_1", milvus::engine::EngineType::SPTAG_KDT,
milvus::engine::MetricType::L2, 1024);
ASSERT_TRUE(engine_ptr != nullptr);
}
} }
TEST_F(EngineTest, ENGINE_IMPL_TEST) { TEST_F(EngineTest, ENGINE_IMPL_TEST) {
@ -69,7 +92,7 @@ TEST_F(EngineTest, ENGINE_IMPL_TEST) {
std::vector<float> data; std::vector<float> data;
std::vector<int64_t> ids; std::vector<int64_t> ids;
const int row_count = 10000; const int row_count = 500;
data.reserve(row_count * dimension); data.reserve(row_count * dimension);
ids.reserve(row_count); ids.reserve(row_count);
for (int64_t i = 0; i < row_count; i++) { for (int64_t i = 0; i < row_count; i++) {
@ -95,5 +118,8 @@ TEST_F(EngineTest, ENGINE_IMPL_TEST) {
// ASSERT_TRUE(status.ok()); // ASSERT_TRUE(status.ok());
auto engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_2", milvus::engine::EngineType::FAISS_IVFSQ8); auto engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_2", milvus::engine::EngineType::FAISS_IVFSQ8);
engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_3", milvus::engine::EngineType::FAISS_PQ);
engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_4", milvus::engine::EngineType::SPTAG_KDT);
engine_build = engine_ptr->BuildIndex("/tmp/milvus_index_5", milvus::engine::EngineType::SPTAG_BKT);
// ASSERT_TRUE(status.ok()); // ASSERT_TRUE(status.ok());
} }

View File

@ -28,6 +28,8 @@ namespace {
static const char* VALID_CONFIG_STR = static const char* VALID_CONFIG_STR =
"# Default values are used when you make no changes to the following parameters.\n" "# Default values are used when you make no changes to the following parameters.\n"
"\n" "\n"
"version: 0.1"
"\n"
"server_config:\n" "server_config:\n"
" address: 0.0.0.0 # milvus server ip address (IPv4)\n" " address: 0.0.0.0 # milvus server ip address (IPv4)\n"
" port: 19530 # port range: 1025 ~ 65534\n" " port: 19530 # port range: 1025 ~ 65534\n"