dyno
dyno copied to clipboard
Computes replication factor for complete topology (active and inactive hosts)
Pull Request for issue #195
@rprevot First off, I am unable to reproduce this problem. I have a 3 node cluster in a single dc, 1 node per rack. I took down one node in a rack and inited the client and it worked fine. Also the initWithHosts takes a subset of nodes that are active (UP) but it does try to get all the hosts and token mappings using the token map supplier. So I am not sure if taking all the hosts into account vs some hosts makes any difference. Maybe I am missing something.
Sorry for the delay ...
You can reproduce the issue on current master version (1.6.3-SNAPSHOT) :
- To enable replication factor checking, you must use local zone affinity and define a local rack.
- To encounter asymmetric topology error, the number of nodes per rack must be greater than 1.
- TokenMapSupplier.getTokens(final Set<Host> activeHosts) must provide tokens for given hosts only.
I've got the following stacktrace:
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Invalid configuration - replication factor cannot be asymmetric
at com.netflix.dyno.jedis.DynoJedisClient$Builder.startConnectionPool(DynoJedisClient.java:4059)
at com.netflix.dyno.jedis.DynoJedisClient$Builder.createConnectionPool(DynoJedisClient.java:4031)
at com.netflix.dyno.jedis.DynoJedisClient$Builder.buildDynoJedisClient(DynoJedisClient.java:4007)
at com.netflix.dyno.jedis.DynoJedisClient$Builder.build(DynoJedisClient.java:3936)
at com.nsn.ipsdb.client.TestDyno.main(TestDyno.java:123)
Caused by: java.lang.RuntimeException: Invalid configuration - replication factor cannot be asymmetric
at com.netflix.dyno.connectionpool.impl.lb.HostSelectionWithFallback.calculateReplicationFactor(HostSelectionWithFallback.java:393)
at com.netflix.dyno.connectionpool.impl.lb.HostSelectionWithFallback.initWithHosts(HostSelectionWithFallback.java:353)
at com.netflix.dyno.connectionpool.impl.ConnectionPoolImpl.initSelectionStrategy(ConnectionPoolImpl.java:627)
at com.netflix.dyno.connectionpool.impl.ConnectionPoolImpl.start(ConnectionPoolImpl.java:526)
at com.netflix.dyno.jedis.DynoJedisClient$Builder.startConnectionPool(DynoJedisClient.java:4042)
... 4 more