Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public enum OperationStatusCode {
/** Cluster is in distributed mode or not */
public static final String CLUSTER_DISTRIBUTED = "hbase.cluster.distributed";

/** Config for balancing the cluster parallel*/
public static final String BALANCE_PARALLEL_REGIONS = "hbase.master.balance.parallel.regions";

/** Config for pluggable load balancers */
public static final String HBASE_MASTER_LOADBALANCER_CLASS = "hbase.master.loadbalancer.class";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ public class HMaster extends HRegionServer implements MasterServices {

// Cached clusterId on stand by masters to serve clusterID requests from clients.
private final CachedClusterId cachedClusterId;
private int balanceParallelRegions;

/**
* Initializes the HMaster. The steps are as follows:
Expand Down Expand Up @@ -484,6 +485,7 @@ public HMaster(final Configuration conf) throws IOException {
this.activeMasterManager = createActiveMasterManager(zooKeeper, serverName, this);

cachedClusterId = new CachedClusterId(this, conf);
this.balanceParallelRegions = conf.getInt(HConstants.BALANCE_PARALLEL_REGIONS, 5);
} catch (Throwable t) {
// Make sure we log the exception. HMaster is often started via reflection and the
// cause of failed startup is lost.
Expand Down Expand Up @@ -1763,10 +1765,9 @@ public boolean balance(boolean force) throws IOException {
// ignore the force flag in that case
boolean metaInTransition = assignmentManager.isMetaRegionInTransition();
List<RegionStateNode> toPrint = regionsInTransition;
int max = 5;
boolean truncated = false;
if (regionsInTransition.size() > max) {
toPrint = regionsInTransition.subList(0, max);
if (regionsInTransition.size() > this.balanceParallelRegions) {
toPrint = regionsInTransition.subList(0, this.balanceParallelRegions);
truncated = true;
}
if (!force || metaInTransition) {
Expand Down