diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index 5935fafce6f539ce9d76c4bfcd52856535173775..de7d8306fdc5a2618129115c95e376062dd5b019 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -9,6 +9,7 @@ Please mark all change in change log and use the ticket from JIRA. ## Improvement - MS-552 - Add and change the easylogging library - MS-553 - Refine cache code +- MS-557 - Merge Log.h - MS-556 - Add Job Definition in Scheduler ## New Feature diff --git a/cpp/src/core/todo b/cpp/src/core/todo deleted file mode 100644 index eeb0a699150f95d9717adf77f8a4f269fe8b22c9..0000000000000000000000000000000000000000 --- a/cpp/src/core/todo +++ /dev/null @@ -1,2 +0,0 @@ -1. Support L2 and IP -2. replace with RapidJson \ No newline at end of file diff --git a/cpp/src/db/DBFactory.cpp b/cpp/src/db/DBFactory.cpp index e44e3f4d97e0f11a194d252ac0e9dc24fb4116bb..eb13c309fc18adb1ac6ded87e987798116e28495 100644 --- a/cpp/src/db/DBFactory.cpp +++ b/cpp/src/db/DBFactory.cpp @@ -18,7 +18,7 @@ #include "DBFactory.h" #include "DBImpl.h" -#include "Exception.h" +#include "utils/Exception.h" #include "meta/MetaFactory.h" #include "meta/SqliteMetaImpl.h" #include "meta/MySQLMetaImpl.h" diff --git a/cpp/src/db/DBImpl.cpp b/cpp/src/db/DBImpl.cpp index 205d27ad21790056b854b15c74b73ef986a8ab86..648038de25c12704e9e94103dbcbf269c374829f 100644 --- a/cpp/src/db/DBImpl.cpp +++ b/cpp/src/db/DBImpl.cpp @@ -16,28 +16,27 @@ // under the License. #include "DBImpl.h" -#include "src/db/meta/SqliteMetaImpl.h" -#include "Log.h" -#include "Utils.h" +#include "cache/CpuCacheMgr.h" +#include "cache/GpuCacheMgr.h" #include "engine/EngineFactory.h" #include "insert/MemMenagerFactory.h" +#include "meta/SqliteMetaImpl.h" #include "meta/MetaFactory.h" +#include "meta/MetaConsts.h" #include "metrics/Metrics.h" #include "scheduler/TaskScheduler.h" - #include "scheduler/context/DeleteContext.h" +#include "scheduler/SchedInst.h" #include "utils/TimeRecorder.h" -#include "meta/MetaConsts.h" +#include "utils/Log.h" +#include "Utils.h" #include #include #include #include #include -#include #include -#include "scheduler/SchedInst.h" -#include namespace zilliz { namespace milvus { @@ -421,7 +420,7 @@ Status DBImpl::QueryAsync(const std::string& table_id, const meta::TableFilesSch const meta::DatesT& dates, QueryResults& results) { server::CollectQueryMetrics metrics(nq); - server::TimeRecorder rc(""); + TimeRecorder rc(""); //step 1: get files to search ENGINE_LOG_DEBUG << "Engine query begin, index file count: " << files.size() << " date range count: " << dates.size(); @@ -444,9 +443,9 @@ Status DBImpl::QueryAsync(const std::string& table_id, const meta::TableFilesSch double load_cost = context->LoadCost(); double search_cost = context->SearchCost(); double reduce_cost = context->ReduceCost(); - std::string load_info = server::TimeRecorder::GetTimeSpanStr(load_cost); - std::string search_info = server::TimeRecorder::GetTimeSpanStr(search_cost); - std::string reduce_info = server::TimeRecorder::GetTimeSpanStr(reduce_cost); + std::string load_info = TimeRecorder::GetTimeSpanStr(load_cost); + std::string search_info = TimeRecorder::GetTimeSpanStr(search_cost); + std::string reduce_info = TimeRecorder::GetTimeSpanStr(reduce_cost); if(search_cost > 0.0 || reduce_cost > 0.0) { double total_cost = load_cost + search_cost + reduce_cost; double load_percent = load_cost/total_cost; diff --git a/cpp/src/db/DBImpl.h b/cpp/src/db/DBImpl.h index 1d171b163f47269e4bae609b92f290edfe3edfa5..85803b763f2c0c4fb1a5302f5742d8225bf74e1e 100644 --- a/cpp/src/db/DBImpl.h +++ b/cpp/src/db/DBImpl.h @@ -140,11 +140,11 @@ class DBImpl : public DB { MemManagerPtr mem_mgr_; std::mutex mem_serialize_mutex_; - server::ThreadPool compact_thread_pool_; + ThreadPool compact_thread_pool_; std::list> compact_thread_results_; std::set compact_table_ids_; - server::ThreadPool index_thread_pool_; + ThreadPool index_thread_pool_; std::list> index_thread_results_; std::mutex build_index_mutex_; diff --git a/cpp/src/db/Log.h b/cpp/src/db/Log.h deleted file mode 100644 index 0a7bb7dd7f88323200b4bf9875a34951c726b20e..0000000000000000000000000000000000000000 --- a/cpp/src/db/Log.h +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#pragma once - -#include "utils/easylogging++.h" - -namespace zilliz { -namespace milvus { -namespace engine { - -#define ENGINE_DOMAIN_NAME "[ENGINE] " -#define ENGINE_ERROR_TEXT "ENGINE Error:" - -#define ENGINE_LOG_TRACE LOG(TRACE) << ENGINE_DOMAIN_NAME -#define ENGINE_LOG_DEBUG LOG(DEBUG) << ENGINE_DOMAIN_NAME -#define ENGINE_LOG_INFO LOG(INFO) << ENGINE_DOMAIN_NAME -#define ENGINE_LOG_WARNING LOG(WARNING) << ENGINE_DOMAIN_NAME -#define ENGINE_LOG_ERROR LOG(ERROR) << ENGINE_DOMAIN_NAME -#define ENGINE_LOG_FATAL LOG(FATAL) << ENGINE_DOMAIN_NAME - -} // namespace sql -} // namespace zilliz -} // namespace server diff --git a/cpp/src/db/Options.cpp b/cpp/src/db/Options.cpp index fdb6731d1e330f24a1527942e472e259a84496f4..9abc8e66ec7a269ad4d6d7e7219a371d92be5577 100644 --- a/cpp/src/db/Options.cpp +++ b/cpp/src/db/Options.cpp @@ -15,15 +15,14 @@ // specific language governing permissions and limitations // under the License. +#include "Options.h" +#include "utils/Exception.h" +#include "utils/easylogging++.h" + #include #include -#include "utils/easylogging++.h" #include -#include "Options.h" -#include "db/meta/SqliteMetaImpl.h" -#include "Exception.h" - namespace zilliz { namespace milvus { namespace engine { diff --git a/cpp/src/db/Utils.cpp b/cpp/src/db/Utils.cpp index d197d85525e61e9db0afcfdd80647eb0b5d4ceb6..cbc3ba45b69c437fc32dd0c9ffca89f335da4962 100644 --- a/cpp/src/db/Utils.cpp +++ b/cpp/src/db/Utils.cpp @@ -17,7 +17,7 @@ #include "Utils.h" #include "utils/CommonUtil.h" -#include "Log.h" +#include "utils/Log.h" #include #include diff --git a/cpp/src/db/engine/EngineFactory.cpp b/cpp/src/db/engine/EngineFactory.cpp index a975ca88c458c25122b08aeb1aa927ef347fcd35..d50cc8ad3e49b5b93dcc823944f940138e865656 100644 --- a/cpp/src/db/engine/EngineFactory.cpp +++ b/cpp/src/db/engine/EngineFactory.cpp @@ -17,7 +17,7 @@ #include "EngineFactory.h" #include "ExecutionEngineImpl.h" -#include "db/Log.h" +#include "utils/Log.h" namespace zilliz { namespace milvus { diff --git a/cpp/src/db/engine/ExecutionEngineImpl.cpp b/cpp/src/db/engine/ExecutionEngineImpl.cpp index a062a5994a56507e1089d092492d129cd1c41b85..7ad9d3ea12eac0b4ad6e6f5fdd6cdcf8e7ad50ba 100644 --- a/cpp/src/db/engine/ExecutionEngineImpl.cpp +++ b/cpp/src/db/engine/ExecutionEngineImpl.cpp @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#include -#include "src/cache/GpuCacheMgr.h" - -#include "src/metrics/Metrics.h" -#include "db/Log.h" +#include "ExecutionEngineImpl.h" +#include "cache/GpuCacheMgr.h" +#include "cache/CpuCacheMgr.h" +#include "metrics/Metrics.h" +#include "utils/Log.h" #include "utils/CommonUtil.h" +#include "utils/Exception.h" -#include "src/cache/CpuCacheMgr.h" -#include "ExecutionEngineImpl.h" #include "wrapper/knowhere/vec_index.h" #include "wrapper/knowhere/vec_impl.h" #include "knowhere/common/exception.h" -#include "db/Exception.h" +#include namespace zilliz { namespace milvus { diff --git a/cpp/src/db/insert/MemManagerImpl.cpp b/cpp/src/db/insert/MemManagerImpl.cpp index 1c7f49a168e66734c8ef6c6d4ad7d07500ca686e..35dd227b6caeef0bbc7005d4e9c79d9132a3b18c 100644 --- a/cpp/src/db/insert/MemManagerImpl.cpp +++ b/cpp/src/db/insert/MemManagerImpl.cpp @@ -18,7 +18,7 @@ #include "MemManagerImpl.h" #include "VectorSource.h" -#include "db/Log.h" +#include "utils/Log.h" #include "db/Constants.h" #include diff --git a/cpp/src/db/insert/MemMenagerFactory.cpp b/cpp/src/db/insert/MemMenagerFactory.cpp index 1f39ea3256ee86717bcb8ff51293fed725277b06..d8620e908cbb7102ebf6840a1f32de1c38333225 100644 --- a/cpp/src/db/insert/MemMenagerFactory.cpp +++ b/cpp/src/db/insert/MemMenagerFactory.cpp @@ -15,11 +15,10 @@ // specific language governing permissions and limitations // under the License. - #include "MemMenagerFactory.h" #include "MemManagerImpl.h" -#include "db/Log.h" -#include "db/Exception.h" +#include "utils/Log.h" +#include "utils/Exception.h" #include #include diff --git a/cpp/src/db/insert/MemTable.cpp b/cpp/src/db/insert/MemTable.cpp index 19814e3aad5c3c62707ea9413ff605af7e691097..6bd5274d9eced13301e93c74ed2bba11b7159df2 100644 --- a/cpp/src/db/insert/MemTable.cpp +++ b/cpp/src/db/insert/MemTable.cpp @@ -17,7 +17,7 @@ #include "MemTable.h" -#include "db/Log.h" +#include "utils/Log.h" namespace zilliz { diff --git a/cpp/src/db/insert/MemTableFile.cpp b/cpp/src/db/insert/MemTableFile.cpp index e991b7900cb628b3e8aae0112760b0e4b4289319..63a968986da1323fb08cbaf29e6195a16fd6c115 100644 --- a/cpp/src/db/insert/MemTableFile.cpp +++ b/cpp/src/db/insert/MemTableFile.cpp @@ -18,9 +18,9 @@ #include "MemTableFile.h" #include "db/Constants.h" -#include "db/Log.h" #include "db/engine/EngineFactory.h" #include "metrics/Metrics.h" +#include "utils/Log.h" #include diff --git a/cpp/src/db/insert/VectorSource.cpp b/cpp/src/db/insert/VectorSource.cpp index e80667e31f1452e4c7531b99b1d06dd802bd12c5..d0aeb5f1eff60ac6f175181f0852319d42a8f713 100644 --- a/cpp/src/db/insert/VectorSource.cpp +++ b/cpp/src/db/insert/VectorSource.cpp @@ -19,7 +19,7 @@ #include "VectorSource.h" #include "db/engine/ExecutionEngine.h" #include "db/engine/EngineFactory.h" -#include "db/Log.h" +#include "utils/Log.h" #include "metrics/Metrics.h" diff --git a/cpp/src/db/meta/MetaFactory.cpp b/cpp/src/db/meta/MetaFactory.cpp index ef9c4f13fd34121b38e603d51565cee0c485f675..2f498941d41f45b83e58a2bf1a005a60944c0b0e 100644 --- a/cpp/src/db/meta/MetaFactory.cpp +++ b/cpp/src/db/meta/MetaFactory.cpp @@ -15,12 +15,11 @@ // specific language governing permissions and limitations // under the License. - #include "MetaFactory.h" #include "SqliteMetaImpl.h" #include "MySQLMetaImpl.h" -#include "db/Log.h" -#include "db/Exception.h" +#include "utils/Log.h" +#include "utils/Exception.h" #include #include diff --git a/cpp/src/db/meta/MySQLConnectionPool.h b/cpp/src/db/meta/MySQLConnectionPool.h index 98695f57395620b94cfa32549aa5f016d76dc17c..4aadafd714572a2b01dd6cbb51ee0606ae6e7af8 100644 --- a/cpp/src/db/meta/MySQLConnectionPool.h +++ b/cpp/src/db/meta/MySQLConnectionPool.h @@ -22,7 +22,7 @@ #include #include -#include "db/Log.h" +#include "utils/Log.h" namespace zilliz { namespace milvus { diff --git a/cpp/src/db/meta/MySQLMetaImpl.cpp b/cpp/src/db/meta/MySQLMetaImpl.cpp index 20ec9648c5712928a19eaccb93f079baa8cb3b3f..ccd7e79ada476d9df39cffa3eb9617b651086e13 100644 --- a/cpp/src/db/meta/MySQLMetaImpl.cpp +++ b/cpp/src/db/meta/MySQLMetaImpl.cpp @@ -18,7 +18,7 @@ #include "MySQLMetaImpl.h" #include "db/IDGenerator.h" #include "db/Utils.h" -#include "db/Log.h" +#include "utils/Log.h" #include "MetaConsts.h" #include "metrics/Metrics.h" diff --git a/cpp/src/db/meta/SqliteMetaImpl.cpp b/cpp/src/db/meta/SqliteMetaImpl.cpp index 0c3e2aa3e504a50867a0115d58c95374d437778e..564a8eae4d0bd4f3dadca6f6fbac7ee0a7de43eb 100644 --- a/cpp/src/db/meta/SqliteMetaImpl.cpp +++ b/cpp/src/db/meta/SqliteMetaImpl.cpp @@ -18,7 +18,7 @@ #include "SqliteMetaImpl.h" #include "db/IDGenerator.h" #include "db/Utils.h" -#include "db/Log.h" +#include "utils/Log.h" #include "MetaConsts.h" #include "metrics/Metrics.h" diff --git a/cpp/src/db/scheduler/TaskDispatchStrategy.cpp b/cpp/src/db/scheduler/TaskDispatchStrategy.cpp index ce6d10c1473fe89b3467f61a6497d835a764e260..6ce9e582dedb02cc8eb604d322eb661977042846 100644 --- a/cpp/src/db/scheduler/TaskDispatchStrategy.cpp +++ b/cpp/src/db/scheduler/TaskDispatchStrategy.cpp @@ -22,7 +22,7 @@ #include "task/DeleteTask.h" #include "cache/CpuCacheMgr.h" #include "utils/Error.h" -#include "db/Log.h" +#include "utils/Log.h" namespace zilliz { namespace milvus { diff --git a/cpp/src/db/scheduler/task/IndexLoadTask.cpp b/cpp/src/db/scheduler/task/IndexLoadTask.cpp index 3dc91a279c29a8808dbe45ec1a33857f337645e0..be83b8668307d62937c01d29f4a594e0e131011d 100644 --- a/cpp/src/db/scheduler/task/IndexLoadTask.cpp +++ b/cpp/src/db/scheduler/task/IndexLoadTask.cpp @@ -18,8 +18,8 @@ #include "IndexLoadTask.h" #include "SearchTask.h" -#include "db/Log.h" #include "db/engine/EngineFactory.h" +#include "utils/Log.h" #include "utils/TimeRecorder.h" #include "metrics/Metrics.h" diff --git a/cpp/src/db/scheduler/task/SearchTask.cpp b/cpp/src/db/scheduler/task/SearchTask.cpp index e79ddbcb8ca8c6a353a1f9e12319f1d11af854e8..d0962ec1010dee981bda1de1335d543cead3ce82 100644 --- a/cpp/src/db/scheduler/task/SearchTask.cpp +++ b/cpp/src/db/scheduler/task/SearchTask.cpp @@ -17,7 +17,7 @@ #include "SearchTask.h" #include "metrics/Metrics.h" -#include "db/Log.h" +#include "utils/Log.h" #include "utils/TimeRecorder.h" #include diff --git a/cpp/src/scheduler/ResourceMgr.cpp b/cpp/src/scheduler/ResourceMgr.cpp index 5ce3d572bc879533590cd2a5d05a526234b5fc70..dafc15713a3352faae6512bda66a65bb5b9332bb 100644 --- a/cpp/src/scheduler/ResourceMgr.cpp +++ b/cpp/src/scheduler/ResourceMgr.cpp @@ -17,7 +17,7 @@ // under the License. #include "ResourceMgr.h" -#include "db/Log.h" +#include "utils/Log.h" namespace zilliz { diff --git a/cpp/src/scheduler/task/SearchTask.cpp b/cpp/src/scheduler/task/SearchTask.cpp index 6da63964cea00cc9b258df682fa0e51d7e801884..d8222da39fbe27615ee0f74430c32c48adb46022 100644 --- a/cpp/src/scheduler/task/SearchTask.cpp +++ b/cpp/src/scheduler/task/SearchTask.cpp @@ -15,12 +15,11 @@ // specific language governing permissions and limitations // under the License. - -#include "src/metrics/Metrics.h" -#include "src/utils/TimeRecorder.h" -#include "src/db/engine/EngineFactory.h" -#include "src/db/Log.h" #include "SearchTask.h" +#include "metrics/Metrics.h" +#include "db/engine/EngineFactory.h" +#include "utils/TimeRecorder.h" +#include "utils/Log.h" #include @@ -109,7 +108,7 @@ XSearchTask::XSearchTask(TableFileSchemaPtr file) void XSearchTask::Load(LoadType type, uint8_t device_id) { - server::TimeRecorder rc(""); + TimeRecorder rc(""); Status stat = Status::OK(); std::string error_msg; std::string type_str; @@ -178,7 +177,7 @@ XSearchTask::Execute() { ENGINE_LOG_DEBUG << "Searching in file id:" << index_id_ << " with " << search_contexts_.size() << " tasks"; - server::TimeRecorder rc("DoSearch file id:" + std::to_string(index_id_)); + TimeRecorder rc("DoSearch file id:" + std::to_string(index_id_)); server::CollectDurationMetrics metrics(index_type_); diff --git a/cpp/src/db/Exception.h b/cpp/src/utils/Exception.h similarity index 97% rename from cpp/src/db/Exception.h rename to cpp/src/utils/Exception.h index 9132996b5aaf45303423f7705c641415b1ad1a8d..acb796c61ded06fbf368a46641b8e80ad0833ae3 100644 --- a/cpp/src/db/Exception.h +++ b/cpp/src/utils/Exception.h @@ -22,7 +22,6 @@ namespace zilliz { namespace milvus { -namespace engine { class Exception : public std::exception { public: @@ -61,6 +60,5 @@ public: OutOfRangeException(const std::string& message) : Exception(message) {}; }; -} // namespace engine } // namespace milvus } // namespace zilliz diff --git a/cpp/src/utils/Log.h b/cpp/src/utils/Log.h index f7c7b27f87ad7d81e8af6ddc8a6a2a4dde336530..5bb28696e21facde872fbfe30c647bf23f1cd0f8 100644 --- a/cpp/src/utils/Log.h +++ b/cpp/src/utils/Log.h @@ -17,13 +17,12 @@ #pragma once -#include "Error.h" #include "easylogging++.h" namespace zilliz { namespace milvus { -namespace server { +///////////////////////////////////////////////////////////////////////////////////////////////// #define SERVER_DOMAIN_NAME "[SERVER] " #define SERVER_ERROR_TEXT "SERVER Error:" @@ -34,20 +33,27 @@ namespace server { #define SERVER_LOG_ERROR LOG(ERROR) << SERVER_DOMAIN_NAME #define SERVER_LOG_FATAL LOG(FATAL) << SERVER_DOMAIN_NAME -#define SERVER_ERROR(error) \ - ({ \ - SERVER_LOG_ERROR << SERVER_ERROR_TEXT << error; \ - (error); \ - }) - -#define SERVER_CHECK(func) \ - { \ - zilliz::milvus::server::ServerError error = func; \ - if (error != zilliz::milvus::server::SERVER_SUCCESS) { \ - return SERVER_ERROR(error); \ - } \ - } \ - -} // namespace sql +///////////////////////////////////////////////////////////////////////////////////////////////// +#define ENGINE_DOMAIN_NAME "[ENGINE] " +#define ENGINE_ERROR_TEXT "ENGINE Error:" + +#define ENGINE_LOG_TRACE LOG(TRACE) << ENGINE_DOMAIN_NAME +#define ENGINE_LOG_DEBUG LOG(DEBUG) << ENGINE_DOMAIN_NAME +#define ENGINE_LOG_INFO LOG(INFO) << ENGINE_DOMAIN_NAME +#define ENGINE_LOG_WARNING LOG(WARNING) << ENGINE_DOMAIN_NAME +#define ENGINE_LOG_ERROR LOG(ERROR) << ENGINE_DOMAIN_NAME +#define ENGINE_LOG_FATAL LOG(FATAL) << ENGINE_DOMAIN_NAME + +///////////////////////////////////////////////////////////////////////////////////////////////// +#define WRAPPER_DOMAIN_NAME "[WRAPPER] " +#define WRAPPER_ERROR_TEXT "WRAPPER Error:" + +#define WRAPPER_LOG_TRACE LOG(TRACE) << WRAPPER_DOMAIN_NAME +#define WRAPPER_LOG_DEBUG LOG(DEBUG) << WRAPPER_DOMAIN_NAME +#define WRAPPER_LOG_INFO LOG(INFO) << WRAPPER_DOMAIN_NAME +#define WRAPPER_LOG_WARNING LOG(WARNING) << WRAPPER_DOMAIN_NAME +#define WRAPPER_LOG_ERROR LOG(ERROR) << WRAPPER_DOMAIN_NAME +#define WRAPPER_LOG_FATAL LOG(FATAL) << WRAPPER_DOMAIN_NAME + +} // namespace milvus } // namespace zilliz -} // namespace server diff --git a/cpp/src/utils/ThreadPool.h b/cpp/src/utils/ThreadPool.h index a4df85cc14cd3a14a2e9a3b47f02bcced29b4b4e..cb8755fa6b3b6eca0352bc029713a01ffda165f1 100644 --- a/cpp/src/utils/ThreadPool.h +++ b/cpp/src/utils/ThreadPool.h @@ -32,7 +32,6 @@ namespace zilliz { namespace milvus { -namespace server { class ThreadPool { public: @@ -126,5 +125,4 @@ inline ThreadPool::~ThreadPool() { } } -} diff --git a/cpp/src/utils/TimeRecorder.cpp b/cpp/src/utils/TimeRecorder.cpp index 2aef8c9a675a8088fe811f254795358279a513a7..6e4b5c1ab6e9b1dcdde77ec8a799df297fdc819a 100644 --- a/cpp/src/utils/TimeRecorder.cpp +++ b/cpp/src/utils/TimeRecorder.cpp @@ -21,7 +21,6 @@ namespace zilliz { namespace milvus { -namespace server { TimeRecorder::TimeRecorder(const std::string &header, int64_t log_level) : @@ -103,4 +102,3 @@ TimeRecorder::ElapseFromBegin(const std::string &msg) { } } -} diff --git a/cpp/src/utils/TimeRecorder.h b/cpp/src/utils/TimeRecorder.h index 7f77b0665c8e950916ddf903bf983541fe54fce3..c6efbaeb8af5446ee43f4b4a8e881685b895567a 100644 --- a/cpp/src/utils/TimeRecorder.h +++ b/cpp/src/utils/TimeRecorder.h @@ -23,7 +23,6 @@ namespace zilliz { namespace milvus { -namespace server { class TimeRecorder { using stdclock = std::chrono::high_resolution_clock; @@ -52,4 +51,3 @@ private: } } -} diff --git a/cpp/src/wrapper/knowhere/vec_impl.cpp b/cpp/src/wrapper/knowhere/vec_impl.cpp index 8fd48d2928022ab7ae7177859a6a180631b95e89..b6c15b72fb662d13edf954337ac729a72422bb20 100644 --- a/cpp/src/wrapper/knowhere/vec_impl.cpp +++ b/cpp/src/wrapper/knowhere/vec_impl.cpp @@ -16,7 +16,7 @@ // under the License. -#include +#include "utils/Log.h" #include "knowhere/index/vector_index/idmap.h" #include "knowhere/index/vector_index/gpu_ivf.h" #include "knowhere/common/exception.h" @@ -24,7 +24,6 @@ #include "vec_impl.h" #include "data_transfer.h" -#include "wrapper_log.h" namespace zilliz { diff --git a/cpp/src/wrapper/knowhere/vec_index.cpp b/cpp/src/wrapper/knowhere/vec_index.cpp index d5d14d29de15fb6942d394cdc589de93f7c81341..b1c377d032b69cf97ae41bc35ffe62debe6ccbf2 100644 --- a/cpp/src/wrapper/knowhere/vec_index.cpp +++ b/cpp/src/wrapper/knowhere/vec_index.cpp @@ -24,7 +24,7 @@ #include "vec_index.h" #include "vec_impl.h" -#include "wrapper_log.h" +#include "utils/Log.h" #include diff --git a/cpp/src/wrapper/knowhere/wrapper_log.h b/cpp/src/wrapper/knowhere/wrapper_log.h deleted file mode 100644 index 1485222e8cb15a1c2bbe0cef80cad725af2f9a65..0000000000000000000000000000000000000000 --- a/cpp/src/wrapper/knowhere/wrapper_log.h +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - - -#pragma once - -#include "utils/easylogging++.h" - -namespace zilliz { -namespace milvus { -namespace engine { - -#define WRAPPER_DOMAIN_NAME "[WRAPPER] " -#define WRAPPER_ERROR_TEXT "WRAPPER Error:" - -#define WRAPPER_LOG_TRACE LOG(TRACE) << WRAPPER_DOMAIN_NAME -#define WRAPPER_LOG_DEBUG LOG(DEBUG) << WRAPPER_DOMAIN_NAME -#define WRAPPER_LOG_INFO LOG(INFO) << WRAPPER_DOMAIN_NAME -#define WRAPPER_LOG_WARNING LOG(WARNING) << WRAPPER_DOMAIN_NAME -#define WRAPPER_LOG_ERROR LOG(ERROR) << WRAPPER_DOMAIN_NAME -#define WRAPPER_LOG_FATAL LOG(FATAL) << WRAPPER_DOMAIN_NAME - -} -} -} - diff --git a/cpp/unittest/db/misc_test.cpp b/cpp/unittest/db/misc_test.cpp index 3fa6cb5268b2aed2fd0b6e5c5dadd739b5208895..28ec0f2f9c93dc04ba8e710862c2533f491dcaf9 100644 --- a/cpp/unittest/db/misc_test.cpp +++ b/cpp/unittest/db/misc_test.cpp @@ -15,18 +15,17 @@ // specific language governing permissions and limitations // under the License. -#include -#include -#include "utils/easylogging++.h" -#include - -#include "db/Exception.h" #include "db/Status.h" #include "db/Options.h" #include "db/meta/SqliteMetaImpl.h" #include "db/engine/EngineFactory.h" #include "db/Utils.h" +#include "utils/Exception.h" +#include "utils/easylogging++.h" +#include +#include +#include #include using namespace zilliz::milvus; @@ -39,11 +38,11 @@ namespace { } TEST(DBMiscTest, EXCEPTION_TEST) { - engine::Exception ex1(""); + Exception ex1(""); std::string what = ex1.what(); ASSERT_FALSE(what.empty()); - engine::OutOfRangeException ex2; + OutOfRangeException ex2; what = ex2.what(); ASSERT_FALSE(what.empty()); } diff --git a/cpp/unittest/db/search_test.cpp b/cpp/unittest/db/search_test.cpp index 4bbc86be2df0c9428d242a68f988b867363610e6..93b71ab4063e0f1d047915800ea0b43375033129 100644 --- a/cpp/unittest/db/search_test.cpp +++ b/cpp/unittest/db/search_test.cpp @@ -238,7 +238,7 @@ TEST(DBSearchTest, PARALLEL_CLUSTER_TEST) { engine::SearchContext::ResultSet src_result; auto DoCluster = [&](int64_t nq, int64_t topk) { - server::TimeRecorder rc("DoCluster"); + TimeRecorder rc("DoCluster"); src_result.clear(); BuildResult(nq, topk, ascending, target_ids, target_distence); rc.RecordSection("build id/dietance map"); @@ -280,7 +280,7 @@ TEST(DBSearchTest, PARALLEL_TOPK_TEST) { src_result.clear(); insufficient_result.clear(); - server::TimeRecorder rc("DoCluster"); + TimeRecorder rc("DoCluster"); BuildResult(nq, topk, ascending, target_ids, target_distence); auto status = engine::XSearchTask::ClusterResult(target_ids, target_distence, nq, topk, src_result); diff --git a/cpp/unittest/server/util_test.cpp b/cpp/unittest/server/util_test.cpp index 39a96115a5ba59563ee1f10eb824206a92bcbdb5..3849f79d19a965fdd1a1078ef4bf4faeeefc3f24 100644 --- a/cpp/unittest/server/util_test.cpp +++ b/cpp/unittest/server/util_test.cpp @@ -178,7 +178,7 @@ TEST(UtilTest, TIMERECORDER_TEST) { if(log_level == 5) { continue; //skip fatal } - server::TimeRecorder rc("time", log_level); + TimeRecorder rc("time", log_level); rc.RecordSection("end"); } }