sstables: make shard computation resilient to empty sharding metadata
Scylla metadata could be empty due to bugs like the one introduced by
115ff10. Let's make shard computation resilient to empty sharding
metadata by falling back to the approach that uses first and last
keys to compute shards.
Refs #2932.
Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <20171223120140.3642-2-raphaelsc@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
fa5a26f12d
commit
c76356fb39
@@ -2973,7 +2973,7 @@ sstable::compute_shards_for_this_sstable() const {
|
||||
const auto* sm = _components->scylla_metadata
|
||||
? _components->scylla_metadata->data.get<scylla_metadata_type::Sharding, sharding_metadata>()
|
||||
: nullptr;
|
||||
if (!sm) {
|
||||
if (!sm || sm->token_ranges.elements.empty()) {
|
||||
token_ranges.push_back(dht::partition_range::make(
|
||||
dht::ring_position::starting_at(get_first_decorated_key().token()),
|
||||
dht::ring_position::ending_at(get_last_decorated_key().token())));
|
||||
|
||||
Reference in New Issue
Block a user