From ffbca7e200d8e7937592cd4a70d41f4d6ed9cb65 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Fri, 14 Feb 2025 15:34:39 -0500 Subject: Parallel background reconstructions appear to be working! --- include/framework/structure/InternalLevel.h | 1 - include/framework/structure/MutableBuffer.h | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'include/framework/structure') diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h index 7e8e87d..6e8b67e 100644 --- a/include/framework/structure/InternalLevel.h +++ b/include/framework/structure/InternalLevel.h @@ -200,7 +200,6 @@ public: void delete_shard(shard_index shard, bool log_delete=true) { size_t before = m_shards.size(); - fprintf(stderr, "[D]\tReconstruction deleting shard %ld %p\n", shard, m_shards[shard].first.get()); m_shards.erase(m_shards.begin() + shard); size_t after = m_shards.size(); assert( before > after); diff --git a/include/framework/structure/MutableBuffer.h b/include/framework/structure/MutableBuffer.h index 0197ecd..105f0f3 100644 --- a/include/framework/structure/MutableBuffer.h +++ b/include/framework/structure/MutableBuffer.h @@ -149,13 +149,22 @@ public: /* refuse to advance head while there is an old with one references */ if (m_old_head.load().refcnt > 0) { - // fprintf(stderr, "[W]: Refusing to advance head due to remaining - // reference counts\n"); + //fprintf(stderr, "[W]: Refusing to advance head due to remaining reference counts\n"); return false; } m_active_head_advance.store(true); + if (m_old_head.load().refcnt > 0) { + //fprintf(stderr, "[W]: Refusing to advance head due to remaining reference counts [2]\n"); + m_active_head_advance.store(false); + return false; + } + + // fprintf(stderr, "[I] Advancing head pointer: %ld %ld %ld\n", m_old_head.load().head_idx, m_head.load().head_idx, new_head); + // fprintf(stderr, "[I] Refcnts: %ld %ld\n", m_old_head.load().refcnt, m_head.load().refcnt); + + buffer_head new_hd = {new_head, 0}; buffer_head cur_hd; @@ -179,6 +188,8 @@ public: buffer_head cur_hd, new_hd; bool head_acquired = false; + + //fprintf(stderr, "[I]: getting head %ld %ld %ld\n", target_head, m_old_head.load().head_idx, m_head.load().head_idx); do { if (m_old_head.load().head_idx == target_head) { cur_hd = m_old_head.load(); -- cgit v1.2.3