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

The following examples show how to use org.apache.hadoop.hbase.HRegionInfo#isOffline() . 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: Utils.java    From presto-hbase-connector with Apache License 2.0 6 votes vote down vote up
public static List<HRegionInfo> getRegionInfosFromManifest(SnapshotManifest manifest) {
    List<SnapshotProtos.SnapshotRegionManifest> regionManifests = manifest.getRegionManifests();
    if (regionManifests == null) {
        throw new IllegalArgumentException("Snapshot seems empty");
    }

    List<HRegionInfo> regionInfos = Lists.newArrayListWithCapacity(regionManifests.size());

    for (SnapshotProtos.SnapshotRegionManifest regionManifest : regionManifests) {
        HRegionInfo hri = HRegionInfo.convert(regionManifest.getRegionInfo());
        if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) {
            continue;
        }
        regionInfos.add(hri);
    }
    return regionInfos;
}
 
Example 2
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 3
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 4
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 5
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;
}