提交 086efd62 编写于 作者: C Cai Yudong 提交者: JinHai-CN

clean compile warning (#2380)

Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>
上级 014a0e86
...@@ -47,7 +47,7 @@ DefaultVectorIndexFormat::read_internal(const storage::FSHandlerPtr& fs_ptr, con ...@@ -47,7 +47,7 @@ DefaultVectorIndexFormat::read_internal(const storage::FSHandlerPtr& fs_ptr, con
return nullptr; return nullptr;
} }
size_t rp = 0; int64_t rp = 0;
fs_ptr->reader_ptr_->seekg(0); fs_ptr->reader_ptr_->seekg(0);
int32_t current_type = 0; int32_t current_type = 0;
......
...@@ -398,19 +398,19 @@ Config::ValidateConfig() { ...@@ -398,19 +398,19 @@ Config::ValidateConfig() {
STATUS_CHECK(GetLogsTraceEnable(trace_enable)); STATUS_CHECK(GetLogsTraceEnable(trace_enable));
bool debug_enable; bool debug_enable;
STATUS_CHECK(GetLogsDebugEnable(trace_enable)); STATUS_CHECK(GetLogsDebugEnable(debug_enable));
bool info_enable; bool info_enable;
STATUS_CHECK(GetLogsInfoEnable(trace_enable)); STATUS_CHECK(GetLogsInfoEnable(info_enable));
bool warning_enable; bool warning_enable;
STATUS_CHECK(GetLogsWarningEnable(trace_enable)); STATUS_CHECK(GetLogsWarningEnable(warning_enable));
bool error_enable; bool error_enable;
STATUS_CHECK(GetLogsErrorEnable(trace_enable)); STATUS_CHECK(GetLogsErrorEnable(error_enable));
bool fatal_enable; bool fatal_enable;
STATUS_CHECK(GetLogsFatalEnable(trace_enable)); STATUS_CHECK(GetLogsFatalEnable(fatal_enable));
std::string logs_path; std::string logs_path;
STATUS_CHECK(GetLogsPath(logs_path)); STATUS_CHECK(GetLogsPath(logs_path));
...@@ -1252,9 +1252,9 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) { ...@@ -1252,9 +1252,9 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) {
return Status(SERVER_INVALID_ARGUMENT, msg); return Status(SERVER_INVALID_ARGUMENT, msg);
} }
uint64_t total_mem = 0, free_mem = 0; int64_t total_mem = 0, free_mem = 0;
CommonUtil::GetSystemMemInfo(total_mem, free_mem); CommonUtil::GetSystemMemInfo(total_mem, free_mem);
if (static_cast<uint64_t>(cpu_cache_capacity) >= total_mem) { if (cpu_cache_capacity >= total_mem) {
std::string msg = "Invalid cpu cache capacity: " + value + std::string msg = "Invalid cpu cache capacity: " + value +
". Possible reason: cache_config.cpu_cache_capacity exceeds system memory."; ". Possible reason: cache_config.cpu_cache_capacity exceeds system memory.";
return Status(SERVER_INVALID_ARGUMENT, msg); return Status(SERVER_INVALID_ARGUMENT, msg);
...@@ -1314,7 +1314,7 @@ Config::CheckCacheConfigInsertBufferSize(const std::string& value) { ...@@ -1314,7 +1314,7 @@ Config::CheckCacheConfigInsertBufferSize(const std::string& value) {
std::string str = GetConfigStr(CONFIG_CACHE, CONFIG_CACHE_CPU_CACHE_CAPACITY, "0"); std::string str = GetConfigStr(CONFIG_CACHE, CONFIG_CACHE_CPU_CACHE_CAPACITY, "0");
int64_t cache_size = std::stoll(str) * GB; int64_t cache_size = std::stoll(str) * GB;
uint64_t total_mem = 0, free_mem = 0; int64_t total_mem = 0, free_mem = 0;
CommonUtil::GetSystemMemInfo(total_mem, free_mem); CommonUtil::GetSystemMemInfo(total_mem, free_mem);
if (buffer_size + cache_size >= total_mem) { if (buffer_size + cache_size >= total_mem) {
std::string msg = "Invalid insert buffer size: " + value + std::string msg = "Invalid insert buffer size: " + value +
...@@ -1423,7 +1423,7 @@ Config::CheckGpuResourceConfigCacheCapacity(const std::string& value) { ...@@ -1423,7 +1423,7 @@ Config::CheckGpuResourceConfigCacheCapacity(const std::string& value) {
STATUS_CHECK(GetGpuResourceConfigBuildIndexResources(gpu_ids)); STATUS_CHECK(GetGpuResourceConfigBuildIndexResources(gpu_ids));
for (int64_t gpu_id : gpu_ids) { for (int64_t gpu_id : gpu_ids) {
size_t gpu_memory; int64_t gpu_memory;
if (!ValidationUtil::GetGpuMemory(gpu_id, gpu_memory).ok()) { if (!ValidationUtil::GetGpuMemory(gpu_id, gpu_memory).ok()) {
std::string msg = "Fail to get GPU memory for GPU device: " + std::to_string(gpu_id); std::string msg = "Fail to get GPU memory for GPU device: " + std::to_string(gpu_id);
return Status(SERVER_UNEXPECTED_ERROR, msg); return Status(SERVER_UNEXPECTED_ERROR, msg);
......
...@@ -2011,7 +2011,7 @@ DBImpl::MergeHybridFiles(const std::string& collection_id, meta::FilesHolder& fi ...@@ -2011,7 +2011,7 @@ DBImpl::MergeHybridFiles(const std::string& collection_id, meta::FilesHolder& fi
// if index type isn't IDMAP, set file type to TO_INDEX if file size exceed index_file_size // if index type isn't IDMAP, set file type to TO_INDEX if file size exceed index_file_size
// else set file type to RAW, no need to build index // else set file type to RAW, no need to build index
if (!utils::IsRawIndexType(table_file.engine_type_)) { if (!utils::IsRawIndexType(table_file.engine_type_)) {
table_file.file_type_ = (segment_writer_ptr->Size() >= table_file.index_file_size_) table_file.file_type_ = (segment_writer_ptr->Size() >= (size_t)(table_file.index_file_size_))
? meta::SegmentSchema::TO_INDEX ? meta::SegmentSchema::TO_INDEX
: meta::SegmentSchema::RAW; : meta::SegmentSchema::RAW;
} else { } else {
......
...@@ -1062,7 +1062,7 @@ ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_quer ...@@ -1062,7 +1062,7 @@ ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_quer
faiss::ConcurrentBitsetPtr list; faiss::ConcurrentBitsetPtr list;
list = index_->GetBlacklist(); list = index_->GetBlacklist();
// Do OR // Do OR
for (uint64_t i = 0; i < vector_count_; ++i) { for (int64_t i = 0; i < vector_count_; ++i) {
if (list->test(i) || bitset->test(i)) { if (list->test(i) || bitset->test(i)) {
bitset->set(i); bitset->set(i);
} }
......
...@@ -32,7 +32,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG ...@@ -32,7 +32,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG
meta::SegmentsSchema& files = files_holder.HoldFiles(); meta::SegmentsSchema& files = files_holder.HoldFiles();
for (meta::SegmentsSchema::reverse_iterator iter = files.rbegin(); iter != files.rend(); ++iter) { for (meta::SegmentsSchema::reverse_iterator iter = files.rbegin(); iter != files.rend(); ++iter) {
meta::SegmentSchema& file = *iter; meta::SegmentSchema& file = *iter;
if (file.index_file_size_ > 0 && file.file_size_ > file.index_file_size_) { if (file.index_file_size_ > 0 && (int64_t)file.file_size_ > file.index_file_size_) {
// file that no need to merge // file that no need to merge
continue; continue;
} }
...@@ -60,7 +60,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG ...@@ -60,7 +60,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG
int64_t sum_size = 0; int64_t sum_size = 0;
for (auto iter = sort_files.begin(); iter != sort_files.end();) { for (auto iter = sort_files.begin(); iter != sort_files.end();) {
meta::SegmentSchema& file = *iter; meta::SegmentSchema& file = *iter;
if (sum_size + file.file_size_ <= index_file_size) { if (sum_size + (int64_t)(file.file_size_) <= index_file_size) {
temp_group.push_back(file); temp_group.push_back(file);
sum_size += file.file_size_; sum_size += file.file_size_;
iter = sort_files.erase(iter); iter = sort_files.erase(iter);
......
...@@ -71,7 +71,7 @@ MergeTask::Execute() { ...@@ -71,7 +71,7 @@ MergeTask::Execute() {
auto file_schema = file; auto file_schema = file;
file_schema.file_type_ = meta::SegmentSchema::TO_DELETE; file_schema.file_type_ = meta::SegmentSchema::TO_DELETE;
updated.push_back(file_schema); updated.push_back(file_schema);
auto size = segment_writer_ptr->Size(); int64_t size = segment_writer_ptr->Size();
if (size >= file_schema.index_file_size_) { if (size >= file_schema.index_file_size_) {
break; break;
} }
...@@ -104,7 +104,7 @@ MergeTask::Execute() { ...@@ -104,7 +104,7 @@ MergeTask::Execute() {
// if index type isn't IDMAP, set file type to TO_INDEX if file size exceed index_file_size // if index type isn't IDMAP, set file type to TO_INDEX if file size exceed index_file_size
// else set file type to RAW, no need to build index // else set file type to RAW, no need to build index
if (!utils::IsRawIndexType(collection_file.engine_type_)) { if (!utils::IsRawIndexType(collection_file.engine_type_)) {
collection_file.file_type_ = (segment_writer_ptr->Size() >= collection_file.index_file_size_) collection_file.file_type_ = (segment_writer_ptr->Size() >= (size_t)(collection_file.index_file_size_))
? meta::SegmentSchema::TO_INDEX ? meta::SegmentSchema::TO_INDEX
: meta::SegmentSchema::RAW; : meta::SegmentSchema::RAW;
} else { } else {
......
...@@ -1845,7 +1845,7 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files ...@@ -1845,7 +1845,7 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files
for (auto& resRow : res) { for (auto& resRow : res) {
SegmentSchema collection_file; SegmentSchema collection_file;
collection_file.file_size_ = resRow["file_size"]; collection_file.file_size_ = resRow["file_size"];
if (collection_file.file_size_ >= collection_schema.index_file_size_) { if ((int64_t)(collection_file.file_size_) >= collection_schema.index_file_size_) {
continue; // skip large file continue; // skip large file
} }
...@@ -3001,6 +3001,7 @@ MySQLMetaImpl::DescribeHybridCollection(CollectionSchema& collection_schema, hyb ...@@ -3001,6 +3001,7 @@ MySQLMetaImpl::DescribeHybridCollection(CollectionSchema& collection_schema, hyb
Status Status
MySQLMetaImpl::CreateHybridCollectionFile(milvus::engine::meta::SegmentSchema& file_schema) { MySQLMetaImpl::CreateHybridCollectionFile(milvus::engine::meta::SegmentSchema& file_schema) {
return Status::OK();
} }
} // namespace meta } // namespace meta
......
...@@ -1246,7 +1246,7 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file ...@@ -1246,7 +1246,7 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file
for (auto& file : selected) { for (auto& file : selected) {
SegmentSchema collection_file; SegmentSchema collection_file;
collection_file.file_size_ = std::get<5>(file); collection_file.file_size_ = std::get<5>(file);
if (collection_file.file_size_ >= collection_schema.index_file_size_) { if (collection_file.file_size_ >= (size_t)(collection_schema.index_file_size_)) {
continue; // skip large file continue; // skip large file
} }
......
...@@ -614,7 +614,7 @@ bool ...@@ -614,7 +614,7 @@ bool
MXLogBuffer::ResetWriteLsn(uint64_t lsn) { MXLogBuffer::ResetWriteLsn(uint64_t lsn) {
LOG_WAL_INFO_ << "reset write lsn " << lsn; LOG_WAL_INFO_ << "reset write lsn " << lsn;
int32_t old_file_no = mxlog_buffer_writer_.file_no; uint32_t old_file_no = mxlog_buffer_writer_.file_no;
ParserLsn(lsn, mxlog_buffer_writer_.file_no, mxlog_buffer_writer_.buf_offset); ParserLsn(lsn, mxlog_buffer_writer_.file_no, mxlog_buffer_writer_.buf_offset);
if (old_file_no == mxlog_buffer_writer_.file_no) { if (old_file_no == mxlog_buffer_writer_.file_no) {
LOG_WAL_DEBUG_ << "file No. is not changed"; LOG_WAL_DEBUG_ << "file No. is not changed";
......
...@@ -170,7 +170,7 @@ SystemInfo::CPUCorePercent() { ...@@ -170,7 +170,7 @@ SystemInfo::CPUCorePercent() {
std::vector<int64_t> cur_total_time_array = getTotalCpuTime(cur_work_time_array); std::vector<int64_t> cur_total_time_array = getTotalCpuTime(cur_work_time_array);
std::vector<double> cpu_core_percent; std::vector<double> cpu_core_percent;
for (int i = 0; i < cur_total_time_array.size(); i++) { for (size_t i = 0; i < cur_total_time_array.size(); i++) {
double total_cpu_time = cur_total_time_array[i] - prev_total_time_array[i]; double total_cpu_time = cur_total_time_array[i] - prev_total_time_array[i];
double cpu_work_time = cur_work_time_array[i] - prev_work_time_array[i]; double cpu_work_time = cur_work_time_array[i] - prev_work_time_array[i];
cpu_core_percent.push_back((cpu_work_time / total_cpu_time) * 100); cpu_core_percent.push_back((cpu_work_time / total_cpu_time) * 100);
...@@ -254,7 +254,7 @@ SystemInfo::GPUMemoryTotal() { ...@@ -254,7 +254,7 @@ SystemInfo::GPUMemoryTotal() {
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
nvmlMemory_t nvmlMemory; nvmlMemory_t nvmlMemory;
for (int i = 0; i < num_device_; ++i) { for (uint32_t i = 0; i < num_device_; ++i) {
nvmlDevice_t device; nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device); nvmlDeviceGetHandleByIndex(i, &device);
nvmlDeviceGetMemoryInfo(device, &nvmlMemory); nvmlDeviceGetMemoryInfo(device, &nvmlMemory);
...@@ -273,7 +273,7 @@ SystemInfo::GPUTemperature() { ...@@ -273,7 +273,7 @@ SystemInfo::GPUTemperature() {
std::vector<int64_t> result; std::vector<int64_t> result;
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
for (int i = 0; i < num_device_; i++) { for (uint32_t i = 0; i < num_device_; i++) {
nvmlDevice_t device; nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device); nvmlDeviceGetHandleByIndex(i, &device);
unsigned int temp; unsigned int temp;
...@@ -342,7 +342,7 @@ SystemInfo::GPUMemoryUsed() { ...@@ -342,7 +342,7 @@ SystemInfo::GPUMemoryUsed() {
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
nvmlMemory_t nvmlMemory; nvmlMemory_t nvmlMemory;
for (int i = 0; i < num_device_; ++i) { for (uint32_t i = 0; i < num_device_; ++i) {
nvmlDevice_t device; nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device); nvmlDeviceGetHandleByIndex(i, &device);
nvmlDeviceGetMemoryInfo(device, &nvmlMemory); nvmlDeviceGetMemoryInfo(device, &nvmlMemory);
...@@ -355,8 +355,6 @@ SystemInfo::GPUMemoryUsed() { ...@@ -355,8 +355,6 @@ SystemInfo::GPUMemoryUsed() {
std::pair<int64_t, int64_t> std::pair<int64_t, int64_t>
SystemInfo::Octets() { SystemInfo::Octets() {
pid_t pid = getpid();
// const std::string filename = "/proc/"+std::to_string(pid)+"/net/netstat";
const std::string filename = "/proc/net/netstat"; const std::string filename = "/proc/net/netstat";
std::ifstream file(filename); std::ifstream file(filename);
std::string lastline = ""; std::string lastline = "";
......
...@@ -204,7 +204,7 @@ PrometheusMetrics::CPUCoreUsagePercentSet() { ...@@ -204,7 +204,7 @@ PrometheusMetrics::CPUCoreUsagePercentSet() {
std::vector<double> cpu_core_percent = server::SystemInfo::GetInstance().CPUCorePercent(); std::vector<double> cpu_core_percent = server::SystemInfo::GetInstance().CPUCorePercent();
for (int i = 0; i < cpu_core_percent.size(); ++i) { for (size_t i = 0; i < cpu_core_percent.size(); ++i) {
prometheus::Gauge& core_percent = CPU_.Add({{"CPU", std::to_string(i)}}); prometheus::Gauge& core_percent = CPU_.Add({{"CPU", std::to_string(i)}});
core_percent.Set(cpu_core_percent[i]); core_percent.Set(cpu_core_percent[i]);
} }
...@@ -218,7 +218,7 @@ PrometheusMetrics::GPUTemperature() { ...@@ -218,7 +218,7 @@ PrometheusMetrics::GPUTemperature() {
std::vector<int64_t> GPU_temperatures = server::SystemInfo::GetInstance().GPUTemperature(); std::vector<int64_t> GPU_temperatures = server::SystemInfo::GetInstance().GPUTemperature();
for (int i = 0; i < GPU_temperatures.size(); ++i) { for (size_t i = 0; i < GPU_temperatures.size(); ++i) {
prometheus::Gauge& gpu_temp = GPU_temperature_.Add({{"GPU", std::to_string(i)}}); prometheus::Gauge& gpu_temp = GPU_temperature_.Add({{"GPU", std::to_string(i)}});
gpu_temp.Set(GPU_temperatures[i]); gpu_temp.Set(GPU_temperatures[i]);
} }
...@@ -233,7 +233,7 @@ PrometheusMetrics::CPUTemperature() { ...@@ -233,7 +233,7 @@ PrometheusMetrics::CPUTemperature() {
std::vector<float> CPU_temperatures = server::SystemInfo::GetInstance().CPUTemperature(); std::vector<float> CPU_temperatures = server::SystemInfo::GetInstance().CPUTemperature();
float avg_cpu_temp = 0; float avg_cpu_temp = 0;
for (int i = 0; i < CPU_temperatures.size(); ++i) { for (size_t i = 0; i < CPU_temperatures.size(); ++i) {
avg_cpu_temp += CPU_temperatures[i]; avg_cpu_temp += CPU_temperatures[i];
} }
avg_cpu_temp /= CPU_temperatures.size(); avg_cpu_temp /= CPU_temperatures.size();
......
...@@ -84,6 +84,8 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) { ...@@ -84,6 +84,8 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) {
binary_query->relation = QueryRelation::OR; binary_query->relation = QueryRelation::OR;
return GenBinaryQuery(query, binary_query); return GenBinaryQuery(query, binary_query);
} }
default:
return Status::OK();
} }
} }
} }
...@@ -94,15 +96,15 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) { ...@@ -94,15 +96,15 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) {
switch (bc->getOccur()) { switch (bc->getOccur()) {
case Occur::MUST: { case Occur::MUST: {
binary_query->relation = QueryRelation::AND; binary_query->relation = QueryRelation::AND;
Status s = GenBinaryQuery(bc, binary_query); return GenBinaryQuery(bc, binary_query);
return s;
} }
case Occur::MUST_NOT: case Occur::MUST_NOT:
case Occur::SHOULD: { case Occur::SHOULD: {
binary_query->relation = QueryRelation::OR; binary_query->relation = QueryRelation::OR;
Status s = GenBinaryQuery(bc, binary_query); return GenBinaryQuery(bc, binary_query);
return s;
} }
default:
return Status::OK();
} }
} }
......
...@@ -24,7 +24,7 @@ SearchJob::SearchJob(const std::shared_ptr<server::Context>& context, uint64_t t ...@@ -24,7 +24,7 @@ SearchJob::SearchJob(const std::shared_ptr<server::Context>& context, uint64_t t
SearchJob::SearchJob(const std::shared_ptr<server::Context>& context, milvus::query::GeneralQueryPtr general_query, SearchJob::SearchJob(const std::shared_ptr<server::Context>& context, milvus::query::GeneralQueryPtr general_query,
std::unordered_map<std::string, engine::meta::hybrid::DataType>& attr_type, std::unordered_map<std::string, engine::meta::hybrid::DataType>& attr_type,
const engine::VectorsData& vectors) const engine::VectorsData& vectors)
: Job(JobType::SEARCH), context_(context), general_query_(general_query), attr_type_(attr_type), vectors_(vectors) { : Job(JobType::SEARCH), context_(context), vectors_(vectors), general_query_(general_query), attr_type_(attr_type) {
} }
bool bool
......
...@@ -43,7 +43,7 @@ ToString(ResourceType type) { ...@@ -43,7 +43,7 @@ ToString(ResourceType type) {
} }
Resource::Resource(std::string name, ResourceType type, uint64_t device_id, bool enable_executor) Resource::Resource(std::string name, ResourceType type, uint64_t device_id, bool enable_executor)
: name_(std::move(name)), type_(type), device_id_(device_id), enable_executor_(enable_executor) { : device_id_(device_id), name_(std::move(name)), type_(type), enable_executor_(enable_executor) {
// register subscriber in tasktable // register subscriber in tasktable
task_table_.RegisterSubscriber([&] { task_table_.RegisterSubscriber([&] {
if (subscriber_) { if (subscriber_) {
......
...@@ -56,7 +56,7 @@ FaissFlatPass::Run(const TaskPtr& task) { ...@@ -56,7 +56,7 @@ FaissFlatPass::Run(const TaskPtr& task) {
if (!gpu_enable_) { if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissFlatPass: gpu disable, specify cpu to search!", "search", 0); LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissFlatPass: gpu disable, specify cpu to search!", "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
} else if (search_job->nq() < threshold_) { } else if (search_job->nq() < (uint64_t)threshold_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissFlatPass: nq < gpu_search_threshold, specify cpu to search!", LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissFlatPass: nq < gpu_search_threshold, specify cpu to search!",
"search", 0); "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
...@@ -57,7 +57,7 @@ FaissIVFFlatPass::Run(const TaskPtr& task) { ...@@ -57,7 +57,7 @@ FaissIVFFlatPass::Run(const TaskPtr& task) {
if (!gpu_enable_) { if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFFlatPass: gpu disable, specify cpu to search!", "search", 0); LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFFlatPass: gpu disable, specify cpu to search!", "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
} else if (search_job->nq() < threshold_) { } else if (search_job->nq() < (uint64_t)threshold_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFFlatPass: nq < gpu_search_threshold, specify cpu to search!", LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFFlatPass: nq < gpu_search_threshold, specify cpu to search!",
"search", 0); "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
...@@ -59,7 +59,7 @@ FaissIVFPQPass::Run(const TaskPtr& task) { ...@@ -59,7 +59,7 @@ FaissIVFPQPass::Run(const TaskPtr& task) {
if (!gpu_enable_) { if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFPQPass: gpu disable, specify cpu to search!", "search", 0); LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFPQPass: gpu disable, specify cpu to search!", "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
} else if (search_job->nq() < threshold_) { } else if (search_job->nq() < (uint64_t)threshold_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFPQPass: nq < gpu_search_threshold, specify cpu to search!", LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFPQPass: nq < gpu_search_threshold, specify cpu to search!",
"search", 0); "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
...@@ -57,7 +57,7 @@ FaissIVFSQ8HPass::Run(const TaskPtr& task) { ...@@ -57,7 +57,7 @@ FaissIVFSQ8HPass::Run(const TaskPtr& task) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8HPass: gpu disable, specify cpu to search!", "search", 0); LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8HPass: gpu disable, specify cpu to search!", "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
} }
if (search_job->nq() < threshold_) { if (search_job->nq() < (uint64_t)threshold_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8HPass: nq < gpu_search_threshold, specify cpu to search!", LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8HPass: nq < gpu_search_threshold, specify cpu to search!",
"search", 0); "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
...@@ -57,7 +57,7 @@ FaissIVFSQ8Pass::Run(const TaskPtr& task) { ...@@ -57,7 +57,7 @@ FaissIVFSQ8Pass::Run(const TaskPtr& task) {
if (!gpu_enable_) { if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8Pass: gpu disable, specify cpu to search!", "search", 0); LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8Pass: gpu disable, specify cpu to search!", "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
} else if (search_job->nq() < threshold_) { } else if (search_job->nq() < (uint64_t)threshold_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8Pass: nq < gpu_search_threshold, specify cpu to search!", LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8Pass: nq < gpu_search_threshold, specify cpu to search!",
"search", 0); "search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu"); res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
...@@ -125,7 +125,6 @@ XBuildIndexTask::Execute() { ...@@ -125,7 +125,6 @@ XBuildIndexTask::Execute() {
} }
std::string location = file_->location_; std::string location = file_->location_;
EngineType engine_type = (EngineType)file_->engine_type_;
std::shared_ptr<engine::ExecutionEngine> index; std::shared_ptr<engine::ExecutionEngine> index;
// step 1: create collection file // step 1: create collection file
......
...@@ -316,8 +316,8 @@ XSearchTask::Execute() { ...@@ -316,8 +316,8 @@ XSearchTask::Execute() {
return; return;
} }
double span = rc.RecordSection(hdr + ", do search"); // double span = rc.RecordSection(hdr + ", do search");
// search_job->AccumSearchCost(span); // search_job->AccumSearchCost(span);
// step 3: pick up topk result // step 3: pick up topk result
auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk; auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk;
...@@ -341,8 +341,8 @@ XSearchTask::Execute() { ...@@ -341,8 +341,8 @@ XSearchTask::Execute() {
search_job->GetResultIds(), search_job->GetResultDistances()); search_job->GetResultIds(), search_job->GetResultDistances());
} }
span = rc.RecordSection(hdr + ", reduce topk"); // span = rc.RecordSection(hdr + ", reduce topk");
// search_job->AccumReduceCost(span); // search_job->AccumReduceCost(span);
} catch (std::exception& ex) { } catch (std::exception& ex) {
LOG_ENGINE_ERROR_ << LogOut("[%s][%ld] SearchTask encounter exception: %s", "search", 0, ex.what()); LOG_ENGINE_ERROR_ << LogOut("[%s][%ld] SearchTask encounter exception: %s", "search", 0, ex.what());
// search_job->IndexSearchDone(index_id_);//mark as done avoid dead lock, even search failed // search_job->IndexSearchDone(index_id_);//mark as done avoid dead lock, even search failed
......
...@@ -132,7 +132,7 @@ Attr::Erase(std::vector<int32_t>& offsets) { ...@@ -132,7 +132,7 @@ Attr::Erase(std::vector<int32_t>& offsets) {
auto loop_size = uids_.size(); auto loop_size = uids_.size();
for (size_t i = 0; i < loop_size;) { for (size_t i = 0; i < loop_size;) {
while (skip != offsets.cend() && i == *skip) { while (skip != offsets.cend() && i == (size_t)(*skip)) {
++i; ++i;
++skip; ++skip;
} }
......
...@@ -289,7 +289,7 @@ SegmentWriter::Merge(const std::string& dir_to_merge, const std::string& name) { ...@@ -289,7 +289,7 @@ SegmentWriter::Merge(const std::string& dir_to_merge, const std::string& name) {
} }
SegmentPtr segment_to_merge; SegmentPtr segment_to_merge;
segment_reader_to_merge.GetSegment(segment_to_merge); segment_reader_to_merge.GetSegment(segment_to_merge);
auto& uids = segment_to_merge->vectors_ptr_->GetUids(); // auto& uids = segment_to_merge->vectors_ptr_->GetUids();
recorder.RecordSection("Loading segment"); recorder.RecordSection("Loading segment");
......
...@@ -87,7 +87,7 @@ Vectors::Erase(std::vector<int32_t>& offsets) { ...@@ -87,7 +87,7 @@ Vectors::Erase(std::vector<int32_t>& offsets) {
auto loop_size = uids_.size(); auto loop_size = uids_.size();
for (size_t i = 0; i < loop_size;) { for (size_t i = 0; i < loop_size;) {
while (i == *skip && skip != offsets.cend()) { while (i == (size_t)(*skip) && skip != offsets.cend()) {
++i; ++i;
++skip; ++skip;
} }
......
...@@ -290,6 +290,7 @@ RequestHandler::DescribeHybridCollection(const std::shared_ptr<Context>& context ...@@ -290,6 +290,7 @@ RequestHandler::DescribeHybridCollection(const std::shared_ptr<Context>& context
Status Status
RequestHandler::HasHybridCollection(const std::shared_ptr<Context>& context, std::string& collection_name, RequestHandler::HasHybridCollection(const std::shared_ptr<Context>& context, std::string& collection_name,
bool& has_collection) { bool& has_collection) {
return Status::OK();
} }
Status Status
......
...@@ -132,7 +132,7 @@ InsertEntityRequest::OnExecute() { ...@@ -132,7 +132,7 @@ InsertEntityRequest::OnExecute() {
// TODO(yukun): check dimension and metric_type // TODO(yukun): check dimension and metric_type
// step 5: insert entities // step 5: insert entities
auto vec_count = static_cast<uint64_t>(vector_datas_it->second.vector_count_); // auto vec_count = static_cast<uint64_t>(vector_datas_it->second.vector_count_);
engine::Entity entity; engine::Entity entity;
entity.entity_count_ = row_num_; entity.entity_count_ = row_num_;
......
...@@ -68,7 +68,7 @@ InsertRequest::OnExecute() { ...@@ -68,7 +68,7 @@ InsertRequest::OnExecute() {
fiu_do_on("InsertRequest.OnExecute.id_array_error", vectors_data_.id_array_.resize(vector_count + 1)); fiu_do_on("InsertRequest.OnExecute.id_array_error", vectors_data_.id_array_.resize(vector_count + 1));
if (!vectors_data_.id_array_.empty()) { if (!vectors_data_.id_array_.empty()) {
if (vectors_data_.id_array_.size() != vector_count) { if (vectors_data_.id_array_.size() != (size_t)vector_count) {
std::string msg = "The size of vector ID array must be equal to the size of the vector."; std::string msg = "The size of vector ID array must be equal to the size of the vector.";
LOG_SERVER_ERROR_ << LogOut("[%s][%ld] Invalid id array: %s", "insert", 0, msg.c_str()); LOG_SERVER_ERROR_ << LogOut("[%s][%ld] Invalid id array: %s", "insert", 0, msg.c_str());
return Status(SERVER_ILLEGAL_VECTOR_ID, msg); return Status(SERVER_ILLEGAL_VECTOR_ID, msg);
......
...@@ -32,6 +32,8 @@ namespace milvus { ...@@ -32,6 +32,8 @@ namespace milvus {
namespace server { namespace server {
namespace grpc { namespace grpc {
const char* EXTRA_PARAM_KEY = "params";
::milvus::grpc::ErrorCode ::milvus::grpc::ErrorCode
ErrorMap(ErrorCode code) { ErrorMap(ErrorCode code) {
static const std::map<ErrorCode, ::milvus::grpc::ErrorCode> code_map = { static const std::map<ErrorCode, ::milvus::grpc::ErrorCode> code_map = {
...@@ -897,7 +899,7 @@ GrpcRequestHandler::CreateHybridCollection(::grpc::ServerContext* context, const ...@@ -897,7 +899,7 @@ GrpcRequestHandler::CreateHybridCollection(::grpc::ServerContext* context, const
std::vector<std::pair<std::string, engine::meta::hybrid::DataType>> field_types; std::vector<std::pair<std::string, engine::meta::hybrid::DataType>> field_types;
std::vector<std::pair<std::string, uint64_t>> vector_dimensions; std::vector<std::pair<std::string, uint64_t>> vector_dimensions;
std::vector<std::pair<std::string, std::string>> field_params; std::vector<std::pair<std::string, std::string>> field_params;
for (uint64_t i = 0; i < request->fields_size(); ++i) { for (int i = 0; i < request->fields_size(); ++i) {
if (request->fields(i).type().has_vector_param()) { if (request->fields(i).type().has_vector_param()) {
auto vector_dimension = auto vector_dimension =
std::make_pair(request->fields(i).name(), request->fields(i).type().vector_param().dimension()); std::make_pair(request->fields(i).name(), request->fields(i).type().vector_param().dimension());
...@@ -933,6 +935,7 @@ GrpcRequestHandler::DescribeHybridCollection(::grpc::ServerContext* context, ...@@ -933,6 +935,7 @@ GrpcRequestHandler::DescribeHybridCollection(::grpc::ServerContext* context,
LOG_SERVER_INFO_ << LogOut("Request [%s] %s begin.", GetContext(context)->RequestID().c_str(), __func__); LOG_SERVER_INFO_ << LogOut("Request [%s] %s begin.", GetContext(context)->RequestID().c_str(), __func__);
CHECK_NULLPTR_RETURN(request); CHECK_NULLPTR_RETURN(request);
LOG_SERVER_INFO_ << LogOut("Request [%s] %s end.", GetContext(context)->RequestID().c_str(), __func__); LOG_SERVER_INFO_ << LogOut("Request [%s] %s end.", GetContext(context)->RequestID().c_str(), __func__);
return ::grpc::Status::OK;
} }
::grpc::Status ::grpc::Status
...@@ -952,12 +955,12 @@ GrpcRequestHandler::InsertEntity(::grpc::ServerContext* context, const ::milvus: ...@@ -952,12 +955,12 @@ GrpcRequestHandler::InsertEntity(::grpc::ServerContext* context, const ::milvus:
std::vector<std::string> field_names; std::vector<std::string> field_names;
auto field_size = request->entities().field_names_size(); auto field_size = request->entities().field_names_size();
field_names.resize(field_size - 1); field_names.resize(field_size - 1);
for (uint64_t i = 0; i < field_size - 1; ++i) { for (int i = 0; i < field_size - 1; ++i) {
field_names[i] = request->entities().field_names(i); field_names[i] = request->entities().field_names(i);
} }
auto vector_size = request->entities().result_values_size(); auto vector_size = request->entities().result_values_size();
for (uint64_t i = 0; i < vector_size; ++i) { for (int i = 0; i < vector_size; ++i) {
engine::VectorsData vectors; engine::VectorsData vectors;
CopyRowRecords(request->entities().result_values(i).vector_value().value(), request->entity_id_array(), CopyRowRecords(request->entities().result_values(i).vector_value().value(), request->entity_id_array(),
vectors); vectors);
...@@ -983,7 +986,7 @@ void ...@@ -983,7 +986,7 @@ void
DeSerialization(const ::milvus::grpc::GeneralQuery& general_query, query::BooleanQueryPtr& boolean_clause) { DeSerialization(const ::milvus::grpc::GeneralQuery& general_query, query::BooleanQueryPtr& boolean_clause) {
if (general_query.has_boolean_query()) { if (general_query.has_boolean_query()) {
boolean_clause->SetOccur((query::Occur)general_query.boolean_query().occur()); boolean_clause->SetOccur((query::Occur)general_query.boolean_query().occur());
for (uint64_t i = 0; i < general_query.boolean_query().general_query_size(); ++i) { for (int i = 0; i < general_query.boolean_query().general_query_size(); ++i) {
if (general_query.boolean_query().general_query(i).has_boolean_query()) { if (general_query.boolean_query().general_query(i).has_boolean_query()) {
query::BooleanQueryPtr query = std::make_shared<query::BooleanQuery>(); query::BooleanQueryPtr query = std::make_shared<query::BooleanQuery>();
DeSerialization(general_query.boolean_query().general_query(i), query); DeSerialization(general_query.boolean_query().general_query(i), query);
...@@ -1006,7 +1009,7 @@ DeSerialization(const ::milvus::grpc::GeneralQuery& general_query, query::Boolea ...@@ -1006,7 +1009,7 @@ DeSerialization(const ::milvus::grpc::GeneralQuery& general_query, query::Boolea
range_query->field_name = query.range_query().field_name(); range_query->field_name = query.range_query().field_name();
range_query->boost = query.range_query().boost(); range_query->boost = query.range_query().boost();
range_query->compare_expr.resize(query.range_query().operand_size()); range_query->compare_expr.resize(query.range_query().operand_size());
for (uint64_t j = 0; j < query.range_query().operand_size(); ++j) { for (int j = 0; j < query.range_query().operand_size(); ++j) {
range_query->compare_expr[j].compare_operator = range_query->compare_expr[j].compare_operator =
query::CompareOperator(query.range_query().operand(j).operator_()); query::CompareOperator(query.range_query().operand(j).operator_());
range_query->compare_expr[j].operand = query.range_query().operand(j).operand(); range_query->compare_expr[j].operand = query.range_query().operand(j).operand();
...@@ -1070,7 +1073,7 @@ GrpcRequestHandler::HybridSearch(::grpc::ServerContext* context, const ::milvus: ...@@ -1070,7 +1073,7 @@ GrpcRequestHandler::HybridSearch(::grpc::ServerContext* context, const ::milvus:
std::vector<std::string> partition_list; std::vector<std::string> partition_list;
partition_list.resize(request->partition_tag_array_size()); partition_list.resize(request->partition_tag_array_size());
for (uint64_t i = 0; i < request->partition_tag_array_size(); ++i) { for (int i = 0; i < request->partition_tag_array_size(); ++i) {
partition_list[i] = request->partition_tag_array(i); partition_list[i] = request->partition_tag_array(i);
} }
......
...@@ -57,7 +57,7 @@ namespace grpc { ...@@ -57,7 +57,7 @@ namespace grpc {
::milvus::grpc::ErrorCode ::milvus::grpc::ErrorCode
ErrorMap(ErrorCode code); ErrorMap(ErrorCode code);
static const char* EXTRA_PARAM_KEY = "params"; extern const char* EXTRA_PARAM_KEY;
class GrpcRequestHandler final : public ::milvus::grpc::MilvusService::Service, public GrpcInterceptorHookHandler { class GrpcRequestHandler final : public ::milvus::grpc::MilvusService::Service, public GrpcInterceptorHookHandler {
public: public:
...@@ -385,7 +385,7 @@ class GrpcRequestHandler final : public ::milvus::grpc::MilvusService::Service, ...@@ -385,7 +385,7 @@ class GrpcRequestHandler final : public ::milvus::grpc::MilvusService::Service,
// const ::milvus::grpc::HDeleteByIDParam* request, // const ::milvus::grpc::HDeleteByIDParam* request,
// ::milvus::grpc::Status* response) override; // ::milvus::grpc::Status* response) override;
GrpcRequestHandler& void
RegisterRequestHandler(const RequestHandler& handler) { RegisterRequestHandler(const RequestHandler& handler) {
request_handler_ = handler; request_handler_ = handler;
} }
......
...@@ -29,8 +29,6 @@ Status ...@@ -29,8 +29,6 @@ Status
CpuChecker::CheckCpuInstructionSet() { CpuChecker::CheckCpuInstructionSet() {
std::vector<std::string> instruction_sets; std::vector<std::string> instruction_sets;
auto& instruction_set_inst = faiss::InstructionSet::GetInstance();
bool support_avx512 = faiss::support_avx512(); bool support_avx512 = faiss::support_avx512();
fiu_do_on("CpuChecker.CheckCpuInstructionSet.not_support_avx512", support_avx512 = false); fiu_do_on("CpuChecker.CheckCpuInstructionSet.not_support_avx512", support_avx512 = false);
if (support_avx512) { if (support_avx512) {
......
...@@ -487,7 +487,7 @@ WebRequestHandler::Search(const std::string& collection_name, const nlohmann::js ...@@ -487,7 +487,7 @@ WebRequestHandler::Search(const std::string& collection_name, const nlohmann::js
auto step = result.id_list_.size() / result.row_num_; auto step = result.id_list_.size() / result.row_num_;
nlohmann::json search_result_json; nlohmann::json search_result_json;
for (size_t i = 0; i < result.row_num_; i++) { for (int64_t i = 0; i < result.row_num_; i++) {
nlohmann::json raw_result_json; nlohmann::json raw_result_json;
for (size_t j = 0; j < step; j++) { for (size_t j = 0; j < step; j++) {
nlohmann::json one_result_json; nlohmann::json one_result_json;
...@@ -541,6 +541,8 @@ WebRequestHandler::ProcessLeafQueryJson(const nlohmann::json& json, milvus::quer ...@@ -541,6 +541,8 @@ WebRequestHandler::ProcessLeafQueryJson(const nlohmann::json& json, milvus::quer
memcpy(term_query->field_value.data(), term_value.data(), term_size * sizeof(double)); memcpy(term_query->field_value.data(), term_value.data(), term_size * sizeof(double));
break; break;
} }
default:
break;
} }
leaf_query->term_query = term_query; leaf_query->term_query = term_query;
...@@ -731,7 +733,7 @@ WebRequestHandler::HybridSearch(const std::string& collection_name, const nlohma ...@@ -731,7 +733,7 @@ WebRequestHandler::HybridSearch(const std::string& collection_name, const nlohma
auto step = result.id_list_.size() / result.row_num_; auto step = result.id_list_.size() / result.row_num_;
nlohmann::json search_result_json; nlohmann::json search_result_json;
for (size_t i = 0; i < result.row_num_; i++) { for (int64_t i = 0; i < result.row_num_; i++) {
nlohmann::json raw_result_json; nlohmann::json raw_result_json;
for (size_t j = 0; j < step; j++) { for (size_t j = 0; j < step; j++) {
nlohmann::json one_result_json; nlohmann::json one_result_json;
...@@ -837,7 +839,6 @@ WebRequestHandler::GetDevices(DevicesDto::ObjectWrapper& devices_dto) { ...@@ -837,7 +839,6 @@ WebRequestHandler::GetDevices(DevicesDto::ObjectWrapper& devices_dto) {
StatusDto::ObjectWrapper StatusDto::ObjectWrapper
WebRequestHandler::GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& advanced_config) { WebRequestHandler::GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& advanced_config) {
Config& config = Config::GetInstance();
std::string reply; std::string reply;
std::string cache_cmd_prefix = "get_config " + std::string(CONFIG_CACHE) + "."; std::string cache_cmd_prefix = "get_config " + std::string(CONFIG_CACHE) + ".";
...@@ -1387,7 +1388,7 @@ WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryPa ...@@ -1387,7 +1388,7 @@ WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryPa
partition_list_dto->count = partitions.size(); partition_list_dto->count = partitions.size();
partition_list_dto->partitions = partition_list_dto->partitions->createShared(); partition_list_dto->partitions = partition_list_dto->partitions->createShared();
if (offset < partitions.size()) { if (offset < (int64_t)(partitions.size())) {
for (int64_t i = offset; i < page_size + offset; i++) { for (int64_t i = offset; i < page_size + offset; i++) {
auto partition_dto = PartitionFieldsDto::createShared(); auto partition_dto = PartitionFieldsDto::createShared();
partition_dto->partition_tag = partitions.at(i).tag_.c_str(); partition_dto->partition_tag = partitions.at(i).tag_.c_str();
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
namespace milvus { namespace milvus {
namespace tracing { namespace tracing {
const char* TRACER_LIBRARY_CONFIG_NAME = "tracer_library";
const char* TRACER_CONFIGURATION_CONFIG_NAME = "tracer_configuration";
const char* TRACE_CONTEXT_HEADER_CONFIG_NAME = "TraceContextHeaderName";
const char* TracerUtil::tracer_context_header_name_; const char* TracerUtil::tracer_context_header_name_;
void void
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
namespace milvus { namespace milvus {
namespace tracing { namespace tracing {
static const char* TRACER_LIBRARY_CONFIG_NAME = "tracer_library"; extern const char* TRACER_LIBRARY_CONFIG_NAME;
static const char* TRACER_CONFIGURATION_CONFIG_NAME = "tracer_configuration"; extern const char* TRACER_CONFIGURATION_CONFIG_NAME;
static const char* TRACE_CONTEXT_HEADER_CONFIG_NAME = "TraceContextHeaderName"; extern const char* TRACE_CONTEXT_HEADER_CONFIG_NAME;
class TracerUtil { class TracerUtil {
public: public:
......
...@@ -44,7 +44,7 @@ namespace server { ...@@ -44,7 +44,7 @@ namespace server {
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
bool bool
CommonUtil::GetSystemMemInfo(uint64_t& total_mem, uint64_t& free_mem) { CommonUtil::GetSystemMemInfo(int64_t& total_mem, int64_t& free_mem) {
struct sysinfo info; struct sysinfo info;
int ret = sysinfo(&info); int ret = sysinfo(&info);
total_mem = info.totalram; total_mem = info.totalram;
...@@ -180,9 +180,9 @@ CommonUtil::GetFileName(std::string filename) { ...@@ -180,9 +180,9 @@ CommonUtil::GetFileName(std::string filename) {
std::string std::string
CommonUtil::GetExePath() { CommonUtil::GetExePath() {
const size_t buf_len = 1024; const int64_t buf_len = 1024;
char buf[buf_len]; char buf[buf_len];
ssize_t cnt = readlink("/proc/self/exe", buf, buf_len); int64_t cnt = readlink("/proc/self/exe", buf, buf_len);
fiu_do_on("CommonUtil.GetExePath.readlink_fail", cnt = -1); fiu_do_on("CommonUtil.GetExePath.readlink_fail", cnt = -1);
if (cnt < 0 || cnt >= buf_len) { if (cnt < 0 || cnt >= buf_len) {
return ""; return "";
......
...@@ -22,7 +22,7 @@ namespace server { ...@@ -22,7 +22,7 @@ namespace server {
class CommonUtil { class CommonUtil {
public: public:
static bool static bool
GetSystemMemInfo(uint64_t& total_mem, uint64_t& free_mem); GetSystemMemInfo(int64_t& total_mem, int64_t& free_mem);
static bool static bool
GetSystemAvailableThreads(int64_t& thread_count); GetSystemAvailableThreads(int64_t& thread_count);
......
...@@ -54,14 +54,13 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -54,14 +54,13 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
position += 2; position += 2;
} }
} }
int ret;
std::string m(std::string(dir) + "/" + s); std::string m(std::string(dir) + "/" + s);
s = m; s = m;
try { try {
switch (level) { switch (level) {
case el::Level::Debug: { case el::Level::Debug: {
s.append("." + std::to_string(++debug_idx)); s.append("." + std::to_string(++debug_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && debug_idx - logs_delete_exceeds > 0) { if (enable_log_delete && debug_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(debug_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(debug_idx - logs_delete_exceeds);
// std::cout << "remote " << to_delete << std::endl; // std::cout << "remote " << to_delete << std::endl;
...@@ -71,7 +70,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -71,7 +70,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
} }
case el::Level::Warning: { case el::Level::Warning: {
s.append("." + std::to_string(++warning_idx)); s.append("." + std::to_string(++warning_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && warning_idx - logs_delete_exceeds > 0) { if (enable_log_delete && warning_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(warning_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(warning_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete); boost::filesystem::remove(to_delete);
...@@ -80,7 +79,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -80,7 +79,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
} }
case el::Level::Trace: { case el::Level::Trace: {
s.append("." + std::to_string(++trace_idx)); s.append("." + std::to_string(++trace_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && trace_idx - logs_delete_exceeds > 0) { if (enable_log_delete && trace_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(trace_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(trace_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete); boost::filesystem::remove(to_delete);
...@@ -89,7 +88,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -89,7 +88,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
} }
case el::Level::Error: { case el::Level::Error: {
s.append("." + std::to_string(++error_idx)); s.append("." + std::to_string(++error_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && error_idx - logs_delete_exceeds > 0) { if (enable_log_delete && error_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(error_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(error_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete); boost::filesystem::remove(to_delete);
...@@ -98,7 +97,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -98,7 +97,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
} }
case el::Level::Fatal: { case el::Level::Fatal: {
s.append("." + std::to_string(++fatal_idx)); s.append("." + std::to_string(++fatal_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && fatal_idx - logs_delete_exceeds > 0) { if (enable_log_delete && fatal_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(fatal_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(fatal_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete); boost::filesystem::remove(to_delete);
...@@ -107,7 +106,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) { ...@@ -107,7 +106,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
} }
default: { default: {
s.append("." + std::to_string(++global_idx)); s.append("." + std::to_string(++global_idx));
ret = rename(m.c_str(), s.c_str()); rename(m.c_str(), s.c_str());
if (enable_log_delete && global_idx - logs_delete_exceeds > 0) { if (enable_log_delete && global_idx - logs_delete_exceeds > 0) {
std::string to_delete = m + "." + std::to_string(global_idx - logs_delete_exceeds); std::string to_delete = m + "." + std::to_string(global_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete); boost::filesystem::remove(to_delete);
......
...@@ -216,7 +216,7 @@ ValidationUtil::ValidateIndexParams(const milvus::json& index_params, ...@@ -216,7 +216,7 @@ ValidationUtil::ValidateIndexParams(const milvus::json& index_params,
// special check for 'm' parameter // special check for 'm' parameter
std::vector<int64_t> resset; std::vector<int64_t> resset;
milvus::knowhere::IVFPQConfAdapter::GetValidMList(collection_schema.dimension_, resset); milvus::knowhere::IVFPQConfAdapter::GetValidMList(collection_schema.dimension_, resset);
int64_t m_value = index_params[index_params, knowhere::IndexParams::m]; int64_t m_value = index_params[knowhere::IndexParams::m];
if (resset.empty()) { if (resset.empty()) {
std::string msg = "Invalid collection dimension, unable to get reasonable values for 'm'"; std::string msg = "Invalid collection dimension, unable to get reasonable values for 'm'";
LOG_SERVER_ERROR_ << msg; LOG_SERVER_ERROR_ << msg;
...@@ -504,7 +504,7 @@ ValidationUtil::ValidateGpuIndex(int32_t gpu_index) { ...@@ -504,7 +504,7 @@ ValidationUtil::ValidateGpuIndex(int32_t gpu_index) {
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
Status Status
ValidationUtil::GetGpuMemory(int32_t gpu_index, size_t& memory) { ValidationUtil::GetGpuMemory(int32_t gpu_index, int64_t& memory) {
fiu_return_on("ValidationUtil.GetGpuMemory.return_error", Status(SERVER_UNEXPECTED_ERROR, "")); fiu_return_on("ValidationUtil.GetGpuMemory.return_error", Status(SERVER_UNEXPECTED_ERROR, ""));
cudaDeviceProp deviceProp; cudaDeviceProp deviceProp;
......
...@@ -72,7 +72,7 @@ class ValidationUtil { ...@@ -72,7 +72,7 @@ class ValidationUtil {
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
static Status static Status
GetGpuMemory(int32_t gpu_index, size_t& memory); GetGpuMemory(int32_t gpu_index, int64_t& memory);
#endif #endif
static Status static Status
......
...@@ -52,10 +52,6 @@ TEST_F(ConfigTest, CONFIG_TEST) { ...@@ -52,10 +52,6 @@ TEST_F(ConfigTest, CONFIG_TEST) {
milvus::server::ConfigNode& root_config = config_mgr->GetRootNode(); milvus::server::ConfigNode& root_config = config_mgr->GetRootNode();
milvus::server::ConfigNode& server_config = root_config.GetChild("server_config"); milvus::server::ConfigNode& server_config = root_config.GetChild("server_config");
milvus::server::ConfigNode& db_config = root_config.GetChild("db_config");
milvus::server::ConfigNode& metric_config = root_config.GetChild("metric_config");
milvus::server::ConfigNode& cache_config = root_config.GetChild("cache_config");
milvus::server::ConfigNode& wal_config = root_config.GetChild("wal_config");
milvus::server::ConfigNode invalid_config = root_config.GetChild("invalid_config"); milvus::server::ConfigNode invalid_config = root_config.GetChild("invalid_config");
const auto& im_config_mgr = *static_cast<milvus::server::YamlConfigMgr*>(config_mgr); const auto& im_config_mgr = *static_cast<milvus::server::YamlConfigMgr*>(config_mgr);
......
...@@ -65,7 +65,7 @@ TEST(UtilTest, SIGNAL_TEST) { ...@@ -65,7 +65,7 @@ TEST(UtilTest, SIGNAL_TEST) {
} }
TEST(UtilTest, COMMON_TEST) { TEST(UtilTest, COMMON_TEST) {
uint64_t total_mem = 0, free_mem = 0; int64_t total_mem = 0, free_mem = 0;
milvus::server::CommonUtil::GetSystemMemInfo(total_mem, free_mem); milvus::server::CommonUtil::GetSystemMemInfo(total_mem, free_mem);
ASSERT_GT(total_mem, 0); ASSERT_GT(total_mem, 0);
ASSERT_GT(free_mem, 0); ASSERT_GT(free_mem, 0);
...@@ -685,7 +685,7 @@ TEST(ValidationUtilTest, VALIDATE_GPU_TEST) { ...@@ -685,7 +685,7 @@ TEST(ValidationUtilTest, VALIDATE_GPU_TEST) {
ASSERT_NE(milvus::server::ValidationUtil::ValidateGpuIndex(0).code(), milvus::SERVER_SUCCESS); ASSERT_NE(milvus::server::ValidationUtil::ValidateGpuIndex(0).code(), milvus::SERVER_SUCCESS);
fiu_disable("ValidationUtil.ValidateGpuIndex.get_device_count_fail"); fiu_disable("ValidationUtil.ValidateGpuIndex.get_device_count_fail");
size_t memory = 0; int64_t memory = 0;
ASSERT_EQ(milvus::server::ValidationUtil::GetGpuMemory(0, memory).code(), milvus::SERVER_SUCCESS); ASSERT_EQ(milvus::server::ValidationUtil::GetGpuMemory(0, memory).code(), milvus::SERVER_SUCCESS);
ASSERT_NE(milvus::server::ValidationUtil::GetGpuMemory(100, memory).code(), milvus::SERVER_SUCCESS); ASSERT_NE(milvus::server::ValidationUtil::GetGpuMemory(100, memory).code(), milvus::SERVER_SUCCESS);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册