Minor refactored the query admission process in the distributed version.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/d383591b Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/d383591b Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/d383591b Branch: refs/heads/dist-analyze-refactor Commit: d383591b13775c74148ca3ff31ce882b283bccf7 Parents: 70e7663 Author: Zuyu Zhang <zu...@apache.org> Authored: Mon Mar 13 02:10:58 2017 -0700 Committer: Zuyu Zhang <zu...@apache.org> Committed: Mon Mar 13 02:10:58 2017 -0700 ---------------------------------------------------------------------- query_execution/ForemanDistributed.cpp | 13 +------------ query_execution/PolicyEnforcerBase.cpp | 2 ++ 2 files changed, 3 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d383591b/query_execution/ForemanDistributed.cpp ---------------------------------------------------------------------- diff --git a/query_execution/ForemanDistributed.cpp b/query_execution/ForemanDistributed.cpp index 06fb5a1..d235170 100644 --- a/query_execution/ForemanDistributed.cpp +++ b/query_execution/ForemanDistributed.cpp @@ -165,19 +165,8 @@ void ForemanDistributed::run() { const AdmitRequestMessage *request_message = static_cast<const AdmitRequestMessage*>(tagged_message.message()); - const vector<QueryHandle *> &query_handles = request_message->getQueryHandles(); - DCHECK(!query_handles.empty()); - - bool all_queries_admitted = true; - if (query_handles.size() == 1u) { - all_queries_admitted = - policy_enforcer_->admitQuery(query_handles.front()); - } else { - all_queries_admitted = policy_enforcer_->admitQueries(query_handles); - } - if (!all_queries_admitted) { + if (!policy_enforcer_->admitQueries(request_message->getQueryHandles())) { LOG(WARNING) << "The scheduler could not admit all the queries"; - // TODO(harshad) - Inform the main thread about the failure. } break; } http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d383591b/query_execution/PolicyEnforcerBase.cpp ---------------------------------------------------------------------- diff --git a/query_execution/PolicyEnforcerBase.cpp b/query_execution/PolicyEnforcerBase.cpp index 324bcb3..32f29a3 100644 --- a/query_execution/PolicyEnforcerBase.cpp +++ b/query_execution/PolicyEnforcerBase.cpp @@ -157,6 +157,8 @@ void PolicyEnforcerBase::removeQuery(const std::size_t query_id) { bool PolicyEnforcerBase::admitQueries( const std::vector<QueryHandle*> &query_handles) { + DCHECK(!query_handles.empty()); + bool all_queries_admitted = true; for (QueryHandle *curr_query : query_handles) { if (all_queries_admitted) {