From aa1b40e9249afc03bf1a2f35de4cbf67c7f9b47e Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Fri, 9 Feb 2024 12:42:55 -0500 Subject: Framework: Fixed a bug where tagged deletes didn't release the epoch --- include/framework/DynamicExtension.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'include/framework') 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, "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) { + 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; -- cgit v1.2.3