From c76356fb393f736f1900de0d6ce4825c71f77cd4 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Sat, 23 Dec 2017 10:01:40 -0200 Subject: [PATCH] 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 Message-Id: <20171223120140.3642-2-raphaelsc@scylladb.com> --- sstables/sstables.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index bad83c2a80..030d0bd84f 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -2973,7 +2973,7 @@ sstable::compute_shards_for_this_sstable() const { const auto* sm = _components->scylla_metadata ? _components->scylla_metadata->data.get() : 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())));