mirror of https://github.com/milvus-io/milvus.git
parent
2d9fb6b959
commit
82fe888083
|
@ -9,7 +9,7 @@ server_config:
|
||||||
log_config:
|
log_config:
|
||||||
global:
|
global:
|
||||||
format: "%datetime | %level | %logger | %msg"
|
format: "%datetime | %level | %logger | %msg"
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-global.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-global.log"
|
||||||
enabled: true
|
enabled: true
|
||||||
to_file: true
|
to_file: true
|
||||||
to_standard_output: true
|
to_standard_output: true
|
||||||
|
@ -17,22 +17,22 @@ log_config:
|
||||||
performance_tracking: false
|
performance_tracking: false
|
||||||
max_log_file_size: 2097152 # throw log files away after 2mb
|
max_log_file_size: 2097152 # throw log files away after 2mb
|
||||||
debug:
|
debug:
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-debug.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-debug.log"
|
||||||
enabled: true
|
enabled: true
|
||||||
warning:
|
warning:
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-warning.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-warning.log"
|
||||||
trace:
|
trace:
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-trace.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-trace.log"
|
||||||
verbose:
|
verbose:
|
||||||
format: "%datetime{%d/%m/%y} | %level-%vlevel | %msg"
|
format: "%datetime{%d/%m/%y} | %level-%vlevel | %msg"
|
||||||
to_file: false
|
to_file: false
|
||||||
to_standard_output: true
|
to_standard_output: true
|
||||||
error:
|
error:
|
||||||
enabled: false
|
enabled: false
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-error.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-error.log"
|
||||||
fatal:
|
fatal:
|
||||||
enabled: false
|
enabled: false
|
||||||
filename: "/tmp/logs/vecwise/vecwise_engine-%datetime{%h:%m}-fatal.log"
|
filename: "/tmp/vecwise/logs/vecwise_engine-%datetime{%h:%m}-fatal.log"
|
||||||
|
|
||||||
cache_config:
|
cache_config:
|
||||||
cache_capacity: 16 # unit: GB
|
cache_capacity: 16 # unit: GB
|
|
@ -1,6 +1,6 @@
|
||||||
* GLOBAL:
|
* GLOBAL:
|
||||||
FORMAT = "%datetime | %level | %logger | %msg"
|
FORMAT = "%datetime | %level | %logger | %msg"
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-global.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-global.log"
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
TO_FILE = true
|
TO_FILE = true
|
||||||
TO_STANDARD_OUTPUT = true
|
TO_STANDARD_OUTPUT = true
|
||||||
|
@ -8,12 +8,12 @@
|
||||||
PERFORMANCE_TRACKING = false
|
PERFORMANCE_TRACKING = false
|
||||||
MAX_LOG_FILE_SIZE = 2097152 ## Throw log files away after 2MB
|
MAX_LOG_FILE_SIZE = 2097152 ## Throw log files away after 2MB
|
||||||
* DEBUG:
|
* DEBUG:
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-debug.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-debug.log"
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
* WARNING:
|
* WARNING:
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-warning.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-warning.log"
|
||||||
* TRACE:
|
* TRACE:
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-trace.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-trace.log"
|
||||||
* VERBOSE:
|
* VERBOSE:
|
||||||
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
|
FORMAT = "%datetime{%d/%M/%y} | %level-%vlevel | %msg"
|
||||||
TO_FILE = false
|
TO_FILE = false
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
## Error logs
|
## Error logs
|
||||||
* ERROR:
|
* ERROR:
|
||||||
ENABLED = false
|
ENABLED = false
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-error.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-error.log"
|
||||||
* FATAL:
|
* FATAL:
|
||||||
ENABLED = false
|
ENABLED = false
|
||||||
FILENAME = "/tmp/logs/vecwise/vecwise_engine-%datetime{%H:%m}-fatal.log"
|
FILENAME = "/tmp/vecwise/logs/vecwise_engine-%datetime{%H:%m}-fatal.log"
|
|
@ -88,35 +88,37 @@ ServerError CommonUtil::CreateDirectory(const std::string &path) {
|
||||||
return SERVER_SUCCESS;
|
return SERVER_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveDirectory(const std::string &path) {
|
namespace {
|
||||||
DIR *pDir = NULL;
|
void RemoveDirectory(const std::string &path) {
|
||||||
struct dirent *dmsg;
|
DIR *pDir = NULL;
|
||||||
char szFileName[256];
|
struct dirent *dmsg;
|
||||||
char szFolderName[256];
|
char szFileName[256];
|
||||||
|
char szFolderName[256];
|
||||||
|
|
||||||
strcpy(szFolderName, path.c_str());
|
strcpy(szFolderName, path.c_str());
|
||||||
strcat(szFolderName, "/%s");
|
strcat(szFolderName, "/%s");
|
||||||
if ((pDir = opendir(path.c_str())) != NULL) {
|
if ((pDir = opendir(path.c_str())) != NULL) {
|
||||||
while ((dmsg = readdir(pDir)) != NULL) {
|
while ((dmsg = readdir(pDir)) != NULL) {
|
||||||
if (strcmp(dmsg->d_name, ".") != 0
|
if (strcmp(dmsg->d_name, ".") != 0
|
||||||
&& strcmp(dmsg->d_name, "..") != 0) {
|
&& strcmp(dmsg->d_name, "..") != 0) {
|
||||||
sprintf(szFileName, szFolderName, dmsg->d_name);
|
sprintf(szFileName, szFolderName, dmsg->d_name);
|
||||||
std::string tmp = szFileName;
|
std::string tmp = szFileName;
|
||||||
if (tmp.find(".") == std::string::npos) {
|
if (tmp.find(".") == std::string::npos) {
|
||||||
RemoveDirectory(szFileName);
|
RemoveDirectory(szFileName);
|
||||||
|
}
|
||||||
|
remove(szFileName);
|
||||||
}
|
}
|
||||||
remove(szFileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pDir != NULL) {
|
if (pDir != NULL) {
|
||||||
closedir(pDir);
|
closedir(pDir);
|
||||||
|
}
|
||||||
|
remove(path.c_str());
|
||||||
}
|
}
|
||||||
remove(path.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerError DeleteDirectory(const std::string &path) {
|
ServerError CommonUtil::DeleteDirectory(const std::string &path) {
|
||||||
struct stat directoryStat;
|
struct stat directoryStat;
|
||||||
int statOK = stat(path.c_str(), &directoryStat);
|
int statOK = stat(path.c_str(), &directoryStat);
|
||||||
if (statOK != 0)
|
if (statOK != 0)
|
||||||
|
@ -126,7 +128,7 @@ ServerError DeleteDirectory(const std::string &path) {
|
||||||
return SERVER_SUCCESS;
|
return SERVER_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsFileExist(const std::string &path) {
|
bool CommonUtil::IsFileExist(const std::string &path) {
|
||||||
return (access(path.c_str(), F_OK) == 0);
|
return (access(path.c_str(), F_OK) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ TEST(DBTest, DB_TEST) {
|
||||||
|
|
||||||
engine::Options opt;
|
engine::Options opt;
|
||||||
opt.meta.backend_uri = "http://127.0.0.1";
|
opt.meta.backend_uri = "http://127.0.0.1";
|
||||||
opt.meta.path = "/tmp/db_test";
|
opt.meta.path = "/tmp/vecwise_test/db_test";
|
||||||
|
|
||||||
engine::DB* db = nullptr;
|
engine::DB* db = nullptr;
|
||||||
engine::DB::Open(opt, &db);
|
engine::DB::Open(opt, &db);
|
||||||
|
|
|
@ -14,6 +14,7 @@ set(require_files
|
||||||
../../src/server/VecIdMapper.cpp
|
../../src/server/VecIdMapper.cpp
|
||||||
../../src/server/ServerConfig.cpp
|
../../src/server/ServerConfig.cpp
|
||||||
../../src/utils/CommonUtil.cpp
|
../../src/utils/CommonUtil.cpp
|
||||||
|
../../src/utils/TimeRecorder.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(server_test
|
add_executable(server_test
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
||||||
|
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
|
// Proprietary and confidential.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "utils/CommonUtil.h"
|
||||||
|
#include "utils/Error.h"
|
||||||
|
|
||||||
|
using namespace zilliz::vecwise;
|
||||||
|
|
||||||
|
|
||||||
|
TEST(CommonTest, COMMON_TEST) {
|
||||||
|
std::string path1 = "/tmp/vecwise_test/common_test_12345/";
|
||||||
|
std::string path2 = path1 + "abcdef";
|
||||||
|
server::ServerError err = server::CommonUtil::CreateDirectory(path2);
|
||||||
|
ASSERT_EQ(err, server::SERVER_SUCCESS);
|
||||||
|
|
||||||
|
ASSERT_TRUE(server::CommonUtil::IsDirectoryExit(path2));
|
||||||
|
|
||||||
|
err = server::CommonUtil::DeleteDirectory(path1);
|
||||||
|
ASSERT_EQ(err, server::SERVER_SUCCESS);
|
||||||
|
|
||||||
|
ASSERT_FALSE(server::CommonUtil::IsDirectoryExit(path1));
|
||||||
|
}
|
|
@ -6,13 +6,16 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "server/ServerConfig.h"
|
#include "server/ServerConfig.h"
|
||||||
#include "server/VecIdMapper.h"
|
#include "server/VecIdMapper.h"
|
||||||
|
#include "utils/TimeRecorder.h"
|
||||||
|
#include "utils/CommonUtil.h"
|
||||||
|
|
||||||
using namespace zilliz::vecwise;
|
using namespace zilliz::vecwise;
|
||||||
|
|
||||||
|
|
||||||
TEST(IdMapperTest, IDMAPPER_TEST) {
|
TEST(IdMapperTest, IDMAPPER_TEST) {
|
||||||
|
std::string db_path = "/tmp/vecwise_test";
|
||||||
server::ConfigNode& server_config = server::ServerConfig::GetInstance().GetConfig("server_config");
|
server::ConfigNode& server_config = server::ServerConfig::GetInstance().GetConfig("server_config");
|
||||||
server_config.SetValue("db_path", "/tmp/vecwise_test");
|
server_config.SetValue("db_path", db_path);
|
||||||
|
|
||||||
server::IVecIdMapper* mapper = server::IVecIdMapper::GetInstance();
|
server::IVecIdMapper* mapper = server::IVecIdMapper::GetInstance();
|
||||||
|
|
||||||
|
@ -40,5 +43,32 @@ TEST(IdMapperTest, IDMAPPER_TEST) {
|
||||||
|
|
||||||
err = mapper->Get(900, str_id);
|
err = mapper->Get(900, str_id);
|
||||||
ASSERT_NE(err, server::SERVER_SUCCESS);
|
ASSERT_NE(err, server::SERVER_SUCCESS);
|
||||||
|
|
||||||
|
|
||||||
|
//performance?
|
||||||
|
nid.clear();
|
||||||
|
sid.clear();
|
||||||
|
const int64_t count = 1000000;
|
||||||
|
for(int64_t i = 0; i < count; i++) {
|
||||||
|
nid.push_back(i+100000);
|
||||||
|
sid.push_back("val_" + std::to_string(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string str_info = "Insert " + std::to_string(count) + " k/v into mapper";
|
||||||
|
server::TimeRecorder rc(str_info);
|
||||||
|
err = mapper->Put(nid, sid);
|
||||||
|
ASSERT_EQ(err, server::SERVER_SUCCESS);
|
||||||
|
rc.Record("done!");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string str_info = "Get " + std::to_string(count) + " k/v from mapper";
|
||||||
|
server::TimeRecorder rc(str_info);
|
||||||
|
std::vector<std::string> res;
|
||||||
|
err = mapper->Get(nid, res);
|
||||||
|
ASSERT_EQ(res.size(), nid.size());
|
||||||
|
rc.Record("done!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue