quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject incubator-quickstep git commit: Fix the hanging problem of SeparateChainingHashTable::resize()
Date Mon, 19 Feb 2018 18:37:38 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 539e1ebe0 -> d1dbb0d9b


Fix the hanging problem of SeparateChainingHashTable::resize()


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

Branch: refs/heads/master
Commit: d1dbb0d9bc2d1f001deee4039157b0be464870f4
Parents: 539e1eb
Author: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Authored: Sun Feb 18 01:16:07 2018 -0600
Committer: Jianqiao Zhu <jianqiao@cs.wisc.edu>
Committed: Sun Feb 18 01:16:07 2018 -0600

----------------------------------------------------------------------
 storage/SeparateChainingHashTable.hpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d1dbb0d9/storage/SeparateChainingHashTable.hpp
----------------------------------------------------------------------
diff --git a/storage/SeparateChainingHashTable.hpp b/storage/SeparateChainingHashTable.hpp
index 2403623..2594f61 100644
--- a/storage/SeparateChainingHashTable.hpp
+++ b/storage/SeparateChainingHashTable.hpp
@@ -243,9 +243,10 @@ class SeparateChainingHashTable : public HashTable<ValueT,
                                         HashTablePreallocationState *prealloc_state);
 
   // Determine whether it is actually necessary to resize this hash table.
-  // Checks that there is at least one unallocated bucket, and that there is
+  // Checks that there are sufficient unallocated buckets, and that there are
   // at least 'extra_variable_storage' bytes of variable-length storage free.
-  bool isFull(const std::size_t extra_variable_storage) const;
+  bool isFull(const std::size_t extra_buckets,
+              const std::size_t extra_variable_storage) const;
 
   // Helper object to manage key storage.
   HashTableKeyManager<serializable, force_key_copy> key_manager_;
@@ -1131,7 +1132,7 @@ void SeparateChainingHashTable<ValueT, resizable, serializable, force_key_copy,
   // Recheck whether the hash table is still full. Note that multiple threads
   // might wait to rebuild this hash table simultaneously. Only the first one
   // should do the rebuild.
-  if (!isFull(extra_variable_storage)) {
+  if (!isFull(extra_buckets, extra_variable_storage)) {
     return;
   }
 
@@ -1505,9 +1506,11 @@ template <typename ValueT,
           bool force_key_copy,
           bool allow_duplicate_keys>
 bool SeparateChainingHashTable<ValueT, resizable, serializable, force_key_copy, allow_duplicate_keys>
-    ::isFull(const std::size_t extra_variable_storage) const {
-  if (header_->buckets_allocated.load(std::memory_order_relaxed) >= header_->num_buckets)
{
-    // All buckets are allocated.
+    ::isFull(const std::size_t extra_buckets,
+             const std::size_t extra_variable_storage) const {
+  if (header_->buckets_allocated.load(std::memory_order_relaxed)
+          + extra_buckets >= header_->num_buckets) {
+    // Not enough buckets.
     return true;
   }
 


Mime
View raw message