diff --git a/cpp/src/db/engine/ExecutionEngineImpl.cpp b/cpp/src/db/engine/ExecutionEngineImpl.cpp index 5f43b41dd2..141a3913ff 100644 --- a/cpp/src/db/engine/ExecutionEngineImpl.cpp +++ b/cpp/src/db/engine/ExecutionEngineImpl.cpp @@ -243,12 +243,9 @@ ExecutionEngineImpl::CopyToGpu(uint64_t device_id) { Status ExecutionEngineImpl::CopyToIndexFileToGpu(uint64_t device_id) { - auto index = cache::GpuCacheMgr::GetInstance(device_id)->GetIndex(location_); - bool already_in_cache = (index != nullptr); - if (!already_in_cache) { - cache::DataObjPtr obj = std::make_shared(nullptr, PhysicalSize()); - milvus::cache::GpuCacheMgr::GetInstance(device_id)->InsertItem(location_, obj); - } + auto to_index_data = std::make_shared(PhysicalSize()); + cache::DataObjPtr obj = std::static_pointer_cast(to_index_data); + milvus::cache::GpuCacheMgr::GetInstance(device_id)->InsertItem(location_, obj); return Status::OK(); } diff --git a/cpp/src/wrapper/VecImpl.h b/cpp/src/wrapper/VecImpl.h index 2be822084f..cb0172ba11 100644 --- a/cpp/src/wrapper/VecImpl.h +++ b/cpp/src/wrapper/VecImpl.h @@ -111,5 +111,16 @@ class BFIndex : public VecIndexImpl { GetRawIds(); }; +class ToIndexData : public cache::DataObj { + public: + ToIndexData(int64_t size) : size_(size) {} + + int64_t + Size() override {return size_;} + + private: + int64_t size_; +}; + } // namespace engine } // namespace milvus