summaryrefslogtreecommitdiffstats
path: root/tests/include/dynamic_extension.h
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <dbr4@psu.edu>2024-12-06 13:13:51 -0500
committerGitHub <noreply@github.com>2024-12-06 18:13:51 +0000
commit9fe305c7d28e993e55c55427f377ae7e3251ea4f (patch)
tree384b687f64b84eb81bde2becac8a5f24916b07b4 /tests/include/dynamic_extension.h
parent47916da2ba5ed5bee2dda3cbcc58d39e1e931bfc (diff)
downloaddynamic-extension-9fe305c7d28e993e55c55427f377ae7e3251ea4f.tar.gz
Interface update (#5)
* Query Interface Adjustments/Refactoring Began the process of adjusting the query interface (and also the shard interface, to a lesser degree) to better accommodate the user. In particular the following changes have been made, 1. The number of necessary template arguments for the query type has been drastically reduced, while also removing the void pointers and manual delete functions from the interface. This was accomplished by requiring many of the sub-types associated with a query (parameters, etc.) to be nested inside the main query class, and by forcing the SHARD type to expose its associated record type. 2. User-defined query return types are now supported. Queries no longer are required to return strictly sets of records. Instead, the query now has LocalResultType and ResultType template parameters (which can be defaulted using a typedef in the Query type itself), allowing much more flexibility. Note that, at least for the short term, the LocalResultType must still expose the same is_deleted/is_tombstone interface as a Wrapped<R> used to, as this is currently needed for delete filtering. A better approach to this is, hopefully, forthcoming. 3. Updated the ISAMTree.h shard and rangequery.h query to use the new interfaces, and adjusted the associated unit tests as well. 4. Dropped the unnecessary "get_data()" function from the ShardInterface concept. 5. Dropped the need to specify a record type in the ShardInterface concept. This is now handled using a required Shard::RECORD member of the Shard class itself, which should expose the name of the record type. * Updates to framework to support new Query/Shard interfaces Pretty extensive adjustments to the framework, particularly to the templates themselves, along with some type-renaming work, to support the new query and shard interfaces. Adjusted the external query interface to take an rvalue reference, rather than a pointer, to the query parameters. * Removed framework-level delete filtering This was causing some issues with the new query interface, and should probably be reworked anyway, so I'm temporarily (TM) removing the feature. * Updated benchmarks + remaining code for new interface
Diffstat (limited to 'tests/include/dynamic_extension.h')
-rw-r--r--tests/include/dynamic_extension.h69
1 files changed, 38 insertions, 31 deletions
diff --git a/tests/include/dynamic_extension.h b/tests/include/dynamic_extension.h
index 6e9b16c..90c6906 100644
--- a/tests/include/dynamic_extension.h
+++ b/tests/include/dynamic_extension.h
@@ -22,18 +22,24 @@
* should be included in the source file that includes this one, above the
* include statement.
*/
-/*
-#include "testing.h"
-#include "framework/DynamicExtension.h"
-#include "framework/scheduling/SerialScheduler.h"
-#include "shard/ISAMTree.h"
-#include "query/rangequery.h"
-#include <check.h>
-using namespace de;
-typedef DynamicExtension<R, ISAMTree<R>, rq::Query<ISAMTree<R>, R>, LayoutPolicy::TEIRING, DeletePolicy::TAGGING, SerialScheduler> DE;
-*/
+
+// #include "testing.h"
+// #include "framework/DynamicExtension.h"
+// #include "framework/scheduling/SerialScheduler.h"
+// #include "shard/ISAMTree.h"
+// #include "query/rangequery.h"
+// #include <check.h>
+// #include <random>
+// #include <set>
+
+// using namespace de;
+// typedef Rec R;
+// typedef ISAMTree<R> S;
+// typedef rq::Query<S> Q;
+// typedef DynamicExtension<S, Q, LayoutPolicy::TEIRING, DeletePolicy::TAGGING, SerialScheduler> DE;
+#include "framework/util/Configuration.h"
START_TEST(t_create)
{
auto test_de = new DE(100, 1000, 2);
@@ -103,7 +109,16 @@ START_TEST(t_insert_with_mem_merges)
test_de->await_next_epoch();
ck_assert_int_eq(test_de->get_record_count(), 300);
- ck_assert_int_eq(test_de->get_height(), 1);
+
+ /*
+ * BSM grows on every flush, so the height will be different than
+ * normal layout policies
+ */
+ if (test_de->Layout == de::LayoutPolicy::BSM) {
+ ck_assert_int_eq(test_de->get_height(), 2);
+ } else {
+ ck_assert_int_eq(test_de->get_height(), 1);
+ }
delete test_de;
}
@@ -138,11 +153,12 @@ START_TEST(t_range_query)
uint64_t lower_key = keys[idx];
uint64_t upper_key = keys[idx + 250];
- rq::Parms<R> p;
+ Q::Parameters p;
+
p.lower_bound = lower_key;
p.upper_bound = upper_key;
- auto result = test_de->query(&p);
+ auto result = test_de->query(std::move(p));
auto r = result.get();
std::sort(r.begin(), r.end());
ck_assert_int_eq(r.size(), 251);
@@ -176,8 +192,6 @@ START_TEST(t_tombstone_merging_01)
records.insert({key, val});
}
- size_t deletes = 0;
- size_t cnt=0;
for (auto rec : records) {
R r = {rec.first, rec.second};
ck_assert_int_eq(test_de->insert(r), 1);
@@ -189,7 +203,6 @@ START_TEST(t_tombstone_merging_01)
for (size_t i=0; i<del_vec.size(); i++) {
R dr = {del_vec[i].first, del_vec[i].second};
test_de->erase(dr);
- deletes++;
to_delete.erase(del_vec[i]);
deleted.insert(del_vec[i]);
}
@@ -209,14 +222,14 @@ START_TEST(t_tombstone_merging_01)
}
END_TEST
-DE *create_test_tree(size_t reccnt, size_t memlevel_cnt) {
+[[maybe_unused]] static DE *create_test_tree(size_t reccnt, size_t memlevel_cnt) {
auto rng = gsl_rng_alloc(gsl_rng_mt19937);
auto test_de = new DE(1000, 10000, 2);
- std::set<R> records;
- std::set<R> to_delete;
- std::set<R> deleted;
+ std::set<Rec> records;
+ std::set<Rec> to_delete;
+ std::set<Rec> deleted;
while (records.size() < reccnt) {
uint64_t key = rand();
@@ -227,17 +240,15 @@ DE *create_test_tree(size_t reccnt, size_t memlevel_cnt) {
records.insert({key, val});
}
- size_t deletes = 0;
for (auto rec : records) {
ck_assert_int_eq(test_de->insert(rec), 1);
if (gsl_rng_uniform(rng) < 0.05 && !to_delete.empty()) {
- std::vector<R> del_vec;
+ std::vector<Rec> 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++) {
test_de->erase(del_vec[i]);
- deletes++;
to_delete.erase(del_vec[i]);
deleted.insert(del_vec[i]);
}
@@ -260,9 +271,9 @@ START_TEST(t_static_structure)
size_t reccnt = 100000;
auto test_de = new DE(100, 1000, 2);
- std::set<R> records;
- std::set<R> to_delete;
- std::set<R> deleted;
+ std::set<Rec> records;
+ std::set<Rec> to_delete;
+ std::set<Rec> deleted;
while (records.size() < reccnt) {
uint64_t key = rand();
@@ -274,15 +285,11 @@ START_TEST(t_static_structure)
}
size_t deletes = 0;
- size_t t_reccnt = 0;
- size_t k=0;
for (auto rec : records) {
- k++;
ck_assert_int_eq(test_de->insert(rec), 1);
- t_reccnt++;
if (gsl_rng_uniform(rng) < 0.05 && !to_delete.empty()) {
- std::vector<R> del_vec;
+ std::vector<Rec> 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++) {