Index: src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (revision 964968) +++ src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (working copy) @@ -56,11 +56,20 @@ private final HashSet regionsInQueue = new HashSet(); + /** + * Splitting should not take place if the total number of regions exceed this. + * This is not a hard limit to the number of regions but it is a guideline to + * stop splitting after number of online regions is greater than this. + */ + private int regionSplitLimit; + /** @param server */ public CompactSplitThread(HRegionServer server) { super(); this.server = server; this.conf = server.conf; + this.regionSplitLimit = conf.getInt("hbase.regionserver.regionSplitLimit", + Integer.MAX_VALUE); this.frequency = conf.getLong("hbase.regionserver.thread.splitcompactcheckfrequency", 20 * 1000); @@ -81,7 +90,8 @@ try { // Don't interrupt us while we are working byte [] midKey = r.compactStores(); - if (midKey != null && !this.server.isStopRequested()) { + if (shouldSplitRegion() && midKey != null && + !this.server.isStopRequested()) { split(r, midKey); } } finally { @@ -238,4 +248,15 @@ public int getCompactionQueueSize() { return compactionQueue.size(); } + + private boolean shouldSplitRegion() { + return (regionSplitLimit > server.getNumberOfOnlineRegions()); + } + + /** + * @return the regionSplitLimit + */ + public int getRegionSplitLimit() { + return this.regionSplitLimit; + } } Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 964968) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -2519,4 +2519,8 @@ HRegionServer.class); doMain(args, regionServerClass); } + + public int getNumberOfOnlineRegions() { + return onlineRegions.size(); + } } \ No newline at end of file Index: src/main/resources/hbase-default.xml =================================================================== --- src/main/resources/hbase-default.xml (revision 964968) +++ src/main/resources/hbase-default.xml (working copy) @@ -186,6 +186,15 @@ + hbase.regionserver.regionSplitLimit + 2147483647 + Limit for the number of regions after which no more region + splitting should take place. This is not a hard limit for the number of + regions but acts as a guideline for the regionserver to stop splitting after + a certain limit. Default is set to MAX_INT. + + + hbase.regionserver.logroll.period 3600000 Period at which we will roll the commit log.