From c867d59aaf61bb1a0839d34b56935f52c0fc6e00 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 9 May 2023 15:13:35 -0400 Subject: Dynamic Extension unit tests + bugfixes --- include/framework/DynamicExtension.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'include/framework/DynamicExtension.h') diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 93de24f..ed01e47 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "framework/MutableBuffer.h" #include "framework/InternalLevel.h" @@ -42,7 +42,7 @@ static constexpr bool LSM_REJ_SAMPLE = false; // True for leveling, false for tiering static constexpr bool LSM_LEVELING = false; -static constexpr bool DELETE_TAGGING = true; +static constexpr bool DELETE_TAGGING = false; // TODO: Replace the constexpr bools above // with template parameters based on these @@ -107,7 +107,7 @@ public: int append(const K& key, const V& val, W weight, bool tombstone, gsl_rng *rng) { // NOTE: single-threaded implementation only MutableBuffer *buffer; - while (!(buffer = buffer())) + while (!(buffer = get_buffer())) ; if (buffer->is_full()) { @@ -138,8 +138,8 @@ public: shards.push_back({{-1, -1}, nullptr}); states.push_back(nullptr); - std::vector shard_weights; - shard_weights.push_back(buffer_weight); + std::vector shard_weights; + shard_weights.push_back((double) buffer_weight); for (auto &level : m_levels) { level->get_shard_weights(shard_weights, shards, states, lower_key, upper_key); @@ -153,10 +153,13 @@ public: } double tot_weight = std::accumulate(shard_weights.begin(), shard_weights.end(), 0); - for (auto& w: shard_weights) w /= tot_weight; + std::vector normalized_weights(shard_weights.size()); + for (size_t i=0; i shard_samples(shard_weights.size(), 0); @@ -214,13 +217,13 @@ public: shards[i].second->get_samples(states[i], results, lower_key, upper_key, shard_samples[i], rng); - for (size_t i=0; iis_tombstone() || is_deleted(results[i], shards[i].first, buffer, buffer_cutoff)) { + for (size_t j=0; jkey < lower_bound || record->key > upper_bound) { bounds_rejections++; return true; - } else if (is_deleted(record, shid, buffer, buffer, buffer_cutoff)) { + } else if (is_deleted(record, shid, buffer, buffer_cutoff)) { deletion_rejections++; return true; } @@ -431,8 +434,7 @@ private: size_t new_shard_cnt = (LSM_LEVELING) ? 1 : m_scale_factor; new_idx = m_levels.size(); if (new_idx > 0) { - auto res = m_levels[new_idx - 1]->get_shard(0)->get_tombstone_count(); - assert(res == 0); + assert(m_levels[new_idx - 1]->get_shard(0)->get_tombstone_count() == 0); } m_levels.emplace_back(new InternalLevel(new_idx, new_shard_cnt, DELETE_TAGGING)); @@ -453,7 +455,7 @@ private: merge_buffer_into_l0(buffer, rng); enforce_delete_maximum(0, rng); - buffer->tshardcate(); + buffer->truncate(); return; } -- cgit v1.2.3