summaryrefslogtreecommitdiffstats
path: root/include/framework/reconstruction/BSMPolicy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/framework/reconstruction/BSMPolicy.h')
-rw-r--r--include/framework/reconstruction/BSMPolicy.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/framework/reconstruction/BSMPolicy.h b/include/framework/reconstruction/BSMPolicy.h
index eaa374a..9ddd150 100644
--- a/include/framework/reconstruction/BSMPolicy.h
+++ b/include/framework/reconstruction/BSMPolicy.h
@@ -25,8 +25,7 @@ public:
: m_scale_factor(2), m_buffer_size(buffer_size) {}
ReconstructionVector
- get_reconstruction_tasks(const Version<ShardType, QueryType> *version,
- size_t incoming_reccnt) const override {
+ get_reconstruction_tasks(const Version<ShardType, QueryType> *version) const override {
ReconstructionVector reconstructions;
return reconstructions;
}
@@ -49,13 +48,21 @@ public:
task.target = target_level;
task.type = ReconstructionType::Merge;
+ std::vector<ShardID> source_shards;
+ size_t reccnt = 0;
+
+ source_shards.push_back({0, all_shards_idx});
+
for (level_index i = target_level; i > source_level; i--) {
if (i < (level_index)levels.size()) {
- task.add_shard({i, all_shards_idx}, levels[i]->get_record_count());
+ source_shards.push_back({i-1, all_shards_idx});
+ reccnt += levels[i-1]->get_record_count();
}
}
- reconstructions.add_reconstruction(task);
+ assert(source_shards.size() > 0);
+
+ reconstructions.add_reconstruction(source_shards, target_level, reccnt, ReconstructionType::Merge);
return reconstructions;
}
@@ -63,8 +70,8 @@ private:
level_index find_reconstruction_target(LevelVector &levels) const {
level_index target_level = invalid_level_idx;
- for (level_index i = 0; i < (level_index)levels.size(); i++) {
- if (levels[i]->get_record_count() + m_buffer_size <= capacity(i)) {
+ for (level_index i = 1; i < (level_index)levels.size(); i++) {
+ if (levels[i]->get_record_count() == 0) {
target_level = i;
break;
}