CBQE-0: enhance failover and rebalance logic with fixes to data_analysis logic

Change-Id: I39e8b65521414b872ded92b71ebe8f93a3b25199
Reviewed-on: http://review.couchbase.org/36039
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Andrei Baranouski <andrei.baranouski@gmail.com>
Reviewed-by: Parag Agarwal <agarwal.parag@gmail.com>
Tested-by: Parag Agarwal <agarwal.parag@gmail.com>