Search in sources :

Example 1 with ExplainingPredicate

use of org.apache.hadoop.hbase.Waiter.ExplainingPredicate in project hbase by apache.

the class HBaseTestingUtility method predicateNoRegionsInTransition.

/**
   * Returns a {@link Predicate} for checking that there are no regions in transition in master
   */
public ExplainingPredicate<IOException> predicateNoRegionsInTransition() {
    return new ExplainingPredicate<IOException>() {

        @Override
        public String explainFailure() throws IOException {
            final RegionStates regionStates = getMiniHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
            return "found in transition: " + regionStates.getRegionsInTransition().toString();
        }

        @Override
        public boolean evaluate() throws IOException {
            HMaster master = getMiniHBaseCluster().getMaster();
            if (master == null)
                return false;
            AssignmentManager am = master.getAssignmentManager();
            if (am == null)
                return false;
            final RegionStates regionStates = am.getRegionStates();
            return !regionStates.isRegionsInTransition();
        }
    };
}
Also used : RegionStates(org.apache.hadoop.hbase.master.RegionStates) HMaster(org.apache.hadoop.hbase.master.HMaster) AssignmentManager(org.apache.hadoop.hbase.master.AssignmentManager) ExplainingPredicate(org.apache.hadoop.hbase.Waiter.ExplainingPredicate)

Aggregations

ExplainingPredicate (org.apache.hadoop.hbase.Waiter.ExplainingPredicate)1 AssignmentManager (org.apache.hadoop.hbase.master.AssignmentManager)1 HMaster (org.apache.hadoop.hbase.master.HMaster)1 RegionStates (org.apache.hadoop.hbase.master.RegionStates)1