From 83486744600e8be338c75c2e3d2339452a392a9d Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 13 Nov 2023 10:41:13 -0500 Subject: Fixed merge logic bug in tiering In InternalLevel::clone(), the m_shard_cnt variable was not being set appropriately in the clone, resulting in the record counts reported for a multi-shard level to be reported incorrectly. In DynamicExtension::merge(), the merges were being performed in the wrong order, resulting in multi-level merges deleting records. The leveling tests all passed even with this bug for some reason, but it caused tiering tests to fail. It isn't clear _why_ leveling appeared to work, but the bug is now fixed, so that's largely irrelevant I suppose. --- include/framework/DynamicExtension.h | 3 ++- include/framework/structure/InternalLevel.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include/framework') diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index a6047ea..9554c8c 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -436,11 +436,12 @@ private: MergeArgs *args = (MergeArgs *) arguments; Structure *vers = args->epoch->get_structure(); + // FIXME: with an improved shard interface, multiple full buffers // could be merged at once here. Buffer *buff = (Buffer *) args->epoch->get_buffers()[0]; - for (ssize_t i=args->merges.size() - 1; i>=0; i--) { + for (ssize_t i=0; imerges.size(); i++) { vers->merge_levels(args->merges[i].second, args->merges[i].first); } diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h index 00e0c58..d146b73 100644 --- a/include/framework/structure/InternalLevel.h +++ b/include/framework/structure/InternalLevel.h @@ -219,6 +219,7 @@ public: for (size_t i=0; im_shards[i] = m_shards[i]; } + new_level->m_shard_cnt = m_shard_cnt; return new_level; } -- cgit v1.2.3