mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-02 01:06:41 +08:00
fix: SealedIndexingEntry in SealedIndexingRecord may leak without smart pointer protected (#29966)
may related issue: #29828 pr: #29932 Signed-off-by: chyezh <ye.zhen@zilliz.com>
This commit is contained in:
parent
434ac1f6d0
commit
072b11355d
@ -37,6 +37,7 @@ SearchOnSealedIndex(const Schema& schema,
|
||||
auto dim = field.get_dim();
|
||||
|
||||
AssertInfo(record.is_ready(field_id), "[SearchOnSealed]Record isn't ready");
|
||||
// Keep the field_indexing smart pointer, until all reference by raw dropped.
|
||||
auto field_indexing = record.get_field_indexing(field_id);
|
||||
AssertInfo(field_indexing->metric_type_ == search_info.metric_type_,
|
||||
"Metric type of field index isn't the same with search info");
|
||||
|
||||
@ -29,7 +29,7 @@ struct SealedIndexingEntry {
|
||||
index::IndexBasePtr indexing_;
|
||||
};
|
||||
|
||||
using SealedIndexingEntryPtr = std::unique_ptr<SealedIndexingEntry>;
|
||||
using SealedIndexingEntryPtr = std::shared_ptr<SealedIndexingEntry>;
|
||||
|
||||
struct SealedIndexingRecord {
|
||||
void
|
||||
@ -43,11 +43,11 @@ struct SealedIndexingRecord {
|
||||
field_indexings_[field_id] = std::move(ptr);
|
||||
}
|
||||
|
||||
const SealedIndexingEntry*
|
||||
const SealedIndexingEntryPtr
|
||||
get_field_indexing(FieldId field_id) const {
|
||||
std::shared_lock lck(mutex_);
|
||||
AssertInfo(field_indexings_.count(field_id), "field_id not found");
|
||||
return field_indexings_.at(field_id).get();
|
||||
return field_indexings_.at(field_id);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user