/** * Get daughter HRegionInfo out of parent info:splitA/info:splitB columns. * @param result * @param which Whether "info:splitA" or "info:splitB" column * @return Deserialized content of the info:splitA or info:splitB as a * HRegionInfo * @throws IOException */ private HRegionInfo getDaughterRegionInfo(final Result result, final byte [] which) throws IOException { byte [] bytes = result.getValue(HConstants.CATALOG_FAMILY, which); return Writables.getHRegionInfoOrNull(bytes); }
/** * Returns the daughter regions by reading from the corresponding columns of the .META. table * Result. If the region is not a split parent region, it returns PairOfSameType(null, null). */ public static PairOfSameType<HRegionInfo> getDaughterRegions(Result data) throws IOException { HRegionInfo splitA = Writables.getHRegionInfoOrNull( data.getValue(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER)); HRegionInfo splitB = Writables.getHRegionInfoOrNull( data.getValue(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER)); return new PairOfSameType<HRegionInfo>(splitA, splitB); }
/** * Parse the content of the cell at {@link HConstants#CATALOG_FAMILY} and * <code>qualifier</code> as an HRegionInfo and return it, or null. * For use on catalog table {@link Result}. * @param r Result instance to pull from. * @param qualifier Column family qualifier -- either * {@link HConstants#SPLITA_QUALIFIER}, {@link HConstants#SPLITB_QUALIFIER} or * {@link HConstants#REGIONINFO_QUALIFIER}. * @return An HRegionInfo instance or null. * @throws IOException */ public static HRegionInfo parseHRegionInfoFromCatalogResult(final Result r, byte [] qualifier) throws IOException { byte [] bytes = r.getValue(HConstants.CATALOG_FAMILY, qualifier); if (bytes == null || bytes.length <= 0) return null; return Writables.getHRegionInfoOrNull(bytes); }
/** * Returns the daughter regions by reading the corresponding columns of the catalog table * Result. * @param data a Result object from the catalog table scan * @return a pair of HRegionInfo or PairOfSameType(null, null) if the region is not a split * parent */ public static PairOfSameType<HRegionInfo> getDaughterRegions(Result data) throws IOException { HRegionInfo splitA = Writables.getHRegionInfoOrNull(data.getValue(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER)); HRegionInfo splitB = Writables.getHRegionInfoOrNull(data.getValue(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER)); return new PairOfSameType<HRegionInfo>(splitA, splitB); }
@Override public boolean processRow(Result row) throws IOException { byte[] value = row.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER); HRegionInfo info = Writables.getHRegionInfoOrNull(value); if (info != null) { if (Bytes.equals(tableName, info.getTableName())) { value = row.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER); if (value == null) { available.set(false); return false; } regionCount.incrementAndGet(); } } return true; } };
private Result getRegionResultBlocking(HTable metaTable, long timeout, byte[] regionName) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("blocking until region is in META: " + Bytes.toStringBinary(regionName)); } long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < timeout) { Get get = new Get(regionName); Result result = metaTable.get(get); HRegionInfo info = Writables.getHRegionInfoOrNull( result.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER)); if (info != null) { return result; } try { Thread.sleep(10); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); break; } } return null; } }
@Override public final boolean processRow(Result rowResult) throws IOException { HRegionInfo info = Writables.getHRegionInfoOrNull( rowResult.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER)); if (info == null) { return true; } if (!(Bytes.equals(info.getTableName(), tableName))) { return false; } return super.processRow(rowResult); }
hasMore = rootScanner.next(results); for(KeyValue kv: results) { HRegionInfo info = Writables.getHRegionInfoOrNull(kv.getValue()); if (info != null) { metaRegions.add(info);
return; HRegionInfo h = Writables.getHRegionInfoOrNull(value); return; HRegionInfo h = Writables.getHRegionInfoOrNull(value); LOG.debug("New " + Bytes.toString(HConstants.CATALOG_FAMILY) + ":" + Bytes.toString(HConstants.REGIONINFO_QUALIFIER) + " for " +
HRegionInfo info = null; for (KeyValue kv: results) { info = Writables.getHRegionInfoOrNull(kv.getValue()); if (info == null) { LOG.warn("Region info is null for row " +
HRegionInfo hri= Writables.getHRegionInfoOrNull(hriVal); if (hri == null) { LOG.warn("Unable to close region " + hi.getRegionNameAsString()
@Override public boolean processRow(Result rowResult) throws IOException { HRegionInfo info = Writables.getHRegionInfoOrNull( rowResult.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER));