@Override public RegionLocator getRegionLocator(final String tableName) throws IOException { final BigtableRegionLocator regionLocator = (BigtableRegionLocator) super.getRegionLocator(tableName); if (regionLocator != null) { // Force region update if (regionLocator.getAllRegionLocations().size() <= 1) { regionLocator.getRegionLocation(HConstants.EMPTY_BYTE_ARRAY, true); } } return regionLocator; }
/** {@inheritDoc} */ @Override public List<HRegionLocation> getAllRegionLocations() throws IOException { return getRegions(false); }
/** {@inheritDoc} */ @Override public HRegionLocation getRegionLocation(byte[] row) throws IOException { return getRegionLocation(row, false); }
/** {@inheritDoc} */ @Override public Pair<byte[][], byte[][]> getStartEndKeys() throws IOException { List<HRegionLocation> regions = getAllRegionLocations(); byte[][] startKeys = new byte[regions.size()][]; byte[][] endKeys = new byte[regions.size()][]; int i = 0; for(HRegionLocation region : regions) { startKeys[i] = region.getRegionInfo().getStartKey(); endKeys[i] = region.getRegionInfo().getEndKey(); i++; } return Pair.newPair(startKeys, endKeys); }
/** {@inheritDoc} */ @Override public byte[][] getEndKeys() throws IOException { return getStartEndKeys().getSecond(); }
private List<HRegionLocation> getRegions(boolean reload) throws IOException { try { return getRegionsAsync(reload).get(); } catch (InterruptedException e) { Thread.interrupted(); throw new IOException("getRegionLocation was interrupted"); } catch (ExecutionException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("getRegionLocation ExecutionException", e); } } }
/** {@inheritDoc} */ @Override public HRegionLocation getRegionLocation(byte[] row) throws IOException { return getRegionLocation(row, false); }
/** {@inheritDoc} */ @Override public Pair<byte[][], byte[][]> getStartEndKeys() throws IOException { List<HRegionLocation> regions = getAllRegionLocations(); byte[][] startKeys = new byte[regions.size()][]; byte[][] endKeys = new byte[regions.size()][]; int i = 0; for(HRegionLocation region : regions) { startKeys[i] = region.getRegionInfo().getStartKey(); endKeys[i] = region.getRegionInfo().getEndKey(); i++; } return Pair.newPair(startKeys, endKeys); }
/** {@inheritDoc} */ @Override public byte[][] getEndKeys() throws IOException { return getStartEndKeys().getSecond(); }
private List<HRegionLocation> getRegions(boolean reload) throws IOException { try { return getRegionsAsync(reload).get(); } catch (InterruptedException e) { Thread.interrupted(); throw new IOException("getRegionLocation was interrupted"); } catch (ExecutionException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("getRegionLocation ExecutionException", e); } } }
/** {@inheritDoc} */ @Override public byte[][] getStartKeys() throws IOException { return getStartEndKeys().getFirst(); }
/** {@inheritDoc} */ @Override public List<HRegionLocation> getAllRegionLocations() throws IOException { return getRegions(false); }
/** {@inheritDoc} */ @Override public byte[][] getStartKeys() throws IOException { return getStartEndKeys().getFirst(); }
/** {@inheritDoc} */ @Override public HRegionLocation getRegionLocation(byte[] row, boolean reload) throws IOException { for(HRegionLocation region : getRegions(reload)) { if (region.getRegionInfo().containsRow(row)) { return region; } } throw new IOException("Region not found for row: " + Bytes.toStringBinary(row)); }
/** {@inheritDoc} */ @Override public HRegionLocation getRegionLocation(byte[] row, boolean reload) throws IOException { for(HRegionLocation region : getRegions(reload)) { if (region.getRegionInfo().containsRow(row)) { return region; } } throw new IOException("Region not found for row: " + Bytes.toStringBinary(row)); }