mirror of https://github.com/milvus-io/milvus.git
Remove tmporary debug log in core (#15330)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/15347/head
parent
deb0422ef5
commit
390cdd2515
|
@ -66,9 +66,6 @@ SearchOnSealed(const Schema& schema,
|
|||
const faiss::BitsetView& bitset,
|
||||
SearchResult& result,
|
||||
int64_t segment_id) {
|
||||
const std::string log_prefix = "[TODO: remove] debug #14077, segment_id = " + std::to_string(segment_id) + ", ";
|
||||
std::cout << log_prefix << "SearchOnSealed searching..., query_data_ptr = " << query_data
|
||||
<< ", nq = " << num_queries << std::endl;
|
||||
auto topk = search_info.topk_;
|
||||
auto round_decimal = search_info.round_decimal_;
|
||||
|
||||
|
@ -77,27 +74,21 @@ SearchOnSealed(const Schema& schema,
|
|||
// Assert(field.get_data_type() == DataType::VECTOR_FLOAT);
|
||||
auto dim = field.get_dim();
|
||||
|
||||
std::cout << log_prefix << "SearchOnSealed init topk, round_decimal, field_offset, field and dim done" << std::endl;
|
||||
AssertInfo(record.is_ready(field_offset), "[SearchOnSealed]Record isn't ready");
|
||||
auto field_indexing = record.get_field_indexing(field_offset);
|
||||
std::cout << log_prefix << "SearchOnSealed get_field_indexing done" << std::endl;
|
||||
AssertInfo(field_indexing->metric_type_ == search_info.metric_type_,
|
||||
"Metric type of field index isn't the same with search info");
|
||||
|
||||
auto final = [&] {
|
||||
auto ds = knowhere::GenDataset(num_queries, dim, query_data);
|
||||
std::cout << log_prefix << "SearchOnSealed GenDataset done" << std::endl;
|
||||
|
||||
auto conf = search_info.search_params_;
|
||||
conf[milvus::knowhere::meta::TOPK] = search_info.topk_;
|
||||
conf[milvus::knowhere::Metric::TYPE] = MetricTypeToName(field_indexing->metric_type_);
|
||||
auto index_type = field_indexing->indexing_->index_type();
|
||||
std::cout << log_prefix << "SearchOnSealed get index_type done" << std::endl;
|
||||
auto adapter = milvus::knowhere::AdapterMgr::GetInstance().GetAdapter(index_type);
|
||||
std::cout << log_prefix << "SearchOnSealed GetAdapter done" << std::endl;
|
||||
AssertInfo(adapter->CheckSearch(conf, index_type, field_indexing->indexing_->index_mode()),
|
||||
"[SearchOnSealed]Search params check failed");
|
||||
std::cout << log_prefix << "SearchOnSealed final done" << std::endl;
|
||||
return field_indexing->indexing_->Query(ds, conf, bitset);
|
||||
}();
|
||||
|
||||
|
@ -106,8 +97,6 @@ SearchOnSealed(const Schema& schema,
|
|||
|
||||
auto total_num = num_queries * topk;
|
||||
|
||||
std::cout << log_prefix << "SearchOnSealed ids = " << ids << ", distance = " << distances
|
||||
<< ", total_num = " << total_num << std::endl;
|
||||
const float multiplier = pow(10.0, round_decimal);
|
||||
if (round_decimal != -1) {
|
||||
const float multiplier = pow(10.0, round_decimal);
|
||||
|
@ -120,9 +109,7 @@ SearchOnSealed(const Schema& schema,
|
|||
result.num_queries_ = num_queries;
|
||||
result.topk_ = topk;
|
||||
|
||||
std::cout << log_prefix << "SearchOnSealed result assignment done" << std::endl;
|
||||
std::copy_n(ids, total_num, result.ids_.data());
|
||||
std::copy_n(distances, total_num, result.distances_.data());
|
||||
std::cout << log_prefix << "SearchOnSealed copy result done" << std::endl;
|
||||
}
|
||||
} // namespace milvus::query
|
||||
|
|
|
@ -313,27 +313,19 @@ SegmentSealedImpl::vector_search(int64_t vec_count,
|
|||
Timestamp timestamp,
|
||||
const BitsetView& bitset,
|
||||
SearchResult& output) const {
|
||||
// TODO: remove cout logs
|
||||
const std::string log_prefix = "[TODO: remove] debug #14077, segment_id = " + std::to_string(id_) + ", ";
|
||||
std::cout << log_prefix << "SegmentSealedImpl::vector_search begin to search..., vec_count = " << vec_count
|
||||
<< ", query_count = " << query_count << ", timestamp = " << timestamp << std::endl;
|
||||
AssertInfo(is_system_field_ready(), "System field is not ready");
|
||||
auto field_offset = search_info.field_offset_;
|
||||
auto& field_meta = schema_->operator[](field_offset);
|
||||
std::cout << log_prefix << "SegmentSealedImpl get field meta done" << std::endl;
|
||||
|
||||
AssertInfo(field_meta.is_vector(), "The meta type of vector field is not vector type");
|
||||
if (get_bit(vecindex_ready_bitset_, field_offset)) {
|
||||
AssertInfo(vecindexs_.is_ready(field_offset),
|
||||
"vector indexes isn't ready for field " + std::to_string(field_offset.get()));
|
||||
std::cout << log_prefix << "SegmentSealedImpl vector indexes is ready for field" << std::endl;
|
||||
query::SearchOnSealed(*schema_, vecindexs_, search_info, query_data, query_count, bitset, output, id_);
|
||||
return;
|
||||
} else if (!get_bit(field_data_ready_bitset_, field_offset)) {
|
||||
std::cout << log_prefix << "SegmentSealedImpl field data is not loaded" << std::endl;
|
||||
PanicInfo("Field Data is not loaded");
|
||||
}
|
||||
std::cout << log_prefix << "SegmentSealedImpl SearchOnSealed done" << std::endl;
|
||||
|
||||
query::dataset::SearchDataset dataset;
|
||||
dataset.query_data = query_data;
|
||||
|
@ -344,38 +336,27 @@ SegmentSealedImpl::vector_search(int64_t vec_count,
|
|||
dataset.dim = field_meta.get_dim();
|
||||
dataset.round_decimal = search_info.round_decimal_;
|
||||
|
||||
std::cout << log_prefix << "SegmentSealedImpl dataset assignment done" << std::endl;
|
||||
|
||||
AssertInfo(get_bit(field_data_ready_bitset_, field_offset),
|
||||
"Can't get bitset element at " + std::to_string(field_offset.get()));
|
||||
AssertInfo(row_count_opt_.has_value(), "Can't get row count value");
|
||||
auto row_count = row_count_opt_.value();
|
||||
auto chunk_data = fields_data_[field_offset.get()].data();
|
||||
|
||||
std::cout << log_prefix << "SegmentSealedImpl get row_count and chunk_data done" << std::endl;
|
||||
|
||||
auto sub_qr = [&] {
|
||||
if (field_meta.get_data_type() == DataType::VECTOR_FLOAT) {
|
||||
std::cout << log_prefix << "SegmentSealedImpl FloatSearchBruteForce ..." << std::endl;
|
||||
return query::FloatSearchBruteForce(dataset, chunk_data, row_count, bitset);
|
||||
} else {
|
||||
std::cout << log_prefix << "SegmentSealedImpl BinarySearchBruteForce ..." << std::endl;
|
||||
return query::BinarySearchBruteForce(dataset, chunk_data, row_count, bitset);
|
||||
}
|
||||
}();
|
||||
|
||||
SearchResult results;
|
||||
results.distances_ = std::move(sub_qr.mutable_distances());
|
||||
std::cout << log_prefix << "SegmentSealedImpl results.distances_ done" << std::endl;
|
||||
results.ids_ = std::move(sub_qr.mutable_ids());
|
||||
std::cout << log_prefix << "SegmentSealedImpl results.ids_ done" << std::endl;
|
||||
results.topk_ = dataset.topk;
|
||||
std::cout << log_prefix << "SegmentSealedImpl results.topk done, topk = " << results.topk_ << std::endl;
|
||||
results.num_queries_ = dataset.num_queries;
|
||||
std::cout << log_prefix << "SegmentSealedImpl results.num_queries done, nq = " << results.num_queries_ << std::endl;
|
||||
|
||||
output = std::move(results);
|
||||
std::cout << log_prefix << "SegmentSealedImpl move results done" << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -420,31 +401,24 @@ SegmentSealedImpl::DropIndex(const FieldId field_id) {
|
|||
|
||||
void
|
||||
SegmentSealedImpl::check_search(const query::Plan* plan) const {
|
||||
const std::string log_prefix = "[TODO: remove] debug #14077, segment_id = " + std::to_string(id_) + ", ";
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search check_search..., planPtr = " << plan << std::endl;
|
||||
AssertInfo(plan, "Search plan is null");
|
||||
AssertInfo(plan->extra_info_opt_.has_value(), "Extra info of search plan doesn't have value");
|
||||
|
||||
if (!is_system_field_ready()) {
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search is_system_field_ready done" << std::endl;
|
||||
PanicInfo("System Field RowID or Timestamp is not loaded");
|
||||
}
|
||||
|
||||
auto& request_fields = plan->extra_info_opt_.value().involved_fields_;
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search request_fields done" << std::endl;
|
||||
auto field_ready_bitset = field_data_ready_bitset_ | vecindex_ready_bitset_;
|
||||
AssertInfo(request_fields.size() == field_ready_bitset.size(),
|
||||
"Request fields size not equal to field ready bitset size when check search");
|
||||
auto absent_fields = request_fields - field_ready_bitset;
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search absent_fields done" << std::endl;
|
||||
|
||||
if (absent_fields.any()) {
|
||||
auto field_offset = FieldOffset(absent_fields.find_first());
|
||||
auto& field_meta = schema_->operator[](field_offset);
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search field_meta done" << std::endl;
|
||||
PanicInfo("User Field(" + field_meta.get_name().get() + ") is not loaded");
|
||||
}
|
||||
std::cout << log_prefix << "SegmentSealedImpl::check_search all done" << std::endl;
|
||||
}
|
||||
|
||||
SegmentSealedImpl::SegmentSealedImpl(SchemaPtr schema, int64_t segment_id)
|
||||
|
|
|
@ -63,26 +63,17 @@ Search(CSegmentInterface c_segment,
|
|||
uint64_t timestamp,
|
||||
CSearchResult* result,
|
||||
int64_t segment_id) {
|
||||
const std::string log_prefix = "[TODO: remove] debug #14077, segment_id = " + std::to_string(segment_id) + ", ";
|
||||
std::cout << log_prefix << "cgo::Search searching..., timestamp = " << timestamp << ", segmentPtr = " << c_segment
|
||||
<< ", planPtr = " << c_plan << ", resultPtr = " << result << std::endl;
|
||||
try {
|
||||
auto segment = (milvus::segcore::SegmentInterface*)c_segment;
|
||||
std::cout << log_prefix << "cgo::Search init segment done" << std::endl;
|
||||
auto plan = (milvus::query::Plan*)c_plan;
|
||||
std::cout << log_prefix << "cgo::Search init plan done" << std::endl;
|
||||
auto phg_ptr = reinterpret_cast<const milvus::query::PlaceholderGroup*>(c_placeholder_group);
|
||||
std::cout << log_prefix << "cgo::Search init placeHolderGroup done" << std::endl;
|
||||
auto search_result = segment->Search(plan, *phg_ptr, timestamp);
|
||||
std::cout << log_prefix << "cgo::Search done" << std::endl;
|
||||
if (!milvus::segcore::PositivelyRelated(plan->plan_node_->search_info_.metric_type_)) {
|
||||
for (auto& dis : search_result->distances_) {
|
||||
dis *= -1;
|
||||
}
|
||||
}
|
||||
std::cout << log_prefix << "cgo::Search PositivelyRelated done" << std::endl;
|
||||
*result = search_result.release();
|
||||
std::cout << log_prefix << "cgo::Search result release done" << std::endl;
|
||||
return milvus::SuccessCStatus();
|
||||
} catch (std::exception& e) {
|
||||
return milvus::FailureCStatus(UnexpectedError, e.what());
|
||||
|
|
Loading…
Reference in New Issue