summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2023-06-09 11:29:58 -0400
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2023-06-09 11:29:58 -0400
commitf73a55cb2c8d8d800a379f9272a5c6b4730587a7 (patch)
treecf132c7ababab37299e6e732ea6f6e6fc87f79f5
parentcd7f2c7bee1c44e9e11ab75d6674ba5d05c6ba84 (diff)
downloaddynamic-extension-f73a55cb2c8d8d800a379f9272a5c6b4730587a7.tar.gz
Fixed bug(s) in tagging-based deletes
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/framework/DynamicExtension.h2
-rw-r--r--include/framework/InternalLevel.h1
-rw-r--r--include/shard/MemISAM.h7
-rw-r--r--include/shard/PGM.h6
-rw-r--r--include/shard/TrieSpline.h6
-rw-r--r--include/shard/WIRS.h6
-rw-r--r--include/shard/WSS.h6
-rw-r--r--tests/dynamic_extension_tests.inc17
9 files changed, 36 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 182e626..5d49a65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
set(namespace "de")
project("Practical Dynamic Extension" VERSION 0.1.0)
-set(debug true)
+set(debug false)
set(tests True)
set(bench True)
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h
index 800bc85..544cd8f 100644
--- a/include/framework/DynamicExtension.h
+++ b/include/framework/DynamicExtension.h
@@ -85,7 +85,7 @@ public:
int erase(const R &rec) {
Buffer *buffer;
- if constexpr (L == LayoutPolicy::LEVELING) {
+ if constexpr (D == DeletePolicy::TAGGING) {
auto buffer = get_buffer();
// Check the levels first. This assumes there aren't
diff --git a/include/framework/InternalLevel.h b/include/framework/InternalLevel.h
index 8554392..ec8ffc4 100644
--- a/include/framework/InternalLevel.h
+++ b/include/framework/InternalLevel.h
@@ -125,6 +125,7 @@ public:
auto res = m_shards[i]->point_lookup(rec);
if (res) {
res->set_delete();
+ return true;
}
}
}
diff --git a/include/shard/MemISAM.h b/include/shard/MemISAM.h
index 96c404e..5815fd7 100644
--- a/include/shard/MemISAM.h
+++ b/include/shard/MemISAM.h
@@ -107,8 +107,11 @@ public:
continue;
}
- //Masking off the ts.
- base->header &= 1;
+ // FIXME: this shouldn't be necessary, but the tagged record
+ // bypass doesn't seem to be working on this code-path, so this
+ // ensures that tagged records from the buffer are able to be
+ // dropped, eventually. It should only need to be &= 1
+ base->header &= 3;
m_data[m_reccnt++] = *base;
if (m_bf && base->is_tombstone()) {
++m_tombstone_cnt;
diff --git a/include/shard/PGM.h b/include/shard/PGM.h
index 8b0bd69..3d680e7 100644
--- a/include/shard/PGM.h
+++ b/include/shard/PGM.h
@@ -95,7 +95,11 @@ public:
continue;
}
- base->header &= 1;
+ // FIXME: this shouldn't be necessary, but the tagged record
+ // bypass doesn't seem to be working on this code-path, so this
+ // ensures that tagged records from the buffer are able to be
+ // dropped, eventually. It should only need to be &= 1
+ base->header &= 3;
m_data[m_reccnt++] = *base;
keys.emplace_back(base->rec.key);
diff --git a/include/shard/TrieSpline.h b/include/shard/TrieSpline.h
index 2341751..349f41a 100644
--- a/include/shard/TrieSpline.h
+++ b/include/shard/TrieSpline.h
@@ -106,7 +106,11 @@ public:
m_min_key = base->rec.key;
}
- base->header &= 1;
+ // FIXME: this shouldn't be necessary, but the tagged record
+ // bypass doesn't seem to be working on this code-path, so this
+ // ensures that tagged records from the buffer are able to be
+ // dropped, eventually. It should only need to be &= 1
+ base->header &= 3;
m_data[m_reccnt++] = *base;
bldr.AddKey(base->rec.key);
diff --git a/include/shard/WIRS.h b/include/shard/WIRS.h
index 5c651af..163311e 100644
--- a/include/shard/WIRS.h
+++ b/include/shard/WIRS.h
@@ -123,7 +123,11 @@ public:
continue;
}
- base->header &= 1;
+ // FIXME: this shouldn't be necessary, but the tagged record
+ // bypass doesn't seem to be working on this code-path, so this
+ // ensures that tagged records from the buffer are able to be
+ // dropped, eventually. It should only need to be &= 1
+ base->header &= 3;
m_data[m_reccnt++] = *base;
m_total_weight+= base->rec.weight;
diff --git a/include/shard/WSS.h b/include/shard/WSS.h
index aa6ebf0..15c8b2e 100644
--- a/include/shard/WSS.h
+++ b/include/shard/WSS.h
@@ -106,7 +106,11 @@ public:
continue;
}
- base->header &= 1;
+ // FIXME: this shouldn't be necessary, but the tagged record
+ // bypass doesn't seem to be working on this code-path, so this
+ // ensures that tagged records from the buffer are able to be
+ // dropped, eventually. It should only need to be &= 1
+ base->header &= 3;
m_data[m_reccnt++] = *base;
m_total_weight+= base->rec.weight;
weights.push_back(base->rec.weight);
diff --git a/tests/dynamic_extension_tests.inc b/tests/dynamic_extension_tests.inc
index 024f495..b9866c3 100644
--- a/tests/dynamic_extension_tests.inc
+++ b/tests/dynamic_extension_tests.inc
@@ -315,9 +315,9 @@ START_TEST(t_static_structure)
size_t reccnt = 100000;
auto ext_wirs = new DE(100, 2, 1);
- std::set<std::pair<uint64_t, uint32_t>> records;
- std::set<std::pair<uint64_t, uint32_t>> to_delete;
- std::set<std::pair<uint64_t, uint32_t>> deleted;
+ std::set<WRec> records;
+ std::set<WRec> to_delete;
+ std::set<WRec> deleted;
while (records.size() < reccnt) {
uint64_t key = rand();
@@ -325,21 +325,20 @@ START_TEST(t_static_structure)
if (records.find({key, val}) != records.end()) continue;
- records.insert({key, val});
+ records.insert({key, val, 1});
}
size_t deletes = 0;
for (auto rec : records) {
- WRec r = {rec.first, rec.second, 1};
- ck_assert_int_eq(ext_wirs->insert(r), 1);
+ ck_assert_int_eq(ext_wirs->insert(rec), 1);
if (gsl_rng_uniform(rng) < 0.05 && !to_delete.empty()) {
- std::vector<std::pair<uint64_t, uint32_t>> del_vec;
+ std::vector<WRec> del_vec;
std::sample(to_delete.begin(), to_delete.end(), std::back_inserter(del_vec), 3, std::mt19937{std::random_device{}()});
for (size_t i=0; i<del_vec.size(); i++) {
- WRec dr = {del_vec[i].first, del_vec[i].second, 1};
- ck_assert_int_eq(ext_wirs->erase(dr), 1);
+ ck_assert_int_eq(ext_wirs->erase(del_vec[i]), 1);
+
deletes++;
to_delete.erase(del_vec[i]);
deleted.insert(del_vec[i]);