From 5229216464c3b41962e2f460eeeefe9cdeaceffe Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Mon, 14 Oct 2019 21:21:16 +0800 Subject: [PATCH] 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 19197b41..4b42c5ec 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 7fbcf77a..4e7dbf98 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 e99ee252..dd1557ad 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; -- GitLab