HBASE-15327 Canary will always invoke admin.balancer() in each sniffing period 
when writeSniffing is enabled (Jianwei Cui)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/31aee19f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/31aee19f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/31aee19f

Branch: refs/heads/HBASE-14850
Commit: 31aee19f28e56070e128c1bada2d87b53e1fd656
Parents: f1fc520
Author: tedyu <yuzhih...@gmail.com>
Authored: Wed Mar 30 08:58:42 2016 -0700
Committer: tedyu <yuzhih...@gmail.com>
Committed: Wed Mar 30 08:58:42 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/tool/Canary.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/31aee19f/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
index 9a71a14..9ad7242 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
@@ -46,6 +46,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.AuthUtil;
 import org.apache.hadoop.hbase.ChoreService;
+import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -927,7 +928,12 @@ public final class Canary implements Tool {
         admin.enableTable(writeTableName);
       }
 
-      int numberOfServers = admin.getClusterStatus().getServers().size();
+      ClusterStatus status = admin.getClusterStatus();
+      int numberOfServers = status.getServersSize();
+      if (status.getServers().contains(status.getMaster())) {
+        numberOfServers -= 1;
+      }
+
       List<Pair<HRegionInfo, ServerName>> pairs =
           MetaTableAccessor.getTableRegionsAndLocations(connection, 
writeTableName);
       int numberOfRegions = pairs.size();

Reply via email to