elasticsearch/elasticsearch — pull request #4866 by s1monw (2014-01-23 14:50:52+00:00)
Title: Make shard balancing deterministic if weights are identical

It happens to be the case that the iteration order of a HashMaps
keyset might be different across runs. This can cause undeterministic
results in shard balancing if weights are identical and multiple shards
of the same index are eligable for relocation. This commit adds
a tie-breaker based on the shard ID to prioritise the lowest shard
ID. This also makes `AddIncrementallyTests#testAddNodesAndIndices`
reproducible.