You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by hb...@apache.org on 2016/09/23 21:36:19 UTC
incubator-quickstep git commit: Removed unused constructor in
FastSeparateChainingHashTable.
Repository: incubator-quickstep
Updated Branches:
refs/heads/fix-fasthash-destructor [created] 29fda90cf
Removed unused constructor in FastSeparateChainingHashTable.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/29fda90c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/29fda90c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/29fda90c
Branch: refs/heads/fix-fasthash-destructor
Commit: 29fda90cf947d9f76530362996224975a141dcf4
Parents: ac3512c
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Fri Sep 23 16:35:48 2016 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Fri Sep 23 16:35:48 2016 -0500
----------------------------------------------------------------------
storage/FastSeparateChainingHashTable.hpp | 174 -------------------------
1 file changed, 174 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/29fda90c/storage/FastSeparateChainingHashTable.hpp
----------------------------------------------------------------------
diff --git a/storage/FastSeparateChainingHashTable.hpp b/storage/FastSeparateChainingHashTable.hpp
index 886a8ca..26caea3 100644
--- a/storage/FastSeparateChainingHashTable.hpp
+++ b/storage/FastSeparateChainingHashTable.hpp
@@ -67,31 +67,6 @@ class FastSeparateChainingHashTable
const std::vector<AggregationHandle *> &handles,
StorageManager *storage_manager);
- FastSeparateChainingHashTable(const std::vector<const Type *> &key_types,
- void *hash_table_memory,
- const std::size_t hash_table_memory_size,
- const bool new_hash_table,
- const bool hash_table_memory_zeroed);
-
- // Delegating constructors for single scalar keys.
- FastSeparateChainingHashTable(const Type &key_type,
- const std::size_t num_entries,
- StorageManager *storage_manager)
- : FastSeparateChainingHashTable(std::vector<const Type *>(1, &key_type),
- num_entries,
- storage_manager) {}
-
- FastSeparateChainingHashTable(const Type &key_type,
- void *hash_table_memory,
- const std::size_t hash_table_memory_size,
- const bool new_hash_table,
- const bool hash_table_memory_zeroed)
- : FastSeparateChainingHashTable(std::vector<const Type *>(1, &key_type),
- hash_table_memory,
- hash_table_memory_size,
- new_hash_table,
- hash_table_memory_zeroed) {}
-
~FastSeparateChainingHashTable() override {
DestroyValues(buckets_,
header_->buckets_allocated.load(std::memory_order_relaxed),
@@ -433,155 +408,6 @@ template <bool resizable,
bool serializable,
bool force_key_copy,
bool allow_duplicate_keys>
-FastSeparateChainingHashTable<resizable,
- serializable,
- force_key_copy,
- allow_duplicate_keys>::
- FastSeparateChainingHashTable(const std::vector<const Type *> &key_types,
- void *hash_table_memory,
- const std::size_t hash_table_memory_size,
- const bool new_hash_table,
- const bool hash_table_memory_zeroed)
- : FastHashTable<resizable,
- serializable,
- force_key_copy,
- allow_duplicate_keys>(key_types,
- hash_table_memory,
- hash_table_memory_size,
- new_hash_table,
- hash_table_memory_zeroed,
- false,
- false,
- true),
- kBucketAlignment(alignof(std::atomic<std::size_t>) < alignof(std::uint8_t)
- ? alignof(std::uint8_t)
- : alignof(std::atomic<std::size_t>)),
- kValueOffset(sizeof(std::atomic<std::size_t>) + sizeof(std::size_t)),
- key_manager_(this->key_types_, kValueOffset + sizeof(std::uint8_t)),
- bucket_size_(ComputeBucketSize(key_manager_.getFixedKeySize())) {
- // Bucket size always rounds up to the alignment requirement of the atomic
- // size_t "next" pointer at the front or a ValueT, whichever is larger.
- //
- // Make sure that the larger of the two alignment requirements also satisfies
- // the smaller.
- static_assert(
- alignof(std::atomic<std::size_t>) < alignof(std::uint8_t)
- ? alignof(std::uint8_t) % alignof(std::atomic<std::size_t>) == 0
- : alignof(std::atomic<std::size_t>) % alignof(std::uint8_t) == 0,
- "Alignment requirement of std::atomic<std::size_t> does not "
- "evenly divide with alignment requirement of ValueT.");
-
- // Give base HashTable information about what key components are stored
- // inline from 'key_manager_'.
- this->setKeyInline(key_manager_.getKeyInline());
-
- // FIXME(chasseur): If we are reconstituting a HashTable using a block of
- // memory whose start was aligned differently than the memory block that was
- // originally used (modulo alignof(Header)), we could wind up with all of our
- // data structures misaligned. If memory is inside a
- // StorageBlock/StorageBlob, this will never occur, since the StorageManager
- // always allocates slots aligned to kCacheLineBytes. Similarly, this isn't
- // a problem for memory inside any other allocation aligned to at least
- // alignof(Header) == kCacheLineBytes.
-
- void *aligned_memory_start = this->hash_table_memory_;
- std::size_t available_memory = this->hash_table_memory_size_;
-
- if (align(alignof(Header),
- sizeof(Header),
- aligned_memory_start,
- available_memory) == nullptr) {
- FATAL_ERROR("Attempted to create a non-resizable "
- << "SeparateChainingHashTable with "
- << available_memory
- << " bytes of memory at "
- << aligned_memory_start
- << " which either can not fit a "
- << "SeparateChainingHashTable::Header or meet its alignement "
- << "requirement.");
- } else if (aligned_memory_start != this->hash_table_memory_) {
- // In general, we could get memory of any alignment, although at least
- // cache-line aligned would be nice.
- DEV_WARNING("StorageBlob memory adjusted by "
- << (this->hash_table_memory_size_ - available_memory)
- << " bytes to meet alignment requirement for "
- << "SeparateChainingHashTable::Header.");
- }
-
- header_ = static_cast<Header *>(aligned_memory_start);
- aligned_memory_start =
- static_cast<char *>(aligned_memory_start) + sizeof(Header);
- available_memory -= sizeof(Header);
-
- if (new_hash_table) {
- std::size_t estimated_bucket_capacity =
- available_memory /
- (kHashTableLoadFactor * sizeof(std::atomic<std::size_t>) +
- bucket_size_ + key_manager_.getEstimatedVariableKeySize());
- std::size_t num_slots = get_previous_prime_number(
- estimated_bucket_capacity * kHashTableLoadFactor);
-
- // Fill in the header.
- header_->num_slots = num_slots;
- header_->num_buckets = num_slots / kHashTableLoadFactor;
- header_->buckets_allocated.store(0, std::memory_order_relaxed);
- header_->variable_length_bytes_allocated.store(0,
- std::memory_order_relaxed);
- }
-
- // Locate the slot array.
- slots_ = static_cast<std::atomic<std::size_t> *>(aligned_memory_start);
- aligned_memory_start = static_cast<char *>(aligned_memory_start) +
- sizeof(std::atomic<std::size_t>) * header_->num_slots;
- available_memory -= sizeof(std::atomic<std::size_t>) * header_->num_slots;
-
- if (new_hash_table && !hash_table_memory_zeroed) {
- std::memset(
- slots_, 0x0, sizeof(std::atomic<std::size_t>) * header_->num_slots);
- }
-
- // Locate the buckets.
- buckets_ = aligned_memory_start;
- // Extra-paranoid: sizeof(Header) should almost certainly be a multiple of
- // kBucketAlignment, unless ValueT has some members with seriously big
- // (> kCacheLineBytes) alignment requirements specified using alignas().
- if (align(kBucketAlignment, bucket_size_, buckets_, available_memory) ==
- nullptr) {
- FATAL_ERROR("Attempted to create a non-resizable "
- << "SeparateChainingHashTable with "
- << this->hash_table_memory_size_
- << " bytes of memory at "
- << this->hash_table_memory_
- << ", which can hold an aligned "
- << "SeparateChainingHashTable::Header but does not have "
- << "enough remaining space for even a single hash bucket.");
- } else if (buckets_ != aligned_memory_start) {
- DEV_WARNING(
- "Bucket array start position adjusted to meet alignment "
- "requirement for SeparateChainingHashTable's value type.");
- if (header_->num_buckets * bucket_size_ > available_memory) {
- DEBUG_ASSERT(new_hash_table);
- --(header_->num_buckets);
- }
- }
- available_memory -= bucket_size_ * header_->num_buckets;
-
- // Make sure "next" pointers in buckets are zeroed-out.
- if (new_hash_table && !hash_table_memory_zeroed) {
- std::memset(buckets_, 0x0, header_->num_buckets * bucket_size_);
- }
-
- // Locate variable-length key storage region.
- key_manager_.setVariableLengthStorageInfo(
- static_cast<char *>(buckets_) + header_->num_buckets * bucket_size_,
- available_memory,
- &(header_->variable_length_bytes_allocated));
-}
-
-template <bool resizable,
- bool serializable,
- bool force_key_copy,
- bool allow_duplicate_keys>
void FastSeparateChainingHashTable<resizable,
serializable,
force_key_copy,