From 5f8b5e8d31032b16c3c43094985129b6cd0968b0 Mon Sep 17 00:00:00 2001 From: Jeremy Corbett Date: Wed, 10 Jul 2024 09:45:05 -0700 Subject: [PATCH] Match simple replication strategy in the old version of the gem --- .../cluster/schema/replication_strategies/simple.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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