datastax/csharp-driver — pull request #12 by dshelepov (2014-02-09 04:41:22+00:00)
Title: fix CSHARP-87 and CSHARP-88

Modified round robin policies (regular and DC-aware) to maintain equal
distribution even when a live node goes down. This means increased
traffic on a mutable static variable local to the driver instance, but in
practice will only trigger if the first pick for the queried node does not
work (node is down, there is a partition or some such). This is not a
main path scenario.

Modified node behaviour in DC-aware round robin policy, such that
uninitialized nodes report they don't belong to any DC instead of the
local DC. That way newly allocated nodes will not mistakenly report that
they are "local" until they have finished initializing.

Also made a few test fixes to make round-robin-related tests more stable:

- in dc aware test, on failover to remote DC, do not assert that a
particular unique host has picked up the work, because the algorithm to
select the node there is quasi-random. Instead assert that the DC has
picked up work.

- in downgrading consistency policy, allow for some tolerance when
checking equal work distribution when a node is torn down. Due to
counter modulo shifting after metadata update, one of the nodes may
end up picking up work earlier than it would have had the ring been
stable.