From 31de75cd7f34437d40bdf9e10d66295964c64f10 Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Mon, 14 Oct 2019 17:07:10 +0800 Subject: [PATCH] MS-644 - Search crashed with index-type: flat Former-commit-id: f9d38e6093357bfbb650487ca868b948f15b5656 --- .../scheduler/action/PushTaskToNeighbour.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/scheduler/action/PushTaskToNeighbour.cpp b/core/src/scheduler/action/PushTaskToNeighbour.cpp index b42234d0f6..7fbcf77afc 100644 --- a/core/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/core/src/scheduler/action/PushTaskToNeighbour.cpp @@ -110,16 +110,18 @@ Action::DefaultLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr resource, bool moved = false; // to support test task, REFACTOR - if (auto index_engine = search_task->index_engine_) { - auto location = index_engine->GetLocation(); + if (resource->type() == ResourceType::CPU) { + if (auto index_engine = search_task->index_engine_) { + auto location = index_engine->GetLocation(); - for (auto i = 0; i < res_mgr.lock()->GetNumGpuResource(); ++i) { - auto index = milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location); - if (index != nullptr) { - moved = true; - auto dest_resource = res_mgr.lock()->GetResource(ResourceType::GPU, i); - PushTaskToResource(event->task_table_item_->task, dest_resource); - break; + for (auto i = 0; i < res_mgr.lock()->GetNumGpuResource(); ++i) { + auto index = milvus::cache::GpuCacheMgr::GetInstance(i)->GetIndex(location); + if (index != nullptr) { + moved = true; + auto dest_resource = res_mgr.lock()->GetResource(ResourceType::GPU, i); + PushTaskToResource(event->task_table_item_->task, dest_resource); + break; + } } } }