Java Code Examples for org.apache.hadoop.hbase.HRegionInfo#getHRegionInfo()

The following examples show how to use org.apache.hadoop.hbase.HRegionInfo#getHRegionInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandAdapter.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
private static NavigableMap<HRegionInfo, ServerName> regionServerMap(Args args, Configuration conf,
    HConnection connection, final String tableNameParam, final boolean offlined) throws IOException {
    long timestamp = System.currentTimeMillis();

    final NavigableMap<HRegionInfo, ServerName> regions = new TreeMap<>();
    TableName tableName = TableName.valueOf(tableNameParam);
    MetaScanner.MetaScannerVisitor visitor = new MetaScanner.TableMetaScannerVisitor(tableName) {
        @Override
        public boolean processRowInternal(Result rowResult) throws IOException {
            HRegionInfo info = HRegionInfo.getHRegionInfo(rowResult);
            ServerName serverName = HRegionInfo.getServerName(rowResult);

            if (info.isOffline() && !offlined) return true;
            regions.put(info, serverName);
            return true;
        }
    };
    MetaScanner.metaScan(conf, connection, visitor, tableName);

    Util.printVerboseMessage(args, "CommandAdapter.regionServerMap", timestamp);
    return regions;
}
 
Example 2
Source File: CommandAdapter.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("UnusedParameters")
private static NavigableMap<HRegionInfo, ServerName> regionServerMap(Args args, Configuration conf, HConnection connection, final String tableNameParam, final boolean offlined) throws IOException {
    long timestamp = System.currentTimeMillis();

    final NavigableMap<HRegionInfo, ServerName> regions = new TreeMap<>();
    TableName tableName = TableName.valueOf(tableNameParam);
    MetaScanner.MetaScannerVisitor visitor = new MetaScanner.TableMetaScannerVisitor(tableName) {
        @Override
        public boolean processRowInternal(Result rowResult) throws IOException {
            HRegionInfo info = HRegionInfo.getHRegionInfo(rowResult);
            ServerName serverName = HRegionInfo.getServerName(rowResult);

            if (info.isOffline() && !offlined) return true;
            regions.put(info, serverName);
            return true;
        }
    };
    MetaScanner.metaScan(connection, visitor, tableName);

    Util.printVerboseMessage(args, "CommandAdapter.allTableRegions", timestamp);
    return regions;
}
 
Example 3
Source File: CommandAdapter.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
private static NavigableMap<HRegionInfo, ServerName> regionServerMap(Args args, Configuration conf,
    HConnection connection, final String tableNameParam, final boolean offlined) throws IOException {
    long timestamp = System.currentTimeMillis();

    final NavigableMap<HRegionInfo, ServerName> regions = new TreeMap<>();
    TableName tableName = TableName.valueOf(tableNameParam);
    MetaScanner.MetaScannerVisitor visitor = new MetaScanner.TableMetaScannerVisitor(tableName) {
        @Override
        public boolean processRowInternal(Result rowResult) throws IOException {
            HRegionInfo info = HRegionInfo.getHRegionInfo(rowResult);
            ServerName serverName = HRegionInfo.getServerName(rowResult);

            if (info.isOffline() && !offlined) return true;
            regions.put(info, serverName);
            return true;
        }
    };
    MetaScanner.metaScan(conf, connection, visitor, tableName);

    Util.printVerboseMessage(args, "CommandAdapter.regionServerMap", timestamp);
    return regions;
}
 
Example 4
Source File: CommandAdapter.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("UnusedParameters")
private static NavigableMap<HRegionInfo, ServerName> regionServerMap(Args args, Configuration conf, HConnection connection, final String tableNameParam, final boolean offlined) throws IOException {
    long timestamp = System.currentTimeMillis();

    final NavigableMap<HRegionInfo, ServerName> regions = new TreeMap<>();
    TableName tableName = TableName.valueOf(tableNameParam);
    MetaScanner.MetaScannerVisitor visitor = new MetaScanner.TableMetaScannerVisitor(tableName) {
        @Override
        public boolean processRowInternal(Result rowResult) throws IOException {
            HRegionInfo info = HRegionInfo.getHRegionInfo(rowResult);
            ServerName serverName = HRegionInfo.getServerName(rowResult);

            if (info.isOffline() && !offlined) return true;
            regions.put(info, serverName);
            return true;
        }
    };
    MetaScanner.metaScan(connection, visitor, tableName);

    Util.printVerboseMessage(args, "CommandAdapter.allTableRegions", timestamp);
    return regions;
}