mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
format code by clang-tidy
Former-commit-id: 437b1fff79da965b8aafce026c8be4f9d582c909
This commit is contained in:
parent
e8ae612782
commit
d1251fb0c1
@ -18,8 +18,10 @@
|
|||||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*'
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*'
|
||||||
# produce HeaderFilterRegex from cpp/build-support/lint_exclusions.txt with:
|
# 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 ')$'
|
# 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.*|)$'
|
HeaderFilterRegex: '^(.*cmake-build-debug.*|.*cmake-build-release.*|.*cmake_build.*|.*src/core/thirdparty.*|.*thirdparty.*|.*easylogging++.*|.*SqliteMetaImpl.cpp|.*src/grpc.*|.*src/core.*|.*src/wrapper.*)$'
|
||||||
AnalyzeTemporaryDtors: true
|
AnalyzeTemporaryDtors: true
|
||||||
|
ChainedConditionalReturn: 1
|
||||||
|
ChainedConditionalAssignment: 1
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
value: '1'
|
value: '1'
|
||||||
|
|||||||
16
cpp/build.sh
16
cpp/build.sh
@ -111,14 +111,14 @@ if [[ ${RUN_CPPLINT} == "ON" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "clang-format check passed!"
|
echo "clang-format check passed!"
|
||||||
#
|
|
||||||
# # clang-tidy check
|
# clang-tidy check
|
||||||
# make check-clang-tidy
|
make check-clang-tidy
|
||||||
# if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
# echo "ERROR! clang-tidy check failed"
|
echo "ERROR! clang-tidy check failed"
|
||||||
# exit 1
|
exit 1
|
||||||
# fi
|
fi
|
||||||
# echo "clang-tidy check passed!"
|
echo "clang-tidy check passed!"
|
||||||
else
|
else
|
||||||
# compile and build
|
# compile and build
|
||||||
make -j 4 || exit 1
|
make -j 4 || exit 1
|
||||||
|
|||||||
2
cpp/src/cache/CpuCacheMgr.h
vendored
2
cpp/src/cache/CpuCacheMgr.h
vendored
@ -32,7 +32,7 @@ class CpuCacheMgr : public CacheMgr<DataObjPtr> {
|
|||||||
CpuCacheMgr();
|
CpuCacheMgr();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO: use smart pointer instead
|
// TODO(myh): use smart pointer instead
|
||||||
static CpuCacheMgr*
|
static CpuCacheMgr*
|
||||||
GetInstance();
|
GetInstance();
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ DatasetPtr
|
|||||||
generate_queries(int64_t n, int64_t d, int64_t k, int64_t base) {
|
generate_queries(int64_t n, int64_t d, int64_t k, int64_t base) {
|
||||||
size_t size = sizeof(float) * n * d;
|
size_t size = sizeof(float) * n * d;
|
||||||
auto v = (float *) malloc(size);
|
auto v = (float *) malloc(size);
|
||||||
// TODO: check malloc
|
// TODO(lxj): check malloc
|
||||||
for (auto i = 0; i < n; ++i) {
|
for (auto i = 0; i < n; ++i) {
|
||||||
for (auto j = 0; j < d; ++j) {
|
for (auto j = 0; j < d; ++j) {
|
||||||
v[i * d + j] = float(base + i);
|
v[i * d + j] = float(base + i);
|
||||||
|
|||||||
@ -694,4 +694,4 @@ TEST_F(GPURESTEST, TrainAndSearch) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO(linxj): Add exception test
|
// TODO(lxj): Add exception test
|
||||||
|
|||||||
@ -85,7 +85,7 @@ void PrintResult(const DatasetPtr &result,
|
|||||||
std::cout << "dist\n" << ss_dist.str() << std::endl;
|
std::cout << "dist\n" << ss_dist.str() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(linxj): add test about count() and dimension()
|
// TODO(lxj): add test about count() and dimension()
|
||||||
TEST_F(KDTTest, kdt_basic) {
|
TEST_F(KDTTest, kdt_basic) {
|
||||||
assert(!xb.empty());
|
assert(!xb.empty());
|
||||||
|
|
||||||
|
|||||||
@ -179,13 +179,13 @@ FileMetadataSet::SaveMetadata(const std::string& p_metaFile, const std::string&
|
|||||||
|
|
||||||
ErrorCode
|
ErrorCode
|
||||||
FileMetadataSet::SaveMetadataToMemory(void **pGraphMemFile, int64_t &len) {
|
FileMetadataSet::SaveMetadataToMemory(void **pGraphMemFile, int64_t &len) {
|
||||||
// TODO: serialize file to mem?
|
// TODO(lxj): serialize file to mem?
|
||||||
return ErrorCode::Fail;
|
return ErrorCode::Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode
|
ErrorCode
|
||||||
FileMetadataSet::LoadMetadataFromMemory(void *pGraphMemFile) {
|
FileMetadataSet::LoadMetadataFromMemory(void *pGraphMemFile) {
|
||||||
// TODO: not support yet
|
// TODO(lxj): not support yet
|
||||||
return ErrorCode::Fail;
|
return ErrorCode::Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -242,7 +242,7 @@ DBImpl::GetTableRowCount(const std::string& table_id, uint64_t& row_count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
DBImpl::InsertVectors(const std::string& table_id_, uint64_t n, const float* vectors, IDNumbers& vector_ids_) {
|
DBImpl::InsertVectors(const std::string& table_id, uint64_t n, const float* vectors, IDNumbers& vector_ids) {
|
||||||
// ENGINE_LOG_DEBUG << "Insert " << n << " vectors to cache";
|
// ENGINE_LOG_DEBUG << "Insert " << n << " vectors to cache";
|
||||||
if (shutting_down_.load(std::memory_order_acquire)) {
|
if (shutting_down_.load(std::memory_order_acquire)) {
|
||||||
return Status(DB_ERROR, "Milsvus server is shutdown!");
|
return Status(DB_ERROR, "Milsvus server is shutdown!");
|
||||||
@ -250,7 +250,7 @@ DBImpl::InsertVectors(const std::string& table_id_, uint64_t n, const float* vec
|
|||||||
|
|
||||||
Status status;
|
Status status;
|
||||||
zilliz::milvus::server::CollectInsertMetrics metrics(n, status);
|
zilliz::milvus::server::CollectInsertMetrics metrics(n, status);
|
||||||
status = mem_mgr_->InsertVectors(table_id_, n, vectors, vector_ids_);
|
status = mem_mgr_->InsertVectors(table_id, n, vectors, vector_ids);
|
||||||
// std::chrono::microseconds time_span =
|
// std::chrono::microseconds time_span =
|
||||||
// std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
|
// std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
|
||||||
// double average_time = double(time_span.count()) / n;
|
// double average_time = double(time_span.count()) / n;
|
||||||
@ -295,15 +295,17 @@ DBImpl::CreateIndex(const std::string& table_id, const TableIndex& index) {
|
|||||||
// for IDMAP type, only wait all NEW file converted to RAW file
|
// for IDMAP type, only wait all NEW file converted to RAW file
|
||||||
// for other type, wait NEW/RAW/NEW_MERGE/NEW_INDEX/TO_INDEX files converted to INDEX files
|
// for other type, wait NEW/RAW/NEW_MERGE/NEW_INDEX/TO_INDEX files converted to INDEX files
|
||||||
std::vector<int> file_types;
|
std::vector<int> file_types;
|
||||||
if (index.engine_type_ == (int)EngineType::FAISS_IDMAP) {
|
if (index.engine_type_ == static_cast<int32_t>(EngineType::FAISS_IDMAP)) {
|
||||||
file_types = {
|
file_types = {
|
||||||
(int)meta::TableFileSchema::NEW, (int)meta::TableFileSchema::NEW_MERGE,
|
static_cast<int32_t>(meta::TableFileSchema::NEW), static_cast<int32_t>(meta::TableFileSchema::NEW_MERGE),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
file_types = {
|
file_types = {
|
||||||
(int)meta::TableFileSchema::RAW, (int)meta::TableFileSchema::NEW,
|
static_cast<int32_t>(meta::TableFileSchema::RAW),
|
||||||
(int)meta::TableFileSchema::NEW_MERGE, (int)meta::TableFileSchema::NEW_INDEX,
|
static_cast<int32_t>(meta::TableFileSchema::NEW),
|
||||||
(int)meta::TableFileSchema::TO_INDEX,
|
static_cast<int32_t>(meta::TableFileSchema::NEW_MERGE),
|
||||||
|
static_cast<int32_t>(meta::TableFileSchema::NEW_INDEX),
|
||||||
|
static_cast<int32_t>(meta::TableFileSchema::TO_INDEX),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -228,7 +228,7 @@ ParseMetaUri(const std::string& uri, MetaUriInfo& info) {
|
|||||||
info.port_ = pieces_match[5].str();
|
info.port_ = pieces_match[5].str();
|
||||||
info.db_name_ = pieces_match[6].str();
|
info.db_name_ = pieces_match[6].str();
|
||||||
|
|
||||||
// TODO: verify host, port...
|
// TODO(myh): verify host, port...
|
||||||
} else {
|
} else {
|
||||||
return Status(DB_INVALID_META_URI, "Invalid meta uri: " + uri);
|
return Status(DB_INVALID_META_URI, "Invalid meta uri: " + uri);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -342,8 +342,9 @@ Status
|
|||||||
ExecutionEngineImpl::Init() {
|
ExecutionEngineImpl::Init() {
|
||||||
server::Config& config = server::Config::GetInstance();
|
server::Config& config = server::Config::GetInstance();
|
||||||
Status s = config.GetDBConfigBuildIndexGPU(gpu_num_);
|
Status s = config.GetDBConfigBuildIndexGPU(gpu_num_);
|
||||||
if (!s.ok())
|
if (!s.ok()) {
|
||||||
return s;
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ MySQLConnectionPool::create() {
|
|||||||
try {
|
try {
|
||||||
// Create connection using the parameters we were passed upon
|
// Create connection using the parameters we were passed upon
|
||||||
// creation.
|
// creation.
|
||||||
mysqlpp::Connection* conn = new mysqlpp::Connection();
|
auto conn = new mysqlpp::Connection();
|
||||||
conn->set_option(new mysqlpp::ReconnectOption(true));
|
conn->set_option(new mysqlpp::ReconnectOption(true));
|
||||||
conn->connect(db_.empty() ? 0 : db_.c_str(), server_.empty() ? 0 : server_.c_str(),
|
conn->connect(db_.empty() ? 0 : db_.c_str(), server_.empty() ? 0 : server_.c_str(),
|
||||||
user_.empty() ? 0 : user_.c_str(), password_.empty() ? 0 : password_.c_str(), port_);
|
user_.empty() ? 0 : user_.c_str(), password_.empty() ? 0 : password_.c_str(), port_);
|
||||||
|
|||||||
@ -50,11 +50,11 @@ HandleException(const std::string& desc, const char* what = nullptr) {
|
|||||||
if (what == nullptr) {
|
if (what == nullptr) {
|
||||||
ENGINE_LOG_ERROR << desc;
|
ENGINE_LOG_ERROR << desc;
|
||||||
return Status(DB_META_TRANSACTION_FAILED, desc);
|
return Status(DB_META_TRANSACTION_FAILED, desc);
|
||||||
} else {
|
|
||||||
std::string msg = desc + ":" + what;
|
|
||||||
ENGINE_LOG_ERROR << msg;
|
|
||||||
return Status(DB_META_TRANSACTION_FAILED, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string msg = desc + ":" + what;
|
||||||
|
ENGINE_LOG_ERROR << msg;
|
||||||
|
return Status(DB_META_TRANSACTION_FAILED, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MetaField {
|
class MetaField {
|
||||||
@ -324,7 +324,7 @@ MySQLMetaImpl::Initialize() {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PXU TODO: Temp solution. Will fix later
|
// TODO(myh): Delete single vecotor by id
|
||||||
Status
|
Status
|
||||||
MySQLMetaImpl::DropPartitionsByDates(const std::string& table_id, const DatesT& dates) {
|
MySQLMetaImpl::DropPartitionsByDates(const std::string& table_id, const DatesT& dates) {
|
||||||
if (dates.empty()) {
|
if (dates.empty()) {
|
||||||
@ -1379,7 +1379,7 @@ MySQLMetaImpl::GetTableFiles(const std::string& table_id, const std::vector<size
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PXU TODO: Support Swap
|
// TODO(myh): Support swap to cloud storage
|
||||||
Status
|
Status
|
||||||
MySQLMetaImpl::Archive() {
|
MySQLMetaImpl::Archive() {
|
||||||
auto& criterias = options_.archive_conf_.GetCriterias();
|
auto& criterias = options_.archive_conf_.GetCriterias();
|
||||||
@ -1984,9 +1984,8 @@ MySQLMetaImpl::DropAll() {
|
|||||||
|
|
||||||
if (dropTableQuery.exec()) {
|
if (dropTableQuery.exec()) {
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
} else {
|
|
||||||
return HandleException("QUERY ERROR WHEN DROPPING ALL", dropTableQuery.error());
|
|
||||||
}
|
}
|
||||||
|
return HandleException("QUERY ERROR WHEN DROPPING ALL", dropTableQuery.error());
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
return HandleException("GENERAL ERROR WHEN DROPPING ALL", e.what());
|
return HandleException("GENERAL ERROR WHEN DROPPING ALL", e.what());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,7 +155,7 @@ SqliteMetaImpl::Initialize() {
|
|||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PXU TODO: Temp solution. Will fix later
|
// TODO(myh): Delete single vecotor by id
|
||||||
Status
|
Status
|
||||||
SqliteMetaImpl::DropPartitionsByDates(const std::string &table_id,
|
SqliteMetaImpl::DropPartitionsByDates(const std::string &table_id,
|
||||||
const DatesT &dates) {
|
const DatesT &dates) {
|
||||||
@ -885,7 +885,7 @@ SqliteMetaImpl::GetTableFiles(const std::string &table_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PXU TODO: Support Swap
|
// TODO(myh): Support swap to cloud storage
|
||||||
Status
|
Status
|
||||||
SqliteMetaImpl::Archive() {
|
SqliteMetaImpl::Archive() {
|
||||||
auto &criterias = options_.archive_conf_.GetCriterias();
|
auto &criterias = options_.archive_conf_.GetCriterias();
|
||||||
|
|||||||
@ -31,8 +31,9 @@ namespace server {
|
|||||||
|
|
||||||
void
|
void
|
||||||
SystemInfo::Init() {
|
SystemInfo::Init() {
|
||||||
if (initialized_)
|
if (initialized_) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
@ -45,9 +46,10 @@ SystemInfo::Init() {
|
|||||||
last_user_cpu_ = time_sample.tms_utime;
|
last_user_cpu_ = time_sample.tms_utime;
|
||||||
file = fopen("/proc/cpuinfo", "r");
|
file = fopen("/proc/cpuinfo", "r");
|
||||||
num_processors_ = 0;
|
num_processors_ = 0;
|
||||||
while (fgets(line, 128, file) != NULL) {
|
while (fgets(line, 128, file) != nullptr) {
|
||||||
if (strncmp(line, "processor", 9) == 0)
|
if (strncmp(line, "processor", 9) == 0) {
|
||||||
num_processors_++;
|
num_processors_++;
|
||||||
|
}
|
||||||
if (strncmp(line, "physical", 8) == 0) {
|
if (strncmp(line, "physical", 8) == 0) {
|
||||||
num_physical_processors_ = ParseLine(line);
|
num_physical_processors_ = ParseLine(line);
|
||||||
}
|
}
|
||||||
@ -80,7 +82,9 @@ SystemInfo::ParseLine(char* line) {
|
|||||||
// This assumes that a digit will be found and the line ends in " Kb".
|
// This assumes that a digit will be found and the line ends in " Kb".
|
||||||
int i = strlen(line);
|
int i = strlen(line);
|
||||||
const char* p = line;
|
const char* p = line;
|
||||||
while (*p < '0' || *p > '9') p++;
|
while (*p < '0' || *p > '9') {
|
||||||
|
p++;
|
||||||
|
}
|
||||||
line[i - 3] = '\0';
|
line[i - 3] = '\0';
|
||||||
i = atoi(p);
|
i = atoi(p);
|
||||||
return static_cast<uint64_t>(i);
|
return static_cast<uint64_t>(i);
|
||||||
@ -105,7 +109,7 @@ SystemInfo::GetProcessUsedMemory() {
|
|||||||
constexpr uint64_t KB_SIZE = 1024;
|
constexpr uint64_t KB_SIZE = 1024;
|
||||||
char line[line_length];
|
char line[line_length];
|
||||||
|
|
||||||
while (fgets(line, line_length, file) != NULL) {
|
while (fgets(line, line_length, file) != nullptr) {
|
||||||
if (strncmp(line, "VmRSS:", 6) == 0) {
|
if (strncmp(line, "VmRSS:", 6) == 0) {
|
||||||
result = ParseLine(line);
|
result = ParseLine(line);
|
||||||
break;
|
break;
|
||||||
@ -118,9 +122,12 @@ SystemInfo::GetProcessUsedMemory() {
|
|||||||
|
|
||||||
double
|
double
|
||||||
SystemInfo::MemoryPercent() {
|
SystemInfo::MemoryPercent() {
|
||||||
if (!initialized_)
|
if (!initialized_) {
|
||||||
Init();
|
Init();
|
||||||
return (double)(GetProcessUsedMemory() * 100) / (double)total_ram_;
|
}
|
||||||
|
|
||||||
|
double mem_used = static_cast<double>(GetProcessUsedMemory() * 100);
|
||||||
|
return mem_used / static_cast<double>(total_ram_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
@ -174,8 +181,9 @@ SystemInfo::getTotalCpuTime(std::vector<uint64_t>& work_time_array) {
|
|||||||
|
|
||||||
double
|
double
|
||||||
SystemInfo::CPUPercent() {
|
SystemInfo::CPUPercent() {
|
||||||
if (!initialized_)
|
if (!initialized_) {
|
||||||
Init();
|
Init();
|
||||||
|
}
|
||||||
struct tms time_sample;
|
struct tms time_sample;
|
||||||
clock_t now;
|
clock_t now;
|
||||||
double percent;
|
double percent;
|
||||||
@ -233,7 +241,7 @@ SystemInfo::CPUTemperature() {
|
|||||||
for (int i = 0; i <= num_physical_processors_; ++i) {
|
for (int i = 0; i <= num_physical_processors_; ++i) {
|
||||||
std::string path = "/sys/class/thermal/thermal_zone" + std::to_string(i) + "/temp";
|
std::string path = "/sys/class/thermal/thermal_zone" + std::to_string(i) + "/temp";
|
||||||
FILE* file = fopen(path.data(), "r");
|
FILE* file = fopen(path.data(), "r");
|
||||||
if (file == NULL) {
|
if (file == nullptr) {
|
||||||
perror("Could not open thermal file");
|
perror("Could not open thermal file");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -269,7 +277,7 @@ SystemInfo::Octets() {
|
|||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
std::string lastline = "";
|
std::string lastline = "";
|
||||||
std::string line = "";
|
std::string line = "";
|
||||||
while (file) {
|
while (true) {
|
||||||
getline(file, line);
|
getline(file, line);
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -75,7 +75,7 @@ ResourceMgr::Connect(const std::string& name1, const std::string& name2, Connect
|
|||||||
auto res2 = GetResource(name2);
|
auto res2 = GetResource(name2);
|
||||||
if (res1 && res2) {
|
if (res1 && res2) {
|
||||||
res1->AddNeighbour(std::static_pointer_cast<Node>(res2), connection);
|
res1->AddNeighbour(std::static_pointer_cast<Node>(res2), connection);
|
||||||
// TODO: enable when task balance supported
|
// TODO(wxy): enable when task balance supported
|
||||||
// res2->AddNeighbour(std::static_pointer_cast<Node>(res1), connection);
|
// res2->AddNeighbour(std::static_pointer_cast<Node>(res1), connection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class ResourceMgr {
|
|||||||
return disk_resources_;
|
return disk_resources_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: why return shared pointer
|
// TODO(wxy): why return shared pointer
|
||||||
inline std::vector<ResourcePtr>
|
inline std::vector<ResourcePtr>
|
||||||
GetAllResources() {
|
GetAllResources() {
|
||||||
return resources_;
|
return resources_;
|
||||||
@ -90,7 +90,7 @@ class ResourceMgr {
|
|||||||
GetNumGpuResource() const;
|
GetNumGpuResource() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO: add stats interface(low)
|
// TODO(wxy): add stats interface(low)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/******** Utility Functions ********/
|
/******** Utility Functions ********/
|
||||||
|
|||||||
@ -147,7 +147,7 @@ load_advance_config() {
|
|||||||
// }
|
// }
|
||||||
// } catch (const char *msg) {
|
// } catch (const char *msg) {
|
||||||
// SERVER_LOG_ERROR << msg;
|
// SERVER_LOG_ERROR << msg;
|
||||||
// // TODO: throw exception instead
|
// // TODO(wxy): throw exception instead
|
||||||
// exit(-1);
|
// exit(-1);
|
||||||
//// throw std::exception();
|
//// throw std::exception();
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -93,7 +93,7 @@ Scheduler::Process(const EventPtr& event) {
|
|||||||
process_event(event);
|
process_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: refactor the function
|
// TODO(wxy): refactor the function
|
||||||
void
|
void
|
||||||
Scheduler::OnLoadCompleted(const EventPtr& event) {
|
Scheduler::OnLoadCompleted(const EventPtr& event) {
|
||||||
auto load_completed_event = std::static_pointer_cast<LoadCompletedEvent>(event);
|
auto load_completed_event = std::static_pointer_cast<LoadCompletedEvent>(event);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace zilliz {
|
|||||||
namespace milvus {
|
namespace milvus {
|
||||||
namespace scheduler {
|
namespace scheduler {
|
||||||
|
|
||||||
// TODO: refactor, not friendly to unittest, logical in framework code
|
// TODO(wxy): refactor, not friendly to unittest, logical in framework code
|
||||||
class Scheduler {
|
class Scheduler {
|
||||||
public:
|
public:
|
||||||
explicit Scheduler(ResourceMgrWPtr res_mgr);
|
explicit Scheduler(ResourceMgrWPtr res_mgr);
|
||||||
|
|||||||
@ -33,7 +33,7 @@ TaskCreator::Create(const JobPtr& job) {
|
|||||||
return Create(std::static_pointer_cast<DeleteJob>(job));
|
return Create(std::static_pointer_cast<DeleteJob>(job));
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
// TODO: error
|
// TODO(wxy): error
|
||||||
return std::vector<TaskPtr>();
|
return std::vector<TaskPtr>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class TaskTable {
|
|||||||
Get(uint64_t index);
|
Get(uint64_t index);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO(wxyu): BIG GC
|
* TODO(wxy): BIG GC
|
||||||
* Remove sequence task which is DONE or MOVED from front;
|
* Remove sequence task which is DONE or MOVED from front;
|
||||||
* Called by ?
|
* Called by ?
|
||||||
*/
|
*/
|
||||||
@ -174,7 +174,7 @@ class TaskTable {
|
|||||||
public:
|
public:
|
||||||
/******** Action ********/
|
/******** Action ********/
|
||||||
|
|
||||||
// TODO: bool to Status
|
// TODO(wxy): bool to Status
|
||||||
/*
|
/*
|
||||||
* Load a task;
|
* Load a task;
|
||||||
* Set state loading;
|
* Set state loading;
|
||||||
|
|||||||
@ -83,7 +83,7 @@ Action::PushTaskToNeighbourRandomly(const TaskPtr& task, const ResourcePtr& self
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: process
|
// TODO(wxy): process
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ struct Neighbour {
|
|||||||
Connection connection;
|
Connection connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(linxj): return type void -> Status
|
// TODO(lxj): return type void -> Status
|
||||||
class Node {
|
class Node {
|
||||||
public:
|
public:
|
||||||
Node();
|
Node();
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace zilliz {
|
|||||||
namespace milvus {
|
namespace milvus {
|
||||||
namespace scheduler {
|
namespace scheduler {
|
||||||
|
|
||||||
// TODO(wxyu): Storage, Route, Executor
|
// TODO(wxy): Storage, Route, Executor
|
||||||
enum class ResourceType {
|
enum class ResourceType {
|
||||||
DISK = 0,
|
DISK = 0,
|
||||||
CPU = 1,
|
CPU = 1,
|
||||||
@ -115,11 +115,11 @@ class Resource : public Node, public std::enable_shared_from_this<Resource> {
|
|||||||
return enable_executor_;
|
return enable_executor_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: const
|
// TODO(wxy): const
|
||||||
uint64_t
|
uint64_t
|
||||||
NumOfTaskToExec();
|
NumOfTaskToExec();
|
||||||
|
|
||||||
// TODO: need double ?
|
// TODO(wxy): need double ?
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
TaskAvgCost() const {
|
TaskAvgCost() const {
|
||||||
return total_cost_ / total_task_;
|
return total_cost_ / total_task_;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace zilliz {
|
|||||||
namespace milvus {
|
namespace milvus {
|
||||||
namespace scheduler {
|
namespace scheduler {
|
||||||
|
|
||||||
// TODO: rewrite
|
// TODO(wxy): rewrite
|
||||||
class XSearchTask : public Task {
|
class XSearchTask : public Task {
|
||||||
public:
|
public:
|
||||||
explicit XSearchTask(TableFileSchemaPtr file);
|
explicit XSearchTask(TableFileSchemaPtr file);
|
||||||
|
|||||||
@ -30,10 +30,10 @@ main(int argc, char* argv[]) {
|
|||||||
printf("Client start...\n");
|
printf("Client start...\n");
|
||||||
|
|
||||||
std::string app_name = basename(argv[0]);
|
std::string app_name = basename(argv[0]);
|
||||||
static struct option long_options[] = {{"server", optional_argument, 0, 's'},
|
static struct option long_options[] = {{"server", optional_argument, nullptr, 's'},
|
||||||
{"port", optional_argument, 0, 'p'},
|
{"port", optional_argument, nullptr, 'p'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
{NULL, 0, 0, 0}};
|
{nullptr, 0, nullptr, 0}};
|
||||||
|
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
std::string address = "127.0.0.1", port = "19530";
|
std::string address = "127.0.0.1", port = "19530";
|
||||||
|
|||||||
@ -29,10 +29,7 @@ namespace milvus {
|
|||||||
bool
|
bool
|
||||||
UriCheck(const std::string& uri) {
|
UriCheck(const std::string& uri) {
|
||||||
size_t index = uri.find_first_of(':', 0);
|
size_t index = uri.find_first_of(':', 0);
|
||||||
if (index == std::string::npos) {
|
return (index != std::string::npos);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
@ -99,7 +96,7 @@ ClientProxy::CreateTable(const TableSchema& param) {
|
|||||||
schema.set_table_name(param.table_name);
|
schema.set_table_name(param.table_name);
|
||||||
schema.set_dimension(param.dimension);
|
schema.set_dimension(param.dimension);
|
||||||
schema.set_index_file_size(param.index_file_size);
|
schema.set_index_file_size(param.index_file_size);
|
||||||
schema.set_metric_type((int32_t)param.metric_type);
|
schema.set_metric_type(static_cast<int32_t>(param.metric_type));
|
||||||
|
|
||||||
return client_ptr_->CreateTable(schema);
|
return client_ptr_->CreateTable(schema);
|
||||||
} catch (std::exception& ex) {
|
} catch (std::exception& ex) {
|
||||||
@ -130,7 +127,6 @@ ClientProxy::DropTable(const std::string& table_name) {
|
|||||||
Status
|
Status
|
||||||
ClientProxy::CreateIndex(const IndexParam& index_param) {
|
ClientProxy::CreateIndex(const IndexParam& index_param) {
|
||||||
try {
|
try {
|
||||||
// TODO: add index params
|
|
||||||
::milvus::grpc::IndexParam grpc_index_param;
|
::milvus::grpc::IndexParam grpc_index_param;
|
||||||
grpc_index_param.set_table_name(index_param.table_name);
|
grpc_index_param.set_table_name(index_param.table_name);
|
||||||
grpc_index_param.mutable_index()->set_index_type(static_cast<int32_t>(index_param.index_type));
|
grpc_index_param.mutable_index()->set_index_type(static_cast<int32_t>(index_param.index_type));
|
||||||
@ -274,7 +270,7 @@ ClientProxy::DescribeTable(const std::string& table_name, TableSchema& table_sch
|
|||||||
table_schema.table_name = grpc_schema.table_name();
|
table_schema.table_name = grpc_schema.table_name();
|
||||||
table_schema.dimension = grpc_schema.dimension();
|
table_schema.dimension = grpc_schema.dimension();
|
||||||
table_schema.index_file_size = grpc_schema.index_file_size();
|
table_schema.index_file_size = grpc_schema.index_file_size();
|
||||||
table_schema.metric_type = (MetricType)grpc_schema.metric_type();
|
table_schema.metric_type = static_cast<MetricType>(grpc_schema.metric_type());
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
} catch (std::exception& ex) {
|
} catch (std::exception& ex) {
|
||||||
@ -384,7 +380,7 @@ ClientProxy::DescribeIndex(const std::string& table_name, IndexParam& index_para
|
|||||||
grpc_table_name.set_table_name(table_name);
|
grpc_table_name.set_table_name(table_name);
|
||||||
::milvus::grpc::IndexParam grpc_index_param;
|
::milvus::grpc::IndexParam grpc_index_param;
|
||||||
Status status = client_ptr_->DescribeIndex(grpc_table_name, grpc_index_param);
|
Status status = client_ptr_->DescribeIndex(grpc_table_name, grpc_index_param);
|
||||||
index_param.index_type = (IndexType)(grpc_index_param.mutable_index()->index_type());
|
index_param.index_type = static_cast<IndexType>(grpc_index_param.mutable_index()->index_type());
|
||||||
index_param.nlist = grpc_index_param.mutable_index()->nlist();
|
index_param.nlist = grpc_index_param.mutable_index()->nlist();
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@ -468,7 +468,7 @@ InsertTask::OnExecute() {
|
|||||||
// step 4: prepare float data
|
// step 4: prepare float data
|
||||||
std::vector<float> vec_f(insert_param_->row_record_array_size() * table_info.dimension_, 0);
|
std::vector<float> vec_f(insert_param_->row_record_array_size() * table_info.dimension_, 0);
|
||||||
|
|
||||||
// TODO: change to one dimension array in protobuf or use multiple-thread to copy the data
|
// TODO(yk): change to one dimension array or use multiple-thread to copy the data
|
||||||
for (size_t i = 0; i < insert_param_->row_record_array_size(); i++) {
|
for (size_t i = 0; i < insert_param_->row_record_array_size(); i++) {
|
||||||
if (insert_param_->row_record_array(i).vector_data().empty()) {
|
if (insert_param_->row_record_array(i).vector_data().empty()) {
|
||||||
return Status(SERVER_INVALID_ROWRECORD_ARRAY, "Row record array data is empty");
|
return Status(SERVER_INVALID_ROWRECORD_ARRAY, "Row record array data is empty");
|
||||||
|
|||||||
@ -291,7 +291,7 @@ TEST_F(DBTest, SEARCH_TEST) {
|
|||||||
ASSERT_TRUE(stat.ok());
|
ASSERT_TRUE(stat.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(linxj): add groundTruth assert
|
// TODO(lxj): add groundTruth assert
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DBTest, PRELOADTABLE_TEST) {
|
TEST_F(DBTest, PRELOADTABLE_TEST) {
|
||||||
|
|||||||
@ -193,7 +193,7 @@ TEST(CacheTest, GPU_CACHE_TEST) {
|
|||||||
ASSERT_EQ(gpu_mgr->ItemCount(), 0);
|
ASSERT_EQ(gpu_mgr->ItemCount(), 0);
|
||||||
|
|
||||||
for (auto i = 0; i < 3; i++) {
|
for (auto i = 0; i < 3; i++) {
|
||||||
// TODO: use gpu index to mock
|
// TODO(myh): use gpu index to mock
|
||||||
//each vector is 1k byte, total size less than 2G
|
//each vector is 1k byte, total size less than 2G
|
||||||
ms::engine::VecIndexPtr mock_index = std::make_shared<MockVecIndex>(256, 2000000);
|
ms::engine::VecIndexPtr mock_index = std::make_shared<MockVecIndex>(256, 2000000);
|
||||||
ms::cache::DataObjPtr data_obj = std::make_shared<ms::cache::DataObj>(mock_index);
|
ms::cache::DataObjPtr data_obj = std::make_shared<ms::cache::DataObj>(mock_index);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user