fix(db): fix cache error after load file from disk

Former-commit-id: 23dd81d168caa49451634ef7a97c6fa618c92957
This commit is contained in:
Xu Peng 2019-05-15 11:47:21 +08:00
parent 8b11855e90
commit 59544b0341

View File

@ -64,13 +64,16 @@ Status FaissExecutionEngine<IndexTrait>::Serialize() {
template<class IndexTrait>
Status FaissExecutionEngine<IndexTrait>::Load() {
auto index = zilliz::vecwise::cache::CpuCacheMgr::GetInstance()->GetIndex(location_);
bool to_cache;
if (!index) {
index = read_index(location_);
Cache();
LOG(DEBUG) << "Disk io from: " << location_;
}
pIndex_ = index->data();
if (to_cache) {
Cache();
}
return Status::OK();
}