quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [01/12] incubator-quickstep git commit: Minor changes in QueryManager and QueryExecutionState. [Forced Update!]
Date Sun, 27 Aug 2017 08:03:26 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/copy-to 30e0221c4 -> 1e32afc81 (forced update)


Minor changes in QueryManager and QueryExecutionState.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/09ccb7ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/09ccb7ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/09ccb7ca

Branch: refs/heads/copy-to
Commit: 09ccb7ca75dd914ece283ca6b8dc2ae759b12e48
Parents: c018882
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Sat Aug 26 13:01:12 2017 -0500
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Sat Aug 26 13:13:25 2017 -0500

----------------------------------------------------------------------
 query_execution/QueryExecutionState.hpp    | 19 ++++++++-----------
 query_execution/QueryManagerBase.cpp       |  1 -
 query_execution/QueryManagerSingleNode.cpp | 18 +++++++++---------
 query_execution/QueryManagerSingleNode.hpp |  6 ++++--
 4 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/09ccb7ca/query_execution/QueryExecutionState.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionState.hpp b/query_execution/QueryExecutionState.hpp
index a4273dc..0f98964 100644
--- a/query_execution/QueryExecutionState.hpp
+++ b/query_execution/QueryExecutionState.hpp
@@ -99,14 +99,10 @@ class QueryExecutionState {
                                const bool rebuild_initiated) {
     DCHECK(operator_index < num_operators_);
     auto search_res = rebuild_status_.find(operator_index);
-    if (search_res != rebuild_status_.end()) {
-      search_res->second.has_initiated = rebuild_initiated;
-      search_res->second.num_pending_workorders = num_rebuild_workorders;
-    } else {
-      RebuildStatus rebuild_status(rebuild_initiated, num_rebuild_workorders);
+    DCHECK(search_res != rebuild_status_.end());
 
-      rebuild_status_.emplace(operator_index, std::move(rebuild_status));
-    }
+    search_res->second.has_initiated = rebuild_initiated;
+    search_res->second.num_pending_workorders = num_rebuild_workorders;
   }
 
 #ifdef QUICKSTEP_DISTRIBUTED
@@ -272,6 +268,8 @@ class QueryExecutionState {
   inline void setRebuildRequired(const std::size_t operator_index) {
     DCHECK(operator_index < num_operators_);
     rebuild_required_[operator_index] = true;
+
+    rebuild_status_.emplace(operator_index, RebuildStatus());
   }
 
   /**
@@ -353,10 +351,9 @@ class QueryExecutionState {
   std::vector<bool> execution_finished_;
 
   struct RebuildStatus {
-    RebuildStatus(const bool initiated,
-                  const std::size_t num_workorders)
-        : has_initiated(initiated),
-          num_pending_workorders(num_workorders) {}
+    RebuildStatus()
+        : has_initiated(false),
+          num_pending_workorders(0) {}
 
     // Whether rebuild for operator at index i has been initiated.
     bool has_initiated;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/09ccb7ca/query_execution/QueryManagerBase.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerBase.cpp b/query_execution/QueryManagerBase.cpp
index 14c9ba5..f353b64 100644
--- a/query_execution/QueryManagerBase.cpp
+++ b/query_execution/QueryManagerBase.cpp
@@ -64,7 +64,6 @@ QueryManagerBase::QueryManagerBase(QueryHandle *query_handle)
     if (insert_destination_index != QueryContext::kInvalidInsertDestinationId) {
       // Rebuild is necessary whenever InsertDestination is present.
       query_exec_state_->setRebuildRequired(node_index);
-      query_exec_state_->setRebuildStatus(node_index, 0, false);
     }
 
     for (const pair<dag_node_index, bool> &dependent_link :

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/09ccb7ca/query_execution/QueryManagerSingleNode.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerSingleNode.cpp b/query_execution/QueryManagerSingleNode.cpp
index 001faa8..82a0de6 100644
--- a/query_execution/QueryManagerSingleNode.cpp
+++ b/query_execution/QueryManagerSingleNode.cpp
@@ -126,22 +126,20 @@ bool QueryManagerSingleNode::initiateRebuild(const dag_node_index index)
{
   DCHECK(checkRebuildRequired(index));
   DCHECK(!checkRebuildInitiated(index));
 
-  getRebuildWorkOrders(index, workorders_container_.get());
+  const std::size_t num_rebuild_work_orders = getRebuildWorkOrders(index, workorders_container_.get());
+  DCHECK_EQ(workorders_container_->getNumRebuildWorkOrders(index), num_rebuild_work_orders);
 
   query_exec_state_->setRebuildStatus(
-      index, workorders_container_->getNumRebuildWorkOrders(index), true);
+      index, num_rebuild_work_orders, true);
 
-  return (query_exec_state_->getNumRebuildWorkOrders(index) == 0);
+  return num_rebuild_work_orders == 0;
 }
 
-void QueryManagerSingleNode::getRebuildWorkOrders(const dag_node_index index,
-                                                  WorkOrdersContainer *container) {
+std::size_t QueryManagerSingleNode::getRebuildWorkOrders(const dag_node_index index,
+                                                         WorkOrdersContainer *container)
{
   const RelationalOperator &op = query_dag_->getNodePayload(index);
   const QueryContext::insert_destination_id insert_destination_index = op.getInsertDestinationID();
-
-  if (insert_destination_index == QueryContext::kInvalidInsertDestinationId) {
-    return;
-  }
+  DCHECK_NE(insert_destination_index, QueryContext::kInvalidInsertDestinationId);
 
   std::vector<MutableBlockReference> partially_filled_block_refs;
   std::vector<partition_id> part_ids;
@@ -165,6 +163,8 @@ void QueryManagerSingleNode::getRebuildWorkOrders(const dag_node_index
index,
                              bus_),
         index);
   }
+
+  return partially_filled_block_refs.size();
 }
 
 std::size_t QueryManagerSingleNode::getQueryMemoryConsumptionBytes() const {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/09ccb7ca/query_execution/QueryManagerSingleNode.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerSingleNode.hpp b/query_execution/QueryManagerSingleNode.hpp
index 6c5e38e..f9d038b 100644
--- a/query_execution/QueryManagerSingleNode.hpp
+++ b/query_execution/QueryManagerSingleNode.hpp
@@ -122,9 +122,11 @@ class QueryManagerSingleNode final : public QueryManagerBase {
    * @param index The index of the operator in the query plan DAG.
    * @param container A pointer to a WorkOrdersContainer to be used to store the
    *        generated WorkOrders.
+   *
+   * @return The number of generated rebuild work orders.
    **/
-  void getRebuildWorkOrders(const dag_node_index index,
-                            WorkOrdersContainer *container);
+  std::size_t getRebuildWorkOrders(const dag_node_index index,
+                                   WorkOrdersContainer *container);
 
   /**
    * @brief Get the total memory (in bytes) occupied by temporary relations


Mime
View raw message