From d054b21a66318e096a809c9f94bc8659acfacfd8 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 4 Feb 2025 17:47:52 -0500 Subject: Fixed a bug with leveling layout policy --- include/framework/structure/ExtensionStructure.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'include/framework/structure') diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h index 078c4a9..29a45e5 100644 --- a/include/framework/structure/ExtensionStructure.h +++ b/include/framework/structure/ExtensionStructure.h @@ -161,13 +161,15 @@ public: /* perform the reconstruction itself */ std::vector shards; for (ShardID shid : task.sources) { - assert(shid.level_idx < (level_index) m_levels.size()); + assert(shid.level_idx <= (level_index) m_levels.size()); assert(shid.shard_idx >= -1); if (shid == buffer_shid) { assert(bv); ShardType *buffer_shard = new ShardType(std::move(*bv)); shards.push_back(buffer_shard); + } else if (shid.level_idx == (level_index) m_levels.size()) { + continue; } else if (shid.shard_idx == all_shards_idx) { /* if unspecified, push all shards into the vector */ for (size_t i = 0; i < m_levels[shid.level_idx]->get_shard_count(); i++) { @@ -188,6 +190,8 @@ public: for (ShardID shid : task.sources) { if (shid == buffer_shid) { continue; + } else if (shid.level_idx == (level_index) m_levels.size()) { + continue; } else if (shid.shard_idx == all_shards_idx) { m_levels[shid.level_idx]->truncate(); } else { @@ -315,6 +319,22 @@ public: return ts_prop <= (long double) max_delete_prop; } + void print_structure() const { + for (size_t i=0; iget_shard_count(); j++) { + fprintf(stdout, "(%ld: %ld) ", j, m_levels[i]->get_shard(j)->get_record_count()); + } + } else { + fprintf(stdout, "[Empty]"); + } + + fprintf(stdout, "\n"); + } + } + private: std::atomic m_refcnt; LevelVector m_levels; -- cgit v1.2.3