mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 12:06:44 +00:00
lcs: simplify code to get candidates for higher levels
get rid of unneeded loop for dealing with suspect sstables and std::advance because vector allows random access. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -488,29 +488,11 @@ public:
|
||||
|
||||
int start = sstable_index_based_on_last_compacted_key(sstables, level, s, last_compacted_keys);
|
||||
|
||||
// look for a non-suspect keyspace to compact with, starting with where we left off last time,
|
||||
// and wrapping back to the beginning of the generation if necessary
|
||||
for (auto i = 0U; i < sstables.size(); i++) {
|
||||
// get an iterator to the element of position pos from the list get_level(level).
|
||||
auto pos = (start + i) % sstables.size();
|
||||
auto it = sstables.begin();
|
||||
std::advance(it, pos);
|
||||
auto pos = start % sstables.size();
|
||||
auto candidates = overlapping(*_schema, sstables.at(pos), get_level(level + 1));
|
||||
candidates.push_back(sstables.at(pos));
|
||||
|
||||
auto& sstable = *it;
|
||||
auto candidates = overlapping(*_schema, sstable, get_level(level + 1));
|
||||
|
||||
candidates.push_back(sstable);
|
||||
#if 0
|
||||
if (Iterables.any(candidates, suspectP))
|
||||
continue;
|
||||
if (Sets.intersection(candidates, compacting).isEmpty())
|
||||
return candidates;
|
||||
#endif
|
||||
return { candidates, true };
|
||||
}
|
||||
|
||||
// all the sstables were suspect or overlapped with something suspect
|
||||
return {};
|
||||
return { candidates, true };
|
||||
}
|
||||
|
||||
void sort_sstables_by_age(std::vector<sstables::shared_sstable>& candidates) {
|
||||
|
||||
Reference in New Issue
Block a user