From ba65c8976f54d4da2467074235a12f5be0bd5ebc Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sun, 22 Dec 2024 15:12:13 -0500 Subject: Continued development --- tests/include/concurrent_extension.h | 78 +++++++++--------------------------- 1 file changed, 20 insertions(+), 58 deletions(-) (limited to 'tests/include/concurrent_extension.h') diff --git a/tests/include/concurrent_extension.h b/tests/include/concurrent_extension.h index d99cd23..84f816d 100644 --- a/tests/include/concurrent_extension.h +++ b/tests/include/concurrent_extension.h @@ -22,24 +22,28 @@ * 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/FIFOScheduler.h" -// #include "shard/ISAMTree.h" -// #include "query/rangequery.h" -// #include -// #include -// #include +#include "framework/reconstruction/ReconstructionPolicy.h" +#include "framework/reconstruction/TieringPolicy.h" +#include "testing.h" +#include "framework/DynamicExtension.h" +#include "framework/scheduling/FIFOScheduler.h" +#include "shard/ISAMTree.h" +#include "query/rangequery.h" +#include +#include +#include // using namespace de; // typedef Rec R; // typedef ISAMTree S; // typedef rq::Query Q; -// typedef DynamicExtension DE; //, FIFOScheduler> DE; +// typedef DynamicExtension DE; +// ReconstructionPolicy *recon = new TieringPolicy(2, 1000); +// ReconstructionPolicy *recon2 = new TieringPolicy(4, 10000); START_TEST(t_create) { - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); ck_assert_ptr_nonnull(test_de); ck_assert_int_eq(test_de->get_record_count(), 0); @@ -52,7 +56,7 @@ END_TEST START_TEST(t_insert) { - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); uint64_t key = 0; uint32_t val = 0; @@ -73,7 +77,7 @@ END_TEST START_TEST(t_debug_insert) { - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); uint64_t key = 0; uint32_t val = 0; @@ -92,7 +96,7 @@ END_TEST START_TEST(t_insert_with_mem_merges) { - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); uint64_t key = 0; uint32_t val = 0; @@ -135,7 +139,7 @@ END_TEST START_TEST(t_range_query) { - auto test_de = new DE(1000, 10000, 4); + auto test_de = new DE(recon2, 1000, 10000); size_t n = 10000000; std::vector keys; @@ -189,7 +193,7 @@ END_TEST START_TEST(t_tombstone_merging_01) { size_t reccnt = 100000; - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); auto rng = gsl_rng_alloc(gsl_rng_mt19937); @@ -242,54 +246,12 @@ START_TEST(t_tombstone_merging_01) } END_TEST -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 records; - std::set to_delete; - std::set deleted; - - while (records.size() < reccnt) { - uint64_t key = rand(); - uint32_t val = rand(); - - if (records.find({key, val}) != records.end()) continue; - - records.insert({key, val}); - } - - 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 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; ierase(del_vec[i]); - to_delete.erase(del_vec[i]); - deleted.insert(del_vec[i]); - } - } - - if (gsl_rng_uniform(rng) < 0.25 && deleted.find(rec) == deleted.end()) { - to_delete.insert(rec); - } - } - - gsl_rng_free(rng); - - return test_de; -} - START_TEST(t_static_structure) { auto rng = gsl_rng_alloc(gsl_rng_mt19937); size_t reccnt = 100000; - auto test_de = new DE(100, 1000, 2); + auto test_de = new DE(recon, 100, 1000); std::set records; std::set to_delete; -- cgit v1.2.3