Author: mbautin Date: Thu Feb 9 01:52:30 2012 New Revision: 1242204 URL: http://svn.apache.org/viewvc?rev=1242204&view=rev Log: [master] Show table level locality information in localityck
Summary: Show table level locality information in localityck Test Plan: running all the unit tests and test it on dev cluster Reviewers: kannan Reviewed By: kannan CC: hbase-eng@lists Differential Revision: https://phabricator.fb.com/D404888 Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HBaseLocalityCheck.java hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HBaseLocalityCheck.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HBaseLocalityCheck.java?rev=1242204&r1=1242203&r2=1242204&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HBaseLocalityCheck.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HBaseLocalityCheck.java Thu Feb 9 01:52:30 2012 @@ -27,7 +27,7 @@ public class HBaseLocalityCheck { * The table we want to get locality for, or null in case we wanted a check * over all */ - private final String tableName; + private String tableName = null; /** * Default constructor @@ -39,7 +39,8 @@ public class HBaseLocalityCheck { * @throws IOException * in case of file system issues */ - public HBaseLocalityCheck(Configuration conf, final String tableName) throws IOException { + public HBaseLocalityCheck(Configuration conf, final String tableName) + throws IOException { this.conf = conf; this.tableName = tableName; } @@ -62,7 +63,7 @@ public class HBaseLocalityCheck { TreeMap<String, HbckInfo> regionInfo = fsck.getRegionInfo(); // Get the locality info for each region by scanning the file system - localityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf); + localityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf, tableName); Map<String, Integer> tableToRegionCntMap = new HashMap<String, Integer>(); Map<String, Float> tableToLocalityMap = new HashMap<String, Float>(); Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1242204&r1=1242203&r2=1242204&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Thu Feb 9 01:52:30 2012 @@ -833,6 +833,28 @@ public class FSUtils { * * @param conf * the configuration to use + * @param tableName + * the table to be scanned + * @return the mapping from region encoded name to a map of server names to + * locality fraction + * @throws IOException + * in case of file system errors or interrupts + */ + public static Map<String, Map<String, Float>> getRegionDegreeLocalityMappingFromFS( + final Configuration conf, String tableName) throws IOException { + return getRegionDegreeLocalityMappingFromFS( + conf, tableName, + conf.getInt("hbase.client.localityCheck.threadPoolSize", 2)); + + } + + /** + * This function is to scan the root path of the file system to get the + * degree of locality for each region on each of the servers having at least + * one block of that region. + * + * @param conf + * the configuration to use * @param desiredTable * the table you wish to scan locality for * @param threadPoolSize
