mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
size_estimates_recorder: unwrap ranges before searching for sstables
column_family::select_sstables() requires unwrapped ranges, so unwrap them. Fixes crash with Leveled Compaction Strategy. Fixes #1507. Reviewed-by: Duarte Nunes <duarte@scylladb.com> Message-Id: <1469563488-14869-1-git-send-email-avi@scylladb.com>
This commit is contained in:
Notes:
Avi Kivity
2016-07-27 10:06:46 +03:00
backport: 1.3
@@ -71,13 +71,24 @@ static std::vector<db::system_keyspace::range_estimates> estimates_for(const col
|
||||
std::vector<db::system_keyspace::range_estimates> estimates;
|
||||
estimates.reserve(local_ranges.size());
|
||||
|
||||
std::vector<query::partition_range> unwrapped;
|
||||
// Each range defines both bounds.
|
||||
for (auto& range : local_ranges) {
|
||||
int64_t count{0};
|
||||
sstables::estimated_histogram hist{0};
|
||||
for (auto&& sstable : cf.select_sstables(range)) {
|
||||
unwrapped.clear();
|
||||
if (range.is_wrap_around(dht::ring_position_comparator(*cf.schema()))) {
|
||||
auto uw = range.unwrap();
|
||||
unwrapped.push_back(std::move(uw.first));
|
||||
unwrapped.push_back(std::move(uw.second));
|
||||
} else {
|
||||
unwrapped.push_back(range);
|
||||
}
|
||||
for (auto&& uwr : unwrapped) {
|
||||
for (auto&& sstable : cf.select_sstables(uwr)) {
|
||||
count += sstable->get_estimated_key_count();
|
||||
hist.merge(sstable->get_stats_metadata().estimated_row_size);
|
||||
}
|
||||
}
|
||||
estimates.emplace_back(db::system_keyspace::range_estimates{
|
||||
range.start()->value().token(),
|
||||
|
||||
Reference in New Issue
Block a user