diff --git a/lib/cassandra/cluster/schema/replication_strategies/simple.rb b/lib/cassandra/cluster/schema/replication_strategies/simple.rb index 4b2f7e5fe..15e6bdb8e 100644 --- a/lib/cassandra/cluster/schema/replication_strategies/simple.rb +++ b/lib/cassandra/cluster/schema/replication_strategies/simple.rb @@ -29,10 +29,10 @@ def replication_map(token_hosts, token_ring, replication_options) factor = size if size < factor replication_map = ::Hash.new - hosts_ring = token_ring.map { |t| token_hosts[t] } token_ring.each_with_index do |token, i| - candidates = hosts_ring.cycle(2 * size).drop(i).take(size).uniq - replication_map[token] = candidates.take(factor).freeze + replication_map[token] = factor.times.map do |j| + token_hosts[token_ring[(i + j) % size]] + end.freeze end replication_map