From 7841bf73be5a4170713b3f67f1315c617f30c326 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Thu, 12 Feb 2015 10:13:38 -0800 Subject: [PATCH] HBASE-13008 Better default for hbase.regionserver.regionSplitLimit parameter (Srikanth Srungarapu) --- hbase-common/src/main/resources/hbase-default.xml | 9 +++++++++ .../hbase/regionserver/CompactSplitThread.java | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml index c14bb8bd8af..f7b0bc3745a 100644 --- a/hbase-common/src/main/resources/hbase-default.xml +++ b/hbase-common/src/main/resources/hbase-default.xml @@ -333,6 +333,15 @@ possible configurations would overwhelm and obscure the important. DelimitedKeyPrefixRegionSplitPolicy, KeyPrefixRegionSplitPolicy etc. + + hbase.regionserver.regionSplitLimit + 1000 + + 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. + + diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java index 0ff52b53b2f..acf92b33d17 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java @@ -75,6 +75,10 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi // Configuration keys for merge threads public final static String MERGE_THREADS = "hbase.regionserver.thread.merge"; 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 Configuration conf; @@ -98,8 +102,8 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi super(); this.server = server; this.conf = server.getConfiguration(); - this.regionSplitLimit = conf.getInt("hbase.regionserver.regionSplitLimit", - Integer.MAX_VALUE); + this.regionSplitLimit = conf.getInt(REGION_SERVER_REGION_SPLIT_LIMIT, + DEFAULT_REGION_SERVER_REGION_SPLIT_LIMIT); int largeThreads = Math.max(1, conf.getInt( LARGE_COMPACTION_THREADS, LARGE_COMPACTION_THREADS_DEFAULT)); @@ -427,6 +431,10 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi } 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()); }