From d1251fb0c1e2d07d3d39c0b73800fa1b472fa1f7 Mon Sep 17 00:00:00 2001 From: starlord Date: Sat, 28 Sep 2019 15:00:26 +0800 Subject: [PATCH] format code by clang-tidy Former-commit-id: 437b1fff79da965b8aafce026c8be4f9d582c909 --- .clang-tidy | 4 ++- cpp/build.sh | 16 +++++------ cpp/src/cache/CpuCacheMgr.h | 2 +- cpp/src/core/test/kdtree.cpp | 2 +- cpp/src/core/test/test_ivf.cpp | 2 +- cpp/src/core/test/test_kdt.cpp | 2 +- .../SPTAG/AnnService/src/Core/MetadataSet.cpp | 4 +-- cpp/src/db/DBImpl.cpp | 16 ++++++----- cpp/src/db/Utils.cpp | 2 +- cpp/src/db/engine/ExecutionEngineImpl.cpp | 3 +- cpp/src/db/meta/MySQLConnectionPool.cpp | 2 +- cpp/src/db/meta/MySQLMetaImpl.cpp | 15 +++++----- cpp/src/db/meta/SqliteMetaImpl.cpp | 4 +-- cpp/src/metrics/SystemInfo.cpp | 28 ++++++++++++------- cpp/src/scheduler/ResourceMgr.cpp | 2 +- cpp/src/scheduler/ResourceMgr.h | 4 +-- cpp/src/scheduler/SchedInst.cpp | 2 +- cpp/src/scheduler/Scheduler.cpp | 2 +- cpp/src/scheduler/Scheduler.h | 2 +- cpp/src/scheduler/TaskCreator.cpp | 2 +- cpp/src/scheduler/TaskTable.h | 4 +-- .../scheduler/action/PushTaskToNeighbour.cpp | 2 +- cpp/src/scheduler/resource/Node.h | 2 +- cpp/src/scheduler/resource/Resource.h | 6 ++-- cpp/src/scheduler/task/SearchTask.h | 2 +- cpp/src/sdk/examples/grpcsimple/main.cpp | 8 +++--- cpp/src/sdk/grpc/ClientProxy.cpp | 12 +++----- cpp/src/server/grpc_impl/GrpcRequestTask.cpp | 2 +- cpp/unittest/db/db_tests.cpp | 2 +- cpp/unittest/server/cache_test.cpp | 2 +- 30 files changed, 83 insertions(+), 75 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 1f7850ef..1695fa66 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -18,8 +18,10 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*' # 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 ')$' -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 +ChainedConditionalReturn: 1 +ChainedConditionalAssignment: 1 CheckOptions: - key: google-readability-braces-around-statements.ShortStatementLines value: '1' diff --git a/cpp/build.sh b/cpp/build.sh index 69fd4f0f..deda35ab 100755 --- a/cpp/build.sh +++ b/cpp/build.sh @@ -111,14 +111,14 @@ if [[ ${RUN_CPPLINT} == "ON" ]]; then exit 1 fi echo "clang-format check passed!" -# -# # clang-tidy check -# make check-clang-tidy -# if [ $? -ne 0 ]; then -# echo "ERROR! clang-tidy check failed" -# exit 1 -# fi -# echo "clang-tidy check passed!" + + # clang-tidy check + make check-clang-tidy + if [ $? -ne 0 ]; then + echo "ERROR! clang-tidy check failed" + exit 1 + fi + echo "clang-tidy check passed!" else # compile and build make -j 4 || exit 1 diff --git a/cpp/src/cache/CpuCacheMgr.h b/cpp/src/cache/CpuCacheMgr.h index fbc4f6df..ad6087de 100644 --- a/cpp/src/cache/CpuCacheMgr.h +++ b/cpp/src/cache/CpuCacheMgr.h @@ -32,7 +32,7 @@ class CpuCacheMgr : public CacheMgr { CpuCacheMgr(); public: - // TODO: use smart pointer instead + // TODO(myh): use smart pointer instead static CpuCacheMgr* GetInstance(); diff --git a/cpp/src/core/test/kdtree.cpp b/cpp/src/core/test/kdtree.cpp index 0b63e657..b3de8f34 100644 --- a/cpp/src/core/test/kdtree.cpp +++ b/cpp/src/core/test/kdtree.cpp @@ -44,7 +44,7 @@ DatasetPtr generate_queries(int64_t n, int64_t d, int64_t k, int64_t base) { size_t size = sizeof(float) * n * d; auto v = (float *) malloc(size); - // TODO: check malloc + // TODO(lxj): check malloc for (auto i = 0; i < n; ++i) { for (auto j = 0; j < d; ++j) { v[i * d + j] = float(base + i); diff --git a/cpp/src/core/test/test_ivf.cpp b/cpp/src/core/test/test_ivf.cpp index 1eeb1f98..7196fe15 100644 --- a/cpp/src/core/test/test_ivf.cpp +++ b/cpp/src/core/test/test_ivf.cpp @@ -694,4 +694,4 @@ TEST_F(GPURESTEST, TrainAndSearch) { -// TODO(linxj): Add exception test +// TODO(lxj): Add exception test diff --git a/cpp/src/core/test/test_kdt.cpp b/cpp/src/core/test/test_kdt.cpp index fce233ac..3780f655 100644 --- a/cpp/src/core/test/test_kdt.cpp +++ b/cpp/src/core/test/test_kdt.cpp @@ -85,7 +85,7 @@ void PrintResult(const DatasetPtr &result, 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) { assert(!xb.empty()); diff --git a/cpp/src/core/thirdparty/SPTAG/AnnService/src/Core/MetadataSet.cpp b/cpp/src/core/thirdparty/SPTAG/AnnService/src/Core/MetadataSet.cpp index 2eefcea6..a5d410ce 100644 --- a/cpp/src/core/thirdparty/SPTAG/AnnService/src/Core/MetadataSet.cpp +++ b/cpp/src/core/thirdparty/SPTAG/AnnService/src/Core/MetadataSet.cpp @@ -179,13 +179,13 @@ FileMetadataSet::SaveMetadata(const std::string& p_metaFile, const std::string& ErrorCode FileMetadataSet::SaveMetadataToMemory(void **pGraphMemFile, int64_t &len) { - // TODO: serialize file to mem? + // TODO(lxj): serialize file to mem? return ErrorCode::Fail; } ErrorCode FileMetadataSet::LoadMetadataFromMemory(void *pGraphMemFile) { - // TODO: not support yet + // TODO(lxj): not support yet return ErrorCode::Fail; } diff --git a/cpp/src/db/DBImpl.cpp b/cpp/src/db/DBImpl.cpp index 2e6955a8..10cdf60b 100644 --- a/cpp/src/db/DBImpl.cpp +++ b/cpp/src/db/DBImpl.cpp @@ -242,7 +242,7 @@ DBImpl::GetTableRowCount(const std::string& table_id, uint64_t& row_count) { } 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"; if (shutting_down_.load(std::memory_order_acquire)) { 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; 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::duration_cast(end_time - start_time); // 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 other type, wait NEW/RAW/NEW_MERGE/NEW_INDEX/TO_INDEX files converted to INDEX files std::vector file_types; - if (index.engine_type_ == (int)EngineType::FAISS_IDMAP) { + if (index.engine_type_ == static_cast(EngineType::FAISS_IDMAP)) { file_types = { - (int)meta::TableFileSchema::NEW, (int)meta::TableFileSchema::NEW_MERGE, + static_cast(meta::TableFileSchema::NEW), static_cast(meta::TableFileSchema::NEW_MERGE), }; } else { file_types = { - (int)meta::TableFileSchema::RAW, (int)meta::TableFileSchema::NEW, - (int)meta::TableFileSchema::NEW_MERGE, (int)meta::TableFileSchema::NEW_INDEX, - (int)meta::TableFileSchema::TO_INDEX, + static_cast(meta::TableFileSchema::RAW), + static_cast(meta::TableFileSchema::NEW), + static_cast(meta::TableFileSchema::NEW_MERGE), + static_cast(meta::TableFileSchema::NEW_INDEX), + static_cast(meta::TableFileSchema::TO_INDEX), }; } diff --git a/cpp/src/db/Utils.cpp b/cpp/src/db/Utils.cpp index 2055ff39..d9e500f8 100644 --- a/cpp/src/db/Utils.cpp +++ b/cpp/src/db/Utils.cpp @@ -228,7 +228,7 @@ ParseMetaUri(const std::string& uri, MetaUriInfo& info) { info.port_ = pieces_match[5].str(); info.db_name_ = pieces_match[6].str(); - // TODO: verify host, port... + // TODO(myh): verify host, port... } else { return Status(DB_INVALID_META_URI, "Invalid meta uri: " + uri); } diff --git a/cpp/src/db/engine/ExecutionEngineImpl.cpp b/cpp/src/db/engine/ExecutionEngineImpl.cpp index 52b4992d..2a239ddb 100644 --- a/cpp/src/db/engine/ExecutionEngineImpl.cpp +++ b/cpp/src/db/engine/ExecutionEngineImpl.cpp @@ -342,8 +342,9 @@ Status ExecutionEngineImpl::Init() { server::Config& config = server::Config::GetInstance(); Status s = config.GetDBConfigBuildIndexGPU(gpu_num_); - if (!s.ok()) + if (!s.ok()) { return s; + } return Status::OK(); } diff --git a/cpp/src/db/meta/MySQLConnectionPool.cpp b/cpp/src/db/meta/MySQLConnectionPool.cpp index 2d09874d..6c931201 100644 --- a/cpp/src/db/meta/MySQLConnectionPool.cpp +++ b/cpp/src/db/meta/MySQLConnectionPool.cpp @@ -68,7 +68,7 @@ MySQLConnectionPool::create() { try { // Create connection using the parameters we were passed upon // creation. - mysqlpp::Connection* conn = new mysqlpp::Connection(); + auto conn = new mysqlpp::Connection(); conn->set_option(new mysqlpp::ReconnectOption(true)); 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_); diff --git a/cpp/src/db/meta/MySQLMetaImpl.cpp b/cpp/src/db/meta/MySQLMetaImpl.cpp index e9654c78..db93ce9e 100644 --- a/cpp/src/db/meta/MySQLMetaImpl.cpp +++ b/cpp/src/db/meta/MySQLMetaImpl.cpp @@ -50,11 +50,11 @@ HandleException(const std::string& desc, const char* what = nullptr) { if (what == nullptr) { ENGINE_LOG_ERROR << 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 { @@ -324,7 +324,7 @@ MySQLMetaImpl::Initialize() { return Status::OK(); } -// PXU TODO: Temp solution. Will fix later +// TODO(myh): Delete single vecotor by id Status MySQLMetaImpl::DropPartitionsByDates(const std::string& table_id, const DatesT& dates) { if (dates.empty()) { @@ -1379,7 +1379,7 @@ MySQLMetaImpl::GetTableFiles(const std::string& table_id, const std::vector '9') p++; + while (*p < '0' || *p > '9') { + p++; + } line[i - 3] = '\0'; i = atoi(p); return static_cast(i); @@ -105,7 +109,7 @@ SystemInfo::GetProcessUsedMemory() { constexpr uint64_t KB_SIZE = 1024; char line[line_length]; - while (fgets(line, line_length, file) != NULL) { + while (fgets(line, line_length, file) != nullptr) { if (strncmp(line, "VmRSS:", 6) == 0) { result = ParseLine(line); break; @@ -118,9 +122,12 @@ SystemInfo::GetProcessUsedMemory() { double SystemInfo::MemoryPercent() { - if (!initialized_) + if (!initialized_) { Init(); - return (double)(GetProcessUsedMemory() * 100) / (double)total_ram_; + } + + double mem_used = static_cast(GetProcessUsedMemory() * 100); + return mem_used / static_cast(total_ram_); } std::vector @@ -174,8 +181,9 @@ SystemInfo::getTotalCpuTime(std::vector& work_time_array) { double SystemInfo::CPUPercent() { - if (!initialized_) + if (!initialized_) { Init(); + } struct tms time_sample; clock_t now; double percent; @@ -233,7 +241,7 @@ SystemInfo::CPUTemperature() { for (int i = 0; i <= num_physical_processors_; ++i) { std::string path = "/sys/class/thermal/thermal_zone" + std::to_string(i) + "/temp"; FILE* file = fopen(path.data(), "r"); - if (file == NULL) { + if (file == nullptr) { perror("Could not open thermal file"); return result; } @@ -269,7 +277,7 @@ SystemInfo::Octets() { std::ifstream file(filename); std::string lastline = ""; std::string line = ""; - while (file) { + while (true) { getline(file, line); if (file.fail()) { break; diff --git a/cpp/src/scheduler/ResourceMgr.cpp b/cpp/src/scheduler/ResourceMgr.cpp index eefa3056..ce9fcc9f 100644 --- a/cpp/src/scheduler/ResourceMgr.cpp +++ b/cpp/src/scheduler/ResourceMgr.cpp @@ -75,7 +75,7 @@ ResourceMgr::Connect(const std::string& name1, const std::string& name2, Connect auto res2 = GetResource(name2); if (res1 && res2) { res1->AddNeighbour(std::static_pointer_cast(res2), connection); - // TODO: enable when task balance supported + // TODO(wxy): enable when task balance supported // res2->AddNeighbour(std::static_pointer_cast(res1), connection); return true; } diff --git a/cpp/src/scheduler/ResourceMgr.h b/cpp/src/scheduler/ResourceMgr.h index 05393041..53149106 100644 --- a/cpp/src/scheduler/ResourceMgr.h +++ b/cpp/src/scheduler/ResourceMgr.h @@ -65,7 +65,7 @@ class ResourceMgr { return disk_resources_; } - // TODO: why return shared pointer + // TODO(wxy): why return shared pointer inline std::vector GetAllResources() { return resources_; @@ -90,7 +90,7 @@ class ResourceMgr { GetNumGpuResource() const; public: - // TODO: add stats interface(low) + // TODO(wxy): add stats interface(low) public: /******** Utility Functions ********/ diff --git a/cpp/src/scheduler/SchedInst.cpp b/cpp/src/scheduler/SchedInst.cpp index 5c04eeb9..cdeb834f 100644 --- a/cpp/src/scheduler/SchedInst.cpp +++ b/cpp/src/scheduler/SchedInst.cpp @@ -147,7 +147,7 @@ load_advance_config() { // } // } catch (const char *msg) { // SERVER_LOG_ERROR << msg; - // // TODO: throw exception instead + // // TODO(wxy): throw exception instead // exit(-1); //// throw std::exception(); // } diff --git a/cpp/src/scheduler/Scheduler.cpp b/cpp/src/scheduler/Scheduler.cpp index 5cffa999..8272bf62 100644 --- a/cpp/src/scheduler/Scheduler.cpp +++ b/cpp/src/scheduler/Scheduler.cpp @@ -93,7 +93,7 @@ Scheduler::Process(const EventPtr& event) { process_event(event); } -// TODO: refactor the function +// TODO(wxy): refactor the function void Scheduler::OnLoadCompleted(const EventPtr& event) { auto load_completed_event = std::static_pointer_cast(event); diff --git a/cpp/src/scheduler/Scheduler.h b/cpp/src/scheduler/Scheduler.h index e72e40d1..58cb4cbc 100644 --- a/cpp/src/scheduler/Scheduler.h +++ b/cpp/src/scheduler/Scheduler.h @@ -32,7 +32,7 @@ namespace zilliz { namespace milvus { 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 { public: explicit Scheduler(ResourceMgrWPtr res_mgr); diff --git a/cpp/src/scheduler/TaskCreator.cpp b/cpp/src/scheduler/TaskCreator.cpp index 4f897970..cfcb0eb4 100644 --- a/cpp/src/scheduler/TaskCreator.cpp +++ b/cpp/src/scheduler/TaskCreator.cpp @@ -33,7 +33,7 @@ TaskCreator::Create(const JobPtr& job) { return Create(std::static_pointer_cast(job)); } default: { - // TODO: error + // TODO(wxy): error return std::vector(); } } diff --git a/cpp/src/scheduler/TaskTable.h b/cpp/src/scheduler/TaskTable.h index eb6a6932..80c8438e 100644 --- a/cpp/src/scheduler/TaskTable.h +++ b/cpp/src/scheduler/TaskTable.h @@ -126,7 +126,7 @@ class TaskTable { Get(uint64_t index); /* - * TODO(wxyu): BIG GC + * TODO(wxy): BIG GC * Remove sequence task which is DONE or MOVED from front; * Called by ? */ @@ -174,7 +174,7 @@ class TaskTable { public: /******** Action ********/ - // TODO: bool to Status + // TODO(wxy): bool to Status /* * Load a task; * Set state loading; diff --git a/cpp/src/scheduler/action/PushTaskToNeighbour.cpp b/cpp/src/scheduler/action/PushTaskToNeighbour.cpp index 4cafffa3..6fb861c8 100644 --- a/cpp/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/cpp/src/scheduler/action/PushTaskToNeighbour.cpp @@ -83,7 +83,7 @@ Action::PushTaskToNeighbourRandomly(const TaskPtr& task, const ResourcePtr& self } } else { - // TODO: process + // TODO(wxy): process } } diff --git a/cpp/src/scheduler/resource/Node.h b/cpp/src/scheduler/resource/Node.h index 0713dafa..588eef5f 100644 --- a/cpp/src/scheduler/resource/Node.h +++ b/cpp/src/scheduler/resource/Node.h @@ -41,7 +41,7 @@ struct Neighbour { Connection connection; }; -// TODO(linxj): return type void -> Status +// TODO(lxj): return type void -> Status class Node { public: Node(); diff --git a/cpp/src/scheduler/resource/Resource.h b/cpp/src/scheduler/resource/Resource.h index f6ba88c2..2bffaae5 100644 --- a/cpp/src/scheduler/resource/Resource.h +++ b/cpp/src/scheduler/resource/Resource.h @@ -39,7 +39,7 @@ namespace zilliz { namespace milvus { namespace scheduler { -// TODO(wxyu): Storage, Route, Executor +// TODO(wxy): Storage, Route, Executor enum class ResourceType { DISK = 0, CPU = 1, @@ -115,11 +115,11 @@ class Resource : public Node, public std::enable_shared_from_this { return enable_executor_; } - // TODO: const + // TODO(wxy): const uint64_t NumOfTaskToExec(); - // TODO: need double ? + // TODO(wxy): need double ? inline uint64_t TaskAvgCost() const { return total_cost_ / total_task_; diff --git a/cpp/src/scheduler/task/SearchTask.h b/cpp/src/scheduler/task/SearchTask.h index 872187a0..a89df463 100644 --- a/cpp/src/scheduler/task/SearchTask.h +++ b/cpp/src/scheduler/task/SearchTask.h @@ -27,7 +27,7 @@ namespace zilliz { namespace milvus { namespace scheduler { -// TODO: rewrite +// TODO(wxy): rewrite class XSearchTask : public Task { public: explicit XSearchTask(TableFileSchemaPtr file); diff --git a/cpp/src/sdk/examples/grpcsimple/main.cpp b/cpp/src/sdk/examples/grpcsimple/main.cpp index 76c60ac1..c31f491a 100644 --- a/cpp/src/sdk/examples/grpcsimple/main.cpp +++ b/cpp/src/sdk/examples/grpcsimple/main.cpp @@ -30,10 +30,10 @@ main(int argc, char* argv[]) { printf("Client start...\n"); std::string app_name = basename(argv[0]); - static struct option long_options[] = {{"server", optional_argument, 0, 's'}, - {"port", optional_argument, 0, 'p'}, - {"help", no_argument, 0, 'h'}, - {NULL, 0, 0, 0}}; + static struct option long_options[] = {{"server", optional_argument, nullptr, 's'}, + {"port", optional_argument, nullptr, 'p'}, + {"help", no_argument, nullptr, 'h'}, + {nullptr, 0, nullptr, 0}}; int option_index = 0; std::string address = "127.0.0.1", port = "19530"; diff --git a/cpp/src/sdk/grpc/ClientProxy.cpp b/cpp/src/sdk/grpc/ClientProxy.cpp index db4f717e..7e1955b0 100644 --- a/cpp/src/sdk/grpc/ClientProxy.cpp +++ b/cpp/src/sdk/grpc/ClientProxy.cpp @@ -29,10 +29,7 @@ namespace milvus { bool UriCheck(const std::string& uri) { size_t index = uri.find_first_of(':', 0); - if (index == std::string::npos) { - return false; - } - return true; + return (index != std::string::npos); } Status @@ -99,7 +96,7 @@ ClientProxy::CreateTable(const TableSchema& param) { schema.set_table_name(param.table_name); schema.set_dimension(param.dimension); schema.set_index_file_size(param.index_file_size); - schema.set_metric_type((int32_t)param.metric_type); + schema.set_metric_type(static_cast(param.metric_type)); return client_ptr_->CreateTable(schema); } catch (std::exception& ex) { @@ -130,7 +127,6 @@ ClientProxy::DropTable(const std::string& table_name) { Status ClientProxy::CreateIndex(const IndexParam& index_param) { try { - // TODO: add index params ::milvus::grpc::IndexParam grpc_index_param; grpc_index_param.set_table_name(index_param.table_name); grpc_index_param.mutable_index()->set_index_type(static_cast(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.dimension = grpc_schema.dimension(); 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(grpc_schema.metric_type()); return status; } 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); ::milvus::grpc::IndexParam 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(grpc_index_param.mutable_index()->index_type()); index_param.nlist = grpc_index_param.mutable_index()->nlist(); return status; diff --git a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp index a76552b6..241e24e8 100644 --- a/cpp/src/server/grpc_impl/GrpcRequestTask.cpp +++ b/cpp/src/server/grpc_impl/GrpcRequestTask.cpp @@ -468,7 +468,7 @@ InsertTask::OnExecute() { // step 4: prepare float data std::vector 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++) { if (insert_param_->row_record_array(i).vector_data().empty()) { return Status(SERVER_INVALID_ROWRECORD_ARRAY, "Row record array data is empty"); diff --git a/cpp/unittest/db/db_tests.cpp b/cpp/unittest/db/db_tests.cpp index 365fc3ab..0bb74437 100644 --- a/cpp/unittest/db/db_tests.cpp +++ b/cpp/unittest/db/db_tests.cpp @@ -291,7 +291,7 @@ TEST_F(DBTest, SEARCH_TEST) { ASSERT_TRUE(stat.ok()); } - // TODO(linxj): add groundTruth assert + // TODO(lxj): add groundTruth assert } TEST_F(DBTest, PRELOADTABLE_TEST) { diff --git a/cpp/unittest/server/cache_test.cpp b/cpp/unittest/server/cache_test.cpp index 056d6018..8fea11fa 100644 --- a/cpp/unittest/server/cache_test.cpp +++ b/cpp/unittest/server/cache_test.cpp @@ -193,7 +193,7 @@ TEST(CacheTest, GPU_CACHE_TEST) { ASSERT_EQ(gpu_mgr->ItemCount(), 0); 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 ms::engine::VecIndexPtr mock_index = std::make_shared(256, 2000000); ms::cache::DataObjPtr data_obj = std::make_shared(mock_index); -- GitLab