未验证 提交 d88d51f8 编写于 作者: G groot 提交者: GitHub

add log (#1913)

* add log
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* add log
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* fix ut
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* partition limit 4096
Signed-off-by: Ngroot <yihua.mo@zilliz.com>

* fix py test
Signed-off-by: Ngroot <yihua.mo@zilliz.com>
上级 68cdd41c
...@@ -861,6 +861,8 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i ...@@ -861,6 +861,8 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i
return status; return status;
} }
OngoingFileChecker::GetInstance().MarkOngoingFiles(files_to_query);
std::vector<meta::CollectionSchema> partition_array; std::vector<meta::CollectionSchema> partition_array;
status = meta_ptr_->ShowPartitions(collection_id, partition_array); status = meta_ptr_->ShowPartitions(collection_id, partition_array);
for (auto& schema : partition_array) { for (auto& schema : partition_array) {
...@@ -871,17 +873,18 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i ...@@ -871,17 +873,18 @@ DBImpl::GetVectorByID(const std::string& collection_id, const IDNumber& vector_i
ENGINE_LOG_ERROR << err_msg; ENGINE_LOG_ERROR << err_msg;
return status; return status;
} }
OngoingFileChecker::GetInstance().MarkOngoingFiles(files);
files_to_query.insert(files_to_query.end(), std::make_move_iterator(files.begin()), files_to_query.insert(files_to_query.end(), std::make_move_iterator(files.begin()),
std::make_move_iterator(files.end())); std::make_move_iterator(files.end()));
} }
if (files_to_query.empty()) { if (files_to_query.empty()) {
ENGINE_LOG_DEBUG << "No files to get vector by id from"; 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(); cache::CpuCacheMgr::GetInstance()->PrintInfo();
OngoingFileChecker::GetInstance().MarkOngoingFiles(files_to_query);
status = GetVectorByIdHelper(collection_id, vector_id, vector, 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 ...@@ -967,6 +970,10 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id
const meta::SegmentsSchema& files) { const meta::SegmentsSchema& files) {
ENGINE_LOG_DEBUG << "Getting vector by id in " << files.size() << " 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) { for (auto& file : files) {
// Load bloom filter // Load bloom filter
std::string segment_dir; std::string segment_dir;
...@@ -993,6 +1000,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id ...@@ -993,6 +1000,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id
segment::DeletedDocsPtr deleted_docs_ptr; segment::DeletedDocsPtr deleted_docs_ptr;
status = segment_reader.LoadDeletedDocs(deleted_docs_ptr); status = segment_reader.LoadDeletedDocs(deleted_docs_ptr);
if (!status.ok()) { if (!status.ok()) {
ENGINE_LOG_ERROR << status.message();
return status; return status;
} }
auto& deleted_docs = deleted_docs_ptr->GetDeletedDocs(); auto& deleted_docs = deleted_docs_ptr->GetDeletedDocs();
...@@ -1005,6 +1013,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id ...@@ -1005,6 +1013,7 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id
std::vector<uint8_t> raw_vector; std::vector<uint8_t> raw_vector;
status = segment_reader.LoadVectors(offset * single_vector_bytes, single_vector_bytes, raw_vector); status = segment_reader.LoadVectors(offset * single_vector_bytes, single_vector_bytes, raw_vector);
if (!status.ok()) { if (!status.ok()) {
ENGINE_LOG_ERROR << status.message();
return status; return status;
} }
...@@ -1025,6 +1034,11 @@ DBImpl::GetVectorByIdHelper(const std::string& collection_id, IDNumber vector_id ...@@ -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(); return Status::OK();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册