From 5229216464c3b41962e2f460eeeefe9cdeaceffe Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Mon, 14 Oct 2019 21:21:16 +0800 Subject: [PATCH 1/3] fix BuildIndex hang bug but not fix CreateIndex after DropIndex Former-commit-id: 70d820bc29bc59e8ca18eaf36ec7eef01cca7f36 --- core/src/scheduler/Scheduler.cpp | 2 +- .../scheduler/action/PushTaskToNeighbour.cpp | 8 +++++--- core/src/scheduler/resource/Resource.cpp | 20 +++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/core/src/scheduler/Scheduler.cpp b/core/src/scheduler/Scheduler.cpp index 19197b4168..4b42c5ec8f 100644 --- a/core/src/scheduler/Scheduler.cpp +++ b/core/src/scheduler/Scheduler.cpp @@ -97,7 +97,7 @@ void Scheduler::OnLoadCompleted(const EventPtr& event) { auto load_completed_event = std::static_pointer_cast(event); if (auto resource = event->resource_.lock()) { - resource->WakeupExecutor(); + // resource->WakeupExecutor(); auto task_table_type = load_completed_event->task_table_item_->task->label()->Type(); switch (task_table_type) { diff --git a/core/src/scheduler/action/PushTaskToNeighbour.cpp b/core/src/scheduler/action/PushTaskToNeighbour.cpp index 7fbcf77afc..4e7dbf984f 100644 --- a/core/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/core/src/scheduler/action/PushTaskToNeighbour.cpp @@ -209,9 +209,11 @@ Action::SpecifiedResourceLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr } else { auto next_res_name = task->path().Next(); auto next_res = res_mgr.lock()->GetResource(next_res_name); - if (event->task_table_item_->Move()) { - next_res->task_table().Put(task); - } + // if (event->task_table_item_->Move()) { + // next_res->task_table().Put(task); + // } + event->task_table_item_->Move(); + next_res->task_table().Put(task); } } diff --git a/core/src/scheduler/resource/Resource.cpp b/core/src/scheduler/resource/Resource.cpp index e99ee25255..dd1557adf5 100644 --- a/core/src/scheduler/resource/Resource.cpp +++ b/core/src/scheduler/resource/Resource.cpp @@ -116,15 +116,23 @@ Resource::pick_task_execute() { auto indexes = task_table_.PickToExecute(std::numeric_limits::max()); for (auto index : indexes) { // try to set one task executing, then return + // if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { + // if (task_table_[index]->task->path().Last() != name()) { + // continue; + // } + // } + // + // if (task_table_.Execute(index)) { + // return task_table_.Get(index); + // } if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { - if (task_table_[index]->task->path().Last() != name()) { - continue; + if (task_table_.Get(index)->task->path().Current() == task_table_.Get(index)->task->path().Last() && + task_table_.Get(index)->task->path().Last() == name()) { + if (task_table_.Execute(index)) { + return task_table_.Get(index); + } } } - - if (task_table_.Execute(index)) { - return task_table_.Get(index); - } // else try next } return nullptr; From 51ffa62c2e84886d857183fc6e52a6b2373d6675 Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Tue, 15 Oct 2019 16:30:43 +0800 Subject: [PATCH 2/3] MS-650 SQ8H index create issue Former-commit-id: c44fa2e78695440dc41f4cf60293a30675ebc090 --- core/CHANGELOG.md | 1 + core/src/scheduler/Scheduler.cpp | 2 +- .../scheduler/action/PushTaskToNeighbour.cpp | 6 ++-- core/src/scheduler/resource/Resource.cpp | 29 ++++++++++--------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index bbd58fb28d..4a349df4e9 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -21,6 +21,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-644 - Search crashed with index-type: flat - MS-624 - Search vectors failed if time ranges long enough - MS-652 - IVFSQH quantization double free +- MS-650 - SQ8H index create issue ## Improvement - MS-552 - Add and change the easylogging library diff --git a/core/src/scheduler/Scheduler.cpp b/core/src/scheduler/Scheduler.cpp index 4b42c5ec8f..19197b4168 100644 --- a/core/src/scheduler/Scheduler.cpp +++ b/core/src/scheduler/Scheduler.cpp @@ -97,7 +97,7 @@ void Scheduler::OnLoadCompleted(const EventPtr& event) { auto load_completed_event = std::static_pointer_cast(event); if (auto resource = event->resource_.lock()) { - // resource->WakeupExecutor(); + resource->WakeupExecutor(); auto task_table_type = load_completed_event->task_table_item_->task->label()->Type(); switch (task_table_type) { diff --git a/core/src/scheduler/action/PushTaskToNeighbour.cpp b/core/src/scheduler/action/PushTaskToNeighbour.cpp index 4e7dbf984f..67aeeaa87b 100644 --- a/core/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/core/src/scheduler/action/PushTaskToNeighbour.cpp @@ -209,9 +209,9 @@ Action::SpecifiedResourceLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr } else { auto next_res_name = task->path().Next(); auto next_res = res_mgr.lock()->GetResource(next_res_name); - // if (event->task_table_item_->Move()) { - // next_res->task_table().Put(task); - // } +// if (event->task_table_item_->Move()) { +// next_res->task_table().Put(task); +// } event->task_table_item_->Move(); next_res->task_table().Put(task); } diff --git a/core/src/scheduler/resource/Resource.cpp b/core/src/scheduler/resource/Resource.cpp index dd1557adf5..8ee7ba0b17 100644 --- a/core/src/scheduler/resource/Resource.cpp +++ b/core/src/scheduler/resource/Resource.cpp @@ -116,23 +116,23 @@ Resource::pick_task_execute() { auto indexes = task_table_.PickToExecute(std::numeric_limits::max()); for (auto index : indexes) { // try to set one task executing, then return - // if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { - // if (task_table_[index]->task->path().Last() != name()) { - // continue; - // } - // } - // - // if (task_table_.Execute(index)) { - // return task_table_.Get(index); - // } if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { - if (task_table_.Get(index)->task->path().Current() == task_table_.Get(index)->task->path().Last() && - task_table_.Get(index)->task->path().Last() == name()) { - if (task_table_.Execute(index)) { - return task_table_.Get(index); - } + if (task_table_[index]->task->path().Last() != name()) { + continue; } } + + if (task_table_.Execute(index)) { + return task_table_.Get(index); + } +// if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { +// if (task_table_.Get(index)->task->path().Current() == task_table_.Get(index)->task->path().Last() && +// task_table_.Get(index)->task->path().Last() == name()) { +// if (task_table_.Execute(index)) { +// return task_table_.Get(index); +// } +// } +// } // else try next } return nullptr; @@ -188,6 +188,7 @@ Resource::executor_function() { if (task_item->task->Type() == TaskType::BuildIndexTask) { BuildMgrInst::GetInstance()->Put(); ResMgrInst::GetInstance()->GetResource("cpu")->WakeupLoader(); + ResMgrInst::GetInstance()->GetResource("disk")->WakeupLoader(); } if (subscriber_) { From 102ec91fb46f5811114f29b72e14898ce12f7411 Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Tue, 15 Oct 2019 17:12:05 +0800 Subject: [PATCH 3/3] fix clang format Former-commit-id: 375685f93f0b9f0c28b93e3fe717c544cd3f2fb6 --- .../scheduler/action/PushTaskToNeighbour.cpp | 6 +++--- core/src/scheduler/resource/Resource.cpp | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core/src/scheduler/action/PushTaskToNeighbour.cpp b/core/src/scheduler/action/PushTaskToNeighbour.cpp index 67aeeaa87b..4e7dbf984f 100644 --- a/core/src/scheduler/action/PushTaskToNeighbour.cpp +++ b/core/src/scheduler/action/PushTaskToNeighbour.cpp @@ -209,9 +209,9 @@ Action::SpecifiedResourceLabelTaskScheduler(ResourceMgrWPtr res_mgr, ResourcePtr } else { auto next_res_name = task->path().Next(); auto next_res = res_mgr.lock()->GetResource(next_res_name); -// if (event->task_table_item_->Move()) { -// next_res->task_table().Put(task); -// } + // if (event->task_table_item_->Move()) { + // next_res->task_table().Put(task); + // } event->task_table_item_->Move(); next_res->task_table().Put(task); } diff --git a/core/src/scheduler/resource/Resource.cpp b/core/src/scheduler/resource/Resource.cpp index 8ee7ba0b17..59fd22b5d6 100644 --- a/core/src/scheduler/resource/Resource.cpp +++ b/core/src/scheduler/resource/Resource.cpp @@ -125,14 +125,15 @@ Resource::pick_task_execute() { if (task_table_.Execute(index)) { return task_table_.Get(index); } -// if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { -// if (task_table_.Get(index)->task->path().Current() == task_table_.Get(index)->task->path().Last() && -// task_table_.Get(index)->task->path().Last() == name()) { -// if (task_table_.Execute(index)) { -// return task_table_.Get(index); -// } -// } -// } + // if (task_table_[index]->task->label()->Type() == TaskLabelType::SPECIFIED_RESOURCE) { + // if (task_table_.Get(index)->task->path().Current() == task_table_.Get(index)->task->path().Last() + // && + // task_table_.Get(index)->task->path().Last() == name()) { + // if (task_table_.Execute(index)) { + // return task_table_.Get(index); + // } + // } + // } // else try next } return nullptr;