Add error msgs in segcore (#8410)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
pull/8425/head
yukun 2021-09-23 18:59:54 +08:00 committed by GitHub
parent 2aa9deda1c
commit 3c77eda7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -45,7 +45,7 @@ FloatSearch(const segcore::SegmentGrowingImpl& segment,
auto vecfield_offset = info.field_offset_;
auto& field = schema[vecfield_offset];
Assert(field.get_data_type() == DataType::VECTOR_FLOAT);
AssertInfo(field.get_data_type() == DataType::VECTOR_FLOAT, "[FloatSearch]Field data type isn't VECTOR_FLOAT");
auto dim = field.get_dim();
auto topk = info.topk_;
auto total_count = topk * num_queries;
@ -64,7 +64,8 @@ FloatSearch(const segcore::SegmentGrowingImpl& segment,
auto max_indexed_id = indexing_record.get_finished_ack();
const auto& field_indexing = indexing_record.get_vec_field_indexing(vecfield_offset);
auto search_conf = field_indexing.get_search_params(topk);
Assert(vec_ptr->get_size_per_chunk() == field_indexing.get_size_per_chunk());
AssertInfo(vec_ptr->get_size_per_chunk() == field_indexing.get_size_per_chunk(),
"[FloatSearch]Chunk size of vector not equal to chunk size of field index");
for (int chunk_id = current_chunk_id; chunk_id < max_indexed_id; ++chunk_id) {
auto size_per_chunk = field_indexing.get_size_per_chunk();
@ -144,7 +145,7 @@ BinarySearch(const segcore::SegmentGrowingImpl& segment,
auto vecfield_offset = info.field_offset_;
auto& field = schema[vecfield_offset];
Assert(field.get_data_type() == DataType::VECTOR_BINARY);
AssertInfo(field.get_data_type() == DataType::VECTOR_BINARY, "[BinarySearch]Field data type isn't VECTOR_BINARY");
auto dim = field.get_dim();
auto topk = info.topk_;
auto total_count = topk * num_queries;
@ -197,7 +198,7 @@ SearchOnGrowing(const segcore::SegmentGrowingImpl& segment,
SearchResult& results) {
// TODO: add data_type to info
auto data_type = segment.get_schema()[info.field_offset_].get_data_type();
Assert(datatype_is_vector(data_type));
AssertInfo(datatype_is_vector(data_type), "[SearchOnGrowing]Data type isn't vector type");
if (data_type == DataType::VECTOR_FLOAT) {
auto typed_data = reinterpret_cast<const float*>(query_data);
FloatSearch(segment, info, typed_data, num_queries, ins_barrier, bitset, results);

View File

@ -43,7 +43,7 @@ AssembleNegBitset(const BitsetSimple& bitset_simple) {
auto acc_byte_count = 0;
for (auto& bitset : bitset_simple) {
auto size = bitset.size();
Assert(size % 8 == 0);
AssertInfo(size % 8 == 0, "[AssembleNegBitset]Bitset size isn't times of 8");
auto byte_count = size / 8;
auto src_ptr = boost_ext::get_data(bitset);
memcpy(result.data() + acc_byte_count, src_ptr, byte_count);
@ -73,9 +73,10 @@ SearchOnSealed(const Schema& schema,
// Assert(field.get_data_type() == DataType::VECTOR_FLOAT);
auto dim = field.get_dim();
Assert(record.is_ready(field_offset));
AssertInfo(record.is_ready(field_offset), "[SearchOnSealed]Record isn't ready");
auto field_indexing = record.get_field_indexing(field_offset);
Assert(field_indexing->metric_type_ == search_info.metric_type_);
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);
@ -85,7 +86,8 @@ SearchOnSealed(const Schema& schema,
conf[milvus::knowhere::Metric::TYPE] = MetricTypeToName(field_indexing->metric_type_);
auto index_type = field_indexing->indexing_->index_type();
auto adapter = milvus::knowhere::AdapterMgr::GetInstance().GetAdapter(index_type);
Assert(adapter->CheckSearch(conf, index_type, field_indexing->indexing_->index_mode()));
AssertInfo(adapter->CheckSearch(conf, index_type, field_indexing->indexing_->index_mode()),
"[SearchOnSealed]Search params check failed");
return field_indexing->indexing_->Query(ds, conf, bitset);
}();