quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [02/27] incubator-quickstep git commit: Bug fix in memory measurement
Date Wed, 12 Apr 2017 19:34:05 GMT
Bug fix in memory measurement

- Some NULL checks added without which we may have segmentation faults.


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

Branch: refs/heads/new-op
Commit: 18bea4aa879cd6bef4c8b92bd2ba77a0e0d8d32c
Parents: 4b04fb8
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Sun Apr 2 16:23:16 2017 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Sun Apr 2 16:23:16 2017 -0500

----------------------------------------------------------------------
 storage/AggregationOperationState.cpp | 12 +++++++++---
 storage/PartitionedHashTablePool.hpp  |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/18bea4aa/storage/AggregationOperationState.cpp
----------------------------------------------------------------------
diff --git a/storage/AggregationOperationState.cpp b/storage/AggregationOperationState.cpp
index 9388bdb..90543c4 100644
--- a/storage/AggregationOperationState.cpp
+++ b/storage/AggregationOperationState.cpp
@@ -949,9 +949,15 @@ void AggregationOperationState::finalizeHashTableImplThreadPrivate(
 std::size_t AggregationOperationState::getMemoryConsumptionBytes() const {
   std::size_t memory = getMemoryConsumptionBytesHelper(distinctify_hashtables_);
   memory += getMemoryConsumptionBytesHelper(group_by_hashtables_);
-  memory += collision_free_hashtable_->getMemoryConsumptionBytes();
-  memory += group_by_hashtable_pool_->getMemoryConsumptionPoolBytes();
-  memory += partitioned_group_by_hashtable_pool_->getMemoryConsumptionPoolBytes();
+  if (collision_free_hashtable_ != nullptr) {
+    memory += collision_free_hashtable_->getMemoryConsumptionBytes();
+  }
+  if (group_by_hashtable_pool_ != nullptr) {
+    memory += group_by_hashtable_pool_->getMemoryConsumptionPoolBytes();
+  }
+  if (partitioned_group_by_hashtable_pool_ != nullptr) {
+    memory += partitioned_group_by_hashtable_pool_->getMemoryConsumptionPoolBytes();
+  }
   return memory;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/18bea4aa/storage/PartitionedHashTablePool.hpp
----------------------------------------------------------------------
diff --git a/storage/PartitionedHashTablePool.hpp b/storage/PartitionedHashTablePool.hpp
index bfe8b8b..3ef399d 100644
--- a/storage/PartitionedHashTablePool.hpp
+++ b/storage/PartitionedHashTablePool.hpp
@@ -118,7 +118,7 @@ class PartitionedHashTablePool {
    **/
   std::size_t getMemoryConsumptionPoolBytes() const {
     std::size_t memory = 0;
-    for (std::size_t ht_id = 0; ht_id <  hash_tables_.size(); ++ht_id) {
+    for (std::size_t ht_id = 0; ht_id < hash_tables_.size(); ++ht_id) {
       if (hash_tables_[ht_id] != nullptr) {
         memory += hash_tables_[ht_id]->getMemoryConsumptionBytes();
       }


Mime
View raw message