mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 20:16:43 +00:00
storage_service: get_all_ranges: reserve enough space in ranges
Commit bc5f6cf45d
added a reserve call to the `ranges` vector before
inserting all the returned token ranges into it.
However, that reservation is too small as we need
to express size+1 ranges for size tokens with
<unbound, token[0]> and <token[size-1], unbound>
ranges at the front and back, respectively.
Fixes #14849
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Closes #14938
This commit is contained in:
@@ -6078,7 +6078,7 @@ storage_service::get_all_ranges(const std::vector<token>& sorted_tokens) const {
|
||||
co_return dht::token_range_vector();
|
||||
int size = sorted_tokens.size();
|
||||
dht::token_range_vector ranges;
|
||||
ranges.reserve(size);
|
||||
ranges.reserve(size + 1);
|
||||
ranges.push_back(dht::token_range::make_ending_with(range_bound<token>(sorted_tokens[0], true)));
|
||||
co_await coroutine::maybe_yield();
|
||||
for (int i = 1; i < size; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user