From d88d51f8027e4ec7f53a943c7dc411f7c9a17175 Mon Sep 17 00:00:00 2001 From: groot Date: Mon, 13 Apr 2020 10:33:29 +0800 Subject: [PATCH] add log (#1913) * add log Signed-off-by: groot * add log Signed-off-by: groot * fix ut Signed-off-by: groot * partition limit 4096 Signed-off-by: groot * fix py test Signed-off-by: groot --- core/src/db/DBImpl.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index 5cc90d2d..2347c32f 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -861,6 +861,8 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i return status; } + OngoingFileChecker::GetInstance().MarkOngoingFiles(files_to_query); + std::vector partition_array; status = meta_ptr_->ShowPartitions(collection_id, partition_array); for (auto& schema : partition_array) { @@ -871,17 +873,18 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i ENGINE_LOG_ERROR << err_msg; return status; } + + OngoingFileChecker::GetInstance().MarkOngoingFiles(files); files_to_query.insert(files_to_query.end(), std::make_move_iterator(files.begin()), std::make_move_iterator(files.end())); } if (files_to_query.empty()) { ENGINE_LOG_DEBUG << "No files to get vector by id from"; - return Status::OK(); + return Status(DB_NOT_FOUND, "Collection is empty"); } cache::CpuCacheMgr::GetInstance()->PrintInfo(); - OngoingFileChecker::GetInstance().MarkOngoingFiles(files_to_query); status = GetVectorByIdHelper(collection_id, vector_id, vector, files_to_query); @@ -967,6 +970,10 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id const meta::SegmentsSchema& files) { ENGINE_LOG_DEBUG << "Getting vector by id in " << files.size() << " files"; + vector.vector_count_ = 0; + vector.float_data_.clear(); + vector.binary_data_.clear(); + for (auto& file : files) { // Load bloom filter std::string segment_dir; @@ -993,6 +1000,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id segment::DeletedDocsPtr deleted_docs_ptr; status = segment_reader.LoadDeletedDocs(deleted_docs_ptr); if (!status.ok()) { + ENGINE_LOG_ERROR << status.message(); return status; } auto& deleted_docs = deleted_docs_ptr->GetDeletedDocs(); @@ -1005,6 +1013,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id std::vector raw_vector; status = segment_reader.LoadVectors(offset * single_vector_bytes, single_vector_bytes, raw_vector); if (!status.ok()) { + ENGINE_LOG_ERROR << status.message(); return status; } @@ -1025,6 +1034,11 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id } } + if (vector.binary_data_.empty() && vector.float_data_.empty()) { + std::string msg = "Vector with id " + std::to_string(vector_id) + " not found in collection " + collection_id; + ENGINE_LOG_DEBUG << msg; + } + return Status::OK(); } -- GitLab