summaryrefslogtreecommitdiffstats
path: root/include/framework
diff options
context:
space:
mode:
Diffstat (limited to 'include/framework')
-rw-r--r--include/framework/DynamicExtension.h8
-rw-r--r--include/framework/reconstruction/BackgroundTieringPolicy.h4
-rw-r--r--include/framework/reconstruction/TieringPolicy.h14
3 files changed, 16 insertions, 10 deletions
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h
index e97dfab..67f6ff8 100644
--- a/include/framework/DynamicExtension.h
+++ b/include/framework/DynamicExtension.h
@@ -472,12 +472,14 @@ private:
/* advance the buffer head for a flush */
args->version->advance_buffer_head(new_head);
+
} else {
// fprintf(stderr, "[I] Running background reconstruction\n");
}
/* perform all of the reconstructions */
auto structure = args->version->get_structure();
+ assert(structure);
for (size_t i = 0; i < args->tasks.size(); i++) {
reconstructions.emplace_back(structure->perform_reconstruction(args->tasks[i]));
@@ -678,9 +680,11 @@ private:
return;
}
+ auto active_version = m_active_version.load();
+
auto *args = new ReconstructionArgs<ShardType, QueryType>();
- args->version = create_version_flush(nullptr);
- args->tasks = m_config.recon_policy->get_flush_tasks(get_active_version().get());
+ args->version = create_version_flush(std::unique_ptr<StructureType>(active_version->get_structure()->copy()));
+ args->tasks = m_config.recon_policy->get_flush_tasks(active_version.get());
args->extension = this;
args->priority = ReconstructionPriority::FLUSH;
args->initial_version = INVALID_VERSION;
diff --git a/include/framework/reconstruction/BackgroundTieringPolicy.h b/include/framework/reconstruction/BackgroundTieringPolicy.h
index 5a82695..9a9ebaa 100644
--- a/include/framework/reconstruction/BackgroundTieringPolicy.h
+++ b/include/framework/reconstruction/BackgroundTieringPolicy.h
@@ -46,9 +46,7 @@ public:
for (level_index i = target_level; i > source_level; i--) {
if (lock_mngr.take_lock(i-1)) {
ReconstructionVector recon;
- size_t target_reccnt =
- (i < (level_index)levels.size()) ? levels[i]->get_record_count() : 0;
- size_t total_reccnt = levels[i - 1]->get_record_count() + target_reccnt;
+ size_t total_reccnt = levels[i - 1]->get_record_count();
std::vector<ShardID> shards;
for (ssize_t j=0; j<(ssize_t)levels[i-1]->get_shard_count(); j++) {
shards.push_back({i-1, j});
diff --git a/include/framework/reconstruction/TieringPolicy.h b/include/framework/reconstruction/TieringPolicy.h
index d8769f7..ce8130e 100644
--- a/include/framework/reconstruction/TieringPolicy.h
+++ b/include/framework/reconstruction/TieringPolicy.h
@@ -44,12 +44,16 @@ public:
}
for (level_index i = target_level; i > source_level; i--) {
- size_t target_reccnt =
- (i < (level_index)levels.size()) ? levels[i]->get_record_count() : 0;
- size_t total_reccnt = levels[i - 1]->get_record_count() + target_reccnt;
+ size_t total_reccnt = levels[i - 1]->get_record_count();
- reconstructions.add_reconstruction(i - 1, i, total_reccnt,
- ReconstructionType::Compact);
+ std::vector<ShardID> shards;
+ for (ssize_t j=0; j<(ssize_t)levels[i-1]->get_shard_count(); j++) {
+ shards.push_back({i-1, j});
+ }
+
+ if (total_reccnt > 0 || shards.size() > 0) {
+ reconstructions.add_reconstruction(shards, i, total_reccnt, ReconstructionType::Compact);
+ }
}
return reconstructions;