mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Merge branch 'jinhai' of 192.168.1.105:jinhai/vecwise_engine into jinhai
Former-commit-id: 3446551c5ae37cb4e54349d98227d5105abcb54e
This commit is contained in:
commit
41cb7fa0ec
@ -89,6 +89,7 @@ Status DBImpl::search(const std::string &group_id, size_t k, size_t nq,
|
||||
index->add_with_ids(file_index->ntotal,
|
||||
dynamic_cast<faiss::IndexFlat *>(file_index->index)->xb.data(),
|
||||
file_index->id_map.data());
|
||||
delete file_index;
|
||||
}
|
||||
|
||||
{
|
||||
@ -220,6 +221,7 @@ Status DBImpl::merge_files(const std::string& group_id, const meta::DateT& date,
|
||||
updated.push_back(file_schema);
|
||||
LOG(DEBUG) << "About to merge file " << file_schema.file_id <<
|
||||
" of size=" << file_schema.rows;
|
||||
delete file_index;
|
||||
}
|
||||
|
||||
auto index_size = group_file.dimension * index->ntotal;
|
||||
@ -301,6 +303,8 @@ Status DBImpl::build_index(const meta::GroupFileSchema& file) {
|
||||
meta::GroupFilesSchema update_files = {to_remove, group_file};
|
||||
_pMeta->update_files(update_files);
|
||||
|
||||
delete from_index;
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ Status MemVectors::serialize(std::string& group_id) {
|
||||
/* faiss::write_index(pIndex_, _file_location.c_str()); */
|
||||
group_id = schema_.group_id;
|
||||
auto rows = approximate_size();
|
||||
write_index(pIndex_, schema_.location.c_str());
|
||||
write_index(pIndex_.get(), schema_.location.c_str());
|
||||
schema_.rows = rows;
|
||||
schema_.file_type = (rows >= options_.index_trigger_size) ?
|
||||
meta::GroupFileSchema::TO_INDEX : meta::GroupFileSchema::RAW;
|
||||
@ -61,10 +61,6 @@ MemVectors::~MemVectors() {
|
||||
delete _pIdGenerator;
|
||||
_pIdGenerator = nullptr;
|
||||
}
|
||||
if (pIndex_ != nullptr) {
|
||||
delete pIndex_;
|
||||
pIndex_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -49,7 +49,7 @@ private:
|
||||
Options options_;
|
||||
meta::GroupFileSchema schema_;
|
||||
IDGenerator* _pIdGenerator;
|
||||
faiss::Index* pIndex_;
|
||||
std::shared_ptr<faiss::Index> pIndex_;
|
||||
|
||||
}; // MemVectors
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user