elasticsearch/elasticsearch — pull request #4250 by geidies (2013-11-25 21:23:26+00:00)
Title: Deciders shouldn't loop over all shards.

Instead of using loops over all ShardRoutings, do accounting in RoutingNodes.

Speeds up recalculating cluster state on large clusters. This is the background of the patch - we have 20k+ shards in the cluster and the master sits at 100% CPU for minutes trying to apply cluster state changed events.

routing.allocation related tests pass. Compilation problem with head pulled into my master to apply changes on top? (org.elasticsearch.common.inject.Inject)
There is certainly not much elegance with the approach of using a Singleton - but this class is instantiated in one place only anyhow. There is even less elegance of using the notification from MutableShardRouting to RoutingNodes. but i guess this is what can be done without a major refactoring.