HBASE-13008 Better default for hbase.regionserver.regionSplitLimit parameter (Srikanth Srungarapu)

This commit is contained in:
Andrew Purtell 2015-02-12 10:13:38 -08:00
parent 38de2d2276
commit 7841bf73be
2 changed files with 19 additions and 2 deletions

View File

@ -333,6 +333,15 @@ possible configurations would overwhelm and obscure the important.
DelimitedKeyPrefixRegionSplitPolicy, KeyPrefixRegionSplitPolicy etc. DelimitedKeyPrefixRegionSplitPolicy, KeyPrefixRegionSplitPolicy etc.
</description> </description>
</property> </property>
<property>
<name>hbase.regionserver.regionSplitLimit</name>
<value>1000</value>
<description>
Limit for the number of regions after which no more region splitting should take place.
This is not 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 1000.
</description>
</property>
<!--ZooKeeper configuration--> <!--ZooKeeper configuration-->
<property> <property>

View File

@ -76,6 +76,10 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi
public final static String MERGE_THREADS = "hbase.regionserver.thread.merge"; public final static String MERGE_THREADS = "hbase.regionserver.thread.merge";
public final static int MERGE_THREADS_DEFAULT = 1; public final static int MERGE_THREADS_DEFAULT = 1;
public static final String REGION_SERVER_REGION_SPLIT_LIMIT =
"hbase.regionserver.regionSplitLimit";
public static final int DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT= 1000;
private final HRegionServer server; private final HRegionServer server;
private final Configuration conf; private final Configuration conf;
@ -98,8 +102,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi
super(); super();
this.server = server; this.server = server;
this.conf = server.getConfiguration(); this.conf = server.getConfiguration();
this.regionSplitLimit = conf.getInt("hbase.regionserver.regionSplitLimit", this.regionSplitLimit = conf.getInt(REGION_SERVER_REGION_SPLIT_LIMIT,
Integer.MAX_VALUE); DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT);
int largeThreads = Math.max(1, conf.getInt( int largeThreads = Math.max(1, conf.getInt(
LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT)); LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT));
@ -427,6 +431,10 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi
} }
private boolean shouldSplitRegion() { private boolean shouldSplitRegion() {
if(server.getNumberOfOnlineRegions() > 0.9*regionSplitLimit) {
LOG.warn("Total number of regions is approaching the upper limit " + regionSplitLimit + ". "
+ "Please consider taking a look at http://hbase.apache.org/book.html#ops.regionmgt");
}
return (regionSplitLimit > server.getNumberOfOnlineRegions()); return (regionSplitLimit > server.getNumberOfOnlineRegions());
} }