quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [2/5] incubator-quickstep git commit: Fix a bug in destroy payload
Date Fri, 21 Oct 2016 18:20:56 GMT
Fix a bug in destroy payload

- Change in pointer arithmetic now ensures that destroyPayload will be
  called for correct payload entry in each bucket.


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

Branch: refs/heads/lip-refactor
Commit: a11cdfd5d9b364cacd755ade30d1e99b51893e3b
Parents: 5b24791
Author: Harshad Deshmukh <hbdeshmukh@apache.org>
Authored: Thu Oct 20 17:06:46 2016 -0500
Committer: Harshad Deshmukh <hbdeshmukh@apache.org>
Committed: Thu Oct 20 17:06:46 2016 -0500

----------------------------------------------------------------------
 storage/FastSeparateChainingHashTable.hpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a11cdfd5/storage/FastSeparateChainingHashTable.hpp
----------------------------------------------------------------------
diff --git a/storage/FastSeparateChainingHashTable.hpp b/storage/FastSeparateChainingHashTable.hpp
index 17ee1d2..231da7e 100644
--- a/storage/FastSeparateChainingHashTable.hpp
+++ b/storage/FastSeparateChainingHashTable.hpp
@@ -141,19 +141,16 @@ class FastSeparateChainingHashTable
       HashTablePreallocationState *prealloc_state) override;
 
   void destroyPayload() override {
-    void *hash_buckets = buckets_;
     const std::size_t num_buckets =
         header_->buckets_allocated.load(std::memory_order_relaxed);
-    const std::size_t bucket_size = bucket_size_;
-    void *bucket_ptr = static_cast<char *>(hash_buckets) + kValueOffset;
+    void *bucket_ptr = static_cast<char *>(buckets_) + kValueOffset;
     for (std::size_t bucket_num = 0; bucket_num < num_buckets; ++bucket_num) {
-      void *value_internal_ptr = bucket_ptr;
       for (std::size_t handle_num = 0; handle_num < handles_.size(); ++handle_num) {
-        value_internal_ptr =
-            static_cast<char *>(value_internal_ptr) + this->payload_offsets_[handle_num];
+        void *value_internal_ptr =
+            static_cast<char *>(bucket_ptr) + this->payload_offsets_[handle_num];
         handles_[handle_num]->destroyPayload(static_cast<std::uint8_t *>(value_internal_ptr));
       }
-      bucket_ptr = static_cast<char *>(bucket_ptr) + bucket_size;
+      bucket_ptr = static_cast<char *>(bucket_ptr) + bucket_size_;
     }
   }
 


Mime
View raw message