提交 2f987398 编写于 作者: C Cai Yudong 提交者: JinHai-CN

clean compile warning (#2380)

Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>
上级 afac02ca
......@@ -47,7 +47,7 @@ DefaultVectorIndexFormat::read_internal(const storage::FSHandlerPtr& fs_ptr, con
return nullptr;
}
size_t rp = 0;
int64_t rp = 0;
fs_ptr->reader_ptr_->seekg(0);
int32_t current_type = 0;
......
......@@ -398,19 +398,19 @@ Config::ValidateConfig() {
STATUS_CHECK(GetLogsTraceEnable(trace_enable));
bool debug_enable;
STATUS_CHECK(GetLogsDebugEnable(trace_enable));
STATUS_CHECK(GetLogsDebugEnable(debug_enable));
bool info_enable;
STATUS_CHECK(GetLogsInfoEnable(trace_enable));
STATUS_CHECK(GetLogsInfoEnable(info_enable));
bool warning_enable;
STATUS_CHECK(GetLogsWarningEnable(trace_enable));
STATUS_CHECK(GetLogsWarningEnable(warning_enable));
bool error_enable;
STATUS_CHECK(GetLogsErrorEnable(trace_enable));
STATUS_CHECK(GetLogsErrorEnable(error_enable));
bool fatal_enable;
STATUS_CHECK(GetLogsFatalEnable(trace_enable));
STATUS_CHECK(GetLogsFatalEnable(fatal_enable));
std::string logs_path;
STATUS_CHECK(GetLogsPath(logs_path));
......@@ -1252,9 +1252,9 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) {
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);
if (static_cast<uint64_t>(cpu_cache_capacity) >= total_mem) {
if (cpu_cache_capacity >= total_mem) {
std::string msg = "Invalid cpu cache capacity: " + value +
". Possible reason: cache_config.cpu_cache_capacity exceeds system memory.";
return Status(SERVER_INVALID_ARGUMENT, msg);
......@@ -1314,7 +1314,7 @@ Config::CheckCacheConfigInsertBufferSize(const std::string& value) {
std::string str = GetConfigStr(CONFIG_CACHE, CONFIG_CACHE_CPU_CACHE_CAPACITY, "0");
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);
if (buffer_size + cache_size >= total_mem) {
std::string msg = "Invalid insert buffer size: " + value +
......@@ -1423,7 +1423,7 @@ Config::CheckGpuResourceConfigCacheCapacity(const std::string& value) {
STATUS_CHECK(GetGpuResourceConfigBuildIndexResources(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()) {
std::string msg = "Fail to get GPU memory for GPU device: " + std::to_string(gpu_id);
return Status(SERVER_UNEXPECTED_ERROR, msg);
......
......@@ -2264,7 +2264,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
// else set file type to RAW, no need to build index
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::RAW;
} else {
......
......@@ -32,7 +32,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG
meta::SegmentsSchema& files = files_holder.HoldFiles();
for (meta::SegmentsSchema::reverse_iterator iter = files.rbegin(); iter != files.rend(); ++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
continue;
}
......@@ -60,7 +60,7 @@ MergeAdaptiveStrategy::RegroupFiles(meta::FilesHolder& files_holder, MergeFilesG
int64_t sum_size = 0;
for (auto iter = sort_files.begin(); iter != sort_files.end();) {
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);
sum_size += file.file_size_;
iter = sort_files.erase(iter);
......
......@@ -71,7 +71,7 @@ MergeTask::Execute() {
auto file_schema = file;
file_schema.file_type_ = meta::SegmentSchema::TO_DELETE;
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_) {
break;
}
......@@ -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
// else set file type to RAW, no need to build index
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::RAW;
} else {
......
......@@ -1845,7 +1845,7 @@ MySQLMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& files
for (auto& resRow : res) {
SegmentSchema collection_file;
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
}
......@@ -3001,6 +3001,7 @@ MySQLMetaImpl::DescribeHybridCollection(CollectionSchema& collection_schema, hyb
Status
MySQLMetaImpl::CreateHybridCollectionFile(milvus::engine::meta::SegmentSchema& file_schema) {
return Status::OK();
}
} // namespace meta
......
......@@ -1246,7 +1246,7 @@ SqliteMetaImpl::FilesToMerge(const std::string& collection_id, FilesHolder& file
for (auto& file : selected) {
SegmentSchema collection_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
}
......
......@@ -614,7 +614,7 @@ bool
MXLogBuffer::ResetWriteLsn(uint64_t 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);
if (old_file_no == mxlog_buffer_writer_.file_no) {
LOG_WAL_DEBUG_ << "file No. is not changed";
......
......@@ -170,7 +170,7 @@ SystemInfo::CPUCorePercent() {
std::vector<int64_t> cur_total_time_array = getTotalCpuTime(cur_work_time_array);
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 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);
......@@ -254,7 +254,7 @@ SystemInfo::GPUMemoryTotal() {
#ifdef MILVUS_GPU_VERSION
nvmlMemory_t nvmlMemory;
for (int i = 0; i < num_device_; ++i) {
for (uint32_t i = 0; i < num_device_; ++i) {
nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device);
nvmlDeviceGetMemoryInfo(device, &nvmlMemory);
......@@ -273,7 +273,7 @@ SystemInfo::GPUTemperature() {
std::vector<int64_t> result;
#ifdef MILVUS_GPU_VERSION
for (int i = 0; i < num_device_; i++) {
for (uint32_t i = 0; i < num_device_; i++) {
nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device);
unsigned int temp;
......@@ -342,7 +342,7 @@ SystemInfo::GPUMemoryUsed() {
#ifdef MILVUS_GPU_VERSION
nvmlMemory_t nvmlMemory;
for (int i = 0; i < num_device_; ++i) {
for (uint32_t i = 0; i < num_device_; ++i) {
nvmlDevice_t device;
nvmlDeviceGetHandleByIndex(i, &device);
nvmlDeviceGetMemoryInfo(device, &nvmlMemory);
......@@ -355,8 +355,6 @@ SystemInfo::GPUMemoryUsed() {
std::pair<int64_t, int64_t>
SystemInfo::Octets() {
pid_t pid = getpid();
// const std::string filename = "/proc/"+std::to_string(pid)+"/net/netstat";
const std::string filename = "/proc/net/netstat";
std::ifstream file(filename);
std::string lastline = "";
......
......@@ -204,7 +204,7 @@ PrometheusMetrics::CPUCoreUsagePercentSet() {
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)}});
core_percent.Set(cpu_core_percent[i]);
}
......@@ -218,7 +218,7 @@ PrometheusMetrics::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)}});
gpu_temp.Set(GPU_temperatures[i]);
}
......@@ -233,7 +233,7 @@ PrometheusMetrics::CPUTemperature() {
std::vector<float> CPU_temperatures = server::SystemInfo::GetInstance().CPUTemperature();
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.size();
......
......@@ -84,6 +84,8 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) {
binary_query->relation = QueryRelation::OR;
return GenBinaryQuery(query, binary_query);
}
default:
return Status::OK();
}
}
}
......@@ -94,15 +96,15 @@ GenBinaryQuery(BooleanQueryPtr query, BinaryQueryPtr& binary_query) {
switch (bc->getOccur()) {
case Occur::MUST: {
binary_query->relation = QueryRelation::AND;
Status s = GenBinaryQuery(bc, binary_query);
return s;
return GenBinaryQuery(bc, binary_query);
}
case Occur::MUST_NOT:
case Occur::SHOULD: {
binary_query->relation = QueryRelation::OR;
Status s = GenBinaryQuery(bc, binary_query);
return s;
return GenBinaryQuery(bc, binary_query);
}
default:
return Status::OK();
}
}
......
......@@ -43,7 +43,7 @@ ToString(ResourceType type) {
}
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
task_table_.RegisterSubscriber([&] {
if (subscriber_) {
......
......@@ -56,7 +56,7 @@ FaissFlatPass::Run(const TaskPtr& task) {
if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissFlatPass: gpu disable, specify cpu to search!", "search", 0);
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!",
"search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
......@@ -57,7 +57,7 @@ FaissIVFFlatPass::Run(const TaskPtr& task) {
if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFFlatPass: gpu disable, specify cpu to search!", "search", 0);
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!",
"search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
......@@ -59,7 +59,7 @@ FaissIVFPQPass::Run(const TaskPtr& task) {
if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFPQPass: gpu disable, specify cpu to search!", "search", 0);
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!",
"search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
......@@ -57,7 +57,7 @@ FaissIVFSQ8HPass::Run(const TaskPtr& task) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8HPass: gpu disable, specify cpu to search!", "search", 0);
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!",
"search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
......@@ -57,7 +57,7 @@ FaissIVFSQ8Pass::Run(const TaskPtr& task) {
if (!gpu_enable_) {
LOG_SERVER_DEBUG_ << LogOut("[%s][%d] FaissIVFSQ8Pass: gpu disable, specify cpu to search!", "search", 0);
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!",
"search", 0);
res_ptr = ResMgrInst::GetInstance()->GetResource("cpu");
......
......@@ -125,7 +125,6 @@ XBuildIndexTask::Execute() {
}
std::string location = file_->location_;
EngineType engine_type = (EngineType)file_->engine_type_;
std::shared_ptr<engine::ExecutionEngine> index;
// step 1: create collection file
......
......@@ -321,8 +321,8 @@ XSearchTask::Execute() {
return;
}
double span = rc.RecordSection(hdr + ", do search");
// search_job->AccumSearchCost(span);
// double span = rc.RecordSection(hdr + ", do search");
// search_job->AccumSearchCost(span);
// step 3: pick up topk result
auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk;
......@@ -346,8 +346,8 @@ XSearchTask::Execute() {
search_job->GetResultIds(), search_job->GetResultDistances());
}
span = rc.RecordSection(hdr + ", reduce topk");
// search_job->AccumReduceCost(span);
// span = rc.RecordSection(hdr + ", reduce topk");
// search_job->AccumReduceCost(span);
} catch (std::exception& ex) {
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
......
......@@ -132,7 +132,7 @@ Attr::Erase(std::vector<int32_t>& offsets) {
auto loop_size = uids_.size();
for (size_t i = 0; i < loop_size;) {
while (skip != offsets.cend() && i == *skip) {
while (skip != offsets.cend() && i == (size_t)(*skip)) {
++i;
++skip;
}
......
......@@ -289,7 +289,7 @@ SegmentWriter::Merge(const std::string& dir_to_merge, const std::string& name) {
}
SegmentPtr 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");
......
......@@ -87,7 +87,7 @@ Vectors::Erase(std::vector<int32_t>& offsets) {
auto loop_size = uids_.size();
for (size_t i = 0; i < loop_size;) {
while (i == *skip && skip != offsets.cend()) {
while (i == (size_t)(*skip) && skip != offsets.cend()) {
++i;
++skip;
}
......
......@@ -291,6 +291,7 @@ RequestHandler::DescribeHybridCollection(const std::shared_ptr<Context>& context
Status
RequestHandler::HasHybridCollection(const std::shared_ptr<Context>& context, std::string& collection_name,
bool& has_collection) {
return Status::OK();
}
Status
......
......@@ -132,7 +132,7 @@ InsertEntityRequest::OnExecute() {
// TODO(yukun): check dimension and metric_type
// 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;
entity.entity_count_ = row_num_;
......
......@@ -68,7 +68,7 @@ InsertRequest::OnExecute() {
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_.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.";
LOG_SERVER_ERROR_ << LogOut("[%s][%ld] Invalid id array: %s", "insert", 0, msg.c_str());
return Status(SERVER_ILLEGAL_VECTOR_ID, msg);
......
......@@ -32,6 +32,8 @@ namespace milvus {
namespace server {
namespace grpc {
const char* EXTRA_PARAM_KEY = "params";
::milvus::grpc::ErrorCode
ErrorMap(ErrorCode code) {
static const std::map<ErrorCode, ::milvus::grpc::ErrorCode> code_map = {
......@@ -1104,7 +1106,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, uint64_t>> vector_dimensions;
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()) {
auto vector_dimension =
std::make_pair(request->fields(i).name(), request->fields(i).type().vector_param().dimension());
......@@ -1140,6 +1142,7 @@ GrpcRequestHandler::DescribeHybridCollection(::grpc::ServerContext* context,
LOG_SERVER_INFO_ << LogOut("Request [%s] %s begin.", GetContext(context)->RequestID().c_str(), __func__);
CHECK_NULLPTR_RETURN(request);
LOG_SERVER_INFO_ << LogOut("Request [%s] %s end.", GetContext(context)->RequestID().c_str(), __func__);
return ::grpc::Status::OK;
}
::grpc::Status
......@@ -1550,7 +1553,7 @@ GrpcRequestHandler::HybridSearch(::grpc::ServerContext* context, const ::milvus:
std::vector<std::string> partition_list;
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);
}
......
......@@ -57,7 +57,7 @@ namespace grpc {
::milvus::grpc::ErrorCode
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 {
public:
......@@ -390,7 +390,7 @@ class GrpcRequestHandler final : public ::milvus::grpc::MilvusService::Service,
// const ::milvus::grpc::HDeleteByIDParam* request,
// ::milvus::grpc::Status* response) override;
GrpcRequestHandler&
void
RegisterRequestHandler(const RequestHandler& handler) {
request_handler_ = handler;
}
......
......@@ -29,8 +29,6 @@ Status
CpuChecker::CheckCpuInstructionSet() {
std::vector<std::string> instruction_sets;
auto& instruction_set_inst = faiss::InstructionSet::GetInstance();
bool support_avx512 = faiss::support_avx512();
fiu_do_on("CpuChecker.CheckCpuInstructionSet.not_support_avx512", support_avx512 = false);
if (support_avx512) {
......
......@@ -487,7 +487,7 @@ WebRequestHandler::Search(const std::string& collection_name, const nlohmann::js
auto step = result.id_list_.size() / result.row_num_;
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;
for (size_t j = 0; j < step; j++) {
nlohmann::json one_result_json;
......@@ -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));
break;
}
default:
break;
}
leaf_query->term_query = term_query;
......@@ -848,7 +850,7 @@ WebRequestHandler::HybridSearch(const std::string& collection_name, const nlohma
auto step = result.result_ids_.size() / result.row_num_;
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;
for (size_t j = 0; j < step; j++) {
nlohmann::json one_result_json;
......@@ -990,7 +992,6 @@ WebRequestHandler::GetDevices(DevicesDto::ObjectWrapper& devices_dto) {
StatusDto::ObjectWrapper
WebRequestHandler::GetAdvancedConfig(AdvancedConfigDto::ObjectWrapper& advanced_config) {
Config& config = Config::GetInstance();
std::string reply;
std::string cache_cmd_prefix = "get_config " + std::string(CONFIG_CACHE) + ".";
......@@ -1540,7 +1541,7 @@ WebRequestHandler::ShowPartitions(const OString& collection_name, const OQueryPa
partition_list_dto->count = partitions.size();
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++) {
auto partition_dto = PartitionFieldsDto::createShared();
partition_dto->partition_tag = partitions.at(i).tag_.c_str();
......
......@@ -22,6 +22,10 @@
namespace milvus {
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_;
void
......
......@@ -16,9 +16,9 @@
namespace milvus {
namespace tracing {
static const char* TRACER_LIBRARY_CONFIG_NAME = "tracer_library";
static const char* TRACER_CONFIGURATION_CONFIG_NAME = "tracer_configuration";
static const char* TRACE_CONTEXT_HEADER_CONFIG_NAME = "TraceContextHeaderName";
extern const char* TRACER_LIBRARY_CONFIG_NAME;
extern const char* TRACER_CONFIGURATION_CONFIG_NAME;
extern const char* TRACE_CONTEXT_HEADER_CONFIG_NAME;
class TracerUtil {
public:
......
......@@ -44,7 +44,7 @@ namespace server {
namespace fs = boost::filesystem;
bool
CommonUtil::GetSystemMemInfo(uint64_t& total_mem, uint64_t& free_mem) {
CommonUtil::GetSystemMemInfo(int64_t& total_mem, int64_t& free_mem) {
struct sysinfo info;
int ret = sysinfo(&info);
total_mem = info.totalram;
......@@ -180,9 +180,9 @@ CommonUtil::GetFileName(std::string filename) {
std::string
CommonUtil::GetExePath() {
const size_t buf_len = 1024;
const int64_t buf_len = 1024;
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);
if (cnt < 0 || cnt >= buf_len) {
return "";
......
......@@ -22,7 +22,7 @@ namespace server {
class CommonUtil {
public:
static bool
GetSystemMemInfo(uint64_t& total_mem, uint64_t& free_mem);
GetSystemMemInfo(int64_t& total_mem, int64_t& free_mem);
static bool
GetSystemAvailableThreads(int64_t& thread_count);
......
......@@ -54,14 +54,13 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
position += 2;
}
}
int ret;
std::string m(std::string(dir) + "/" + s);
s = m;
try {
switch (level) {
case el::Level::Debug: {
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) {
std::string to_delete = m + "." + std::to_string(debug_idx - logs_delete_exceeds);
// std::cout << "remote " << to_delete << std::endl;
......@@ -71,7 +70,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
}
case el::Level::Warning: {
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) {
std::string to_delete = m + "." + std::to_string(warning_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete);
......@@ -80,7 +79,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
}
case el::Level::Trace: {
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) {
std::string to_delete = m + "." + std::to_string(trace_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete);
......@@ -89,7 +88,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
}
case el::Level::Error: {
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) {
std::string to_delete = m + "." + std::to_string(error_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete);
......@@ -98,7 +97,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
}
case el::Level::Fatal: {
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) {
std::string to_delete = m + "." + std::to_string(fatal_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete);
......@@ -107,7 +106,7 @@ RolloutHandler(const char* filename, std::size_t size, el::Level level) {
}
default: {
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) {
std::string to_delete = m + "." + std::to_string(global_idx - logs_delete_exceeds);
boost::filesystem::remove(to_delete);
......
......@@ -216,7 +216,7 @@ ValidationUtil::ValidateIndexParams(const milvus::json& index_params,
// special check for 'm' parameter
std::vector<int64_t> 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()) {
std::string msg = "Invalid collection dimension, unable to get reasonable values for 'm'";
LOG_SERVER_ERROR_ << msg;
......@@ -504,7 +504,7 @@ ValidationUtil::ValidateGpuIndex(int32_t gpu_index) {
#ifdef MILVUS_GPU_VERSION
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, ""));
cudaDeviceProp deviceProp;
......
......@@ -72,7 +72,7 @@ class ValidationUtil {
#ifdef MILVUS_GPU_VERSION
static Status
GetGpuMemory(int32_t gpu_index, size_t& memory);
GetGpuMemory(int32_t gpu_index, int64_t& memory);
#endif
static Status
......
......@@ -52,10 +52,6 @@ TEST_F(ConfigTest, CONFIG_TEST) {
milvus::server::ConfigNode& root_config = config_mgr->GetRootNode();
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");
const auto& im_config_mgr = *static_cast<milvus::server::YamlConfigMgr*>(config_mgr);
......
......@@ -65,7 +65,7 @@ TEST(UtilTest, SIGNAL_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);
ASSERT_GT(total_mem, 0);
ASSERT_GT(free_mem, 0);
......@@ -685,7 +685,7 @@ TEST(ValidationUtilTest, VALIDATE_GPU_TEST) {
ASSERT_NE(milvus::server::ValidationUtil::ValidateGpuIndex(0).code(), milvus::SERVER_SUCCESS);
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_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.
先完成此消息的编辑!
想要评论请 注册