For unit test, the region Ids created by mockClusterServers() have the same value - because all the regions are created at almost the same time.
It will take a little more time to devise appropriate test case generation and validate the balancing moves.
For the moment, I still base my improvement on the existing framework where region count plays dominant factor.
One of the goals of this JIRA is to remove randomness from LoadBalancer so that we can deterministically produce near-optimal balancing actions.
The new parameter, emptyRegionServerPresent, helps decide whether we should move old and new regions to other servers.
I will upload a new patch where I describe the above in detail. I even plan to blog about the history of
HBASE-3586 and this JIRA.
To validate my latest patch, I need a little help from community participants. Our use case creates hbase tables frequently in our flow with pre-split regions. Since those regions get round-robin assigned initially, it is not easy to reproduce what Stan experienced.
Thanks for the review and suggestion, Stack.