diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2024-02-09 12:42:55 -0500 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2024-02-09 12:42:55 -0500 |
| commit | aa1b40e9249afc03bf1a2f35de4cbf67c7f9b47e (patch) | |
| tree | 5c9b6124b8c3f9f0ae2b9537890a5b4f3dd9f72e | |
| parent | 402fc269c0aaa671d84a6d15918735ad4b90e6b2 (diff) | |
| download | dynamic-extension-aa1b40e9249afc03bf1a2f35de4cbf67c7f9b47e.tar.gz | |
Framework: Fixed a bug where tagged deletes didn't release the epoch
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | include/framework/DynamicExtension.h | 19 | ||||
| -rw-r--r-- | tests/include/dynamic_extension.h | 18 |
3 files changed, 28 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 31ce10f..81fdb63 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) set(old_bench False) diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 473592d..238fc7f 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -124,12 +124,18 @@ public: * not *strictly* necessary. */ if constexpr (D == DeletePolicy::TAGGING) { - auto view = m_buffer->get_buffer_view(); static_assert(std::same_as<SCHED, SerialScheduler>, "Tagging is only supported in single-threaded operation"); - if (get_active_epoch()->get_structure()->tagged_delete(rec)) { + + auto view = m_buffer->get_buffer_view(); + + auto epoch = get_active_epoch(); + if (epoch->get_structure()->tagged_delete(rec)) { + end_job(epoch); return 1; } + end_job(epoch); + /* * the buffer will take the longest amount of time, and * probably has the lowest probability of having the record, @@ -470,6 +476,15 @@ private: do { old = m_previous_epoch.load(); + /* + * If running in single threaded mode, the failure to retire + * an Epoch will result in the thread of execution blocking + * indefinitely. + */ + if constexpr (std::same_as<SCHED, SerialScheduler>) { + if (old.epoch == epoch) assert(old.refcnt == 0); + } + if (old.epoch == epoch && old.refcnt == 0 && m_previous_epoch.compare_exchange_strong(old, new_ptr)) { break; diff --git a/tests/include/dynamic_extension.h b/tests/include/dynamic_extension.h index f0f13dd..6e9b16c 100644 --- a/tests/include/dynamic_extension.h +++ b/tests/include/dynamic_extension.h @@ -22,14 +22,16 @@ * 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> +using namespace de; +typedef DynamicExtension<R, ISAMTree<R>, rq::Query<ISAMTree<R>, R>, LayoutPolicy::TEIRING, DeletePolicy::TAGGING, SerialScheduler> DE; +*/ START_TEST(t_create) |