@Override public ScannerCallable getScannerCallableForReplica(int id) { ReversedScannerCallable r = new ReversedScannerCallable(getConnection(), getTableName(), this.getScan(), this.scanMetrics, rpcControllerFactory, id); r.setCaching(this.getCaching()); return r; } }
if (scan.includeStartRow() && !isEmptyStartRow(getRow())) { getConnection(), getTableName(), getRow()); this.location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { throw new IOException("Failed to find location, tableName=" + getTableName() + ", row=" + Bytes.toStringBinary(getRow()) + ", reload=" + reload); byte[] locateStartRow = createCloseRowBefore(getRow()); List<HRegionLocation> locatedRegions = locateRegionsInRange( locateStartRow, getRow(), reload); if (locatedRegions.isEmpty()) { throw new DoNotRetryIOException( "Does hbase:meta exist hole? Couldn't get regions for the range from " + Bytes.toStringBinary(locateStartRow) + " to " + Bytes.toStringBinary(getRow())); setStub(getConnection().getClient(getLocation().getServerName())); checkIfRegionServerIsRemote(); instantiated = true;
@Test public void testPrepareDoesNotUseCache() throws Exception { TableName tableName = TableName.valueOf("MyTable"); Mockito.when(connection.relocateRegion(tableName, ROW, 0)).thenReturn(regionLocations); ReversedScannerCallable callable = new ReversedScannerCallable(connection, tableName, scan, null, rpcFactory); callable.prepare(true); Mockito.verify(connection).relocateRegion(tableName, ROW, 0); }
@Override public ScannerCallable getScannerCallableForReplica(int id) { ReversedScannerCallable r = new ReversedScannerCallable(this.cConnection, this.tableName, this.getScan(), this.scanMetrics, this.locateStartRow, controllerFactory, id); r.setCaching(this.getCaching()); return r; } }
getConnection(), tableName, row); this.location = id < rl.size() ? rl.getRegionLocation(id) : null; if (this.location == null) { List<HRegionLocation> locatedRegions = locateRegionsInRange( locateStartRow, row, reload); if (locatedRegions.isEmpty()) { setStub(getConnection().getClient(getLocation().getServerName())); checkIfRegionServerIsRemote(); instantiated = true;
do { RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), currentKey); HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) {
@Override protected ReversedScannerCallable createScannerCallable() { return new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory); } }
do { RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(reload, id, getConnection(), tableName, currentKey); HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) {
@Test public void testPrepareUsesCache() throws Exception { TableName tableName = TableName.valueOf("MyTable"); Mockito.when(connection.locateRegion(tableName, ROW, true, true, 0)) .thenReturn(regionLocations); ReversedScannerCallable callable = new ReversedScannerCallable(connection, tableName, scan, null, rpcFactory); callable.prepare(false); Mockito.verify(connection).locateRegion(tableName, ROW, true, true, 0); } }
do { RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), currentKey); HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) {
@Override protected ReversedScannerCallable createScannerCallable() { return new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory); } }
if (scan.includeStartRow() && !isEmptyStartRow(getRow())) { getConnection(), getTableName(), getRow()); this.location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { throw new IOException("Failed to find location, tableName=" + getTableName() + ", row=" + Bytes.toStringBinary(getRow()) + ", reload=" + reload); byte[] locateStartRow = createCloseRowBefore(getRow()); List<HRegionLocation> locatedRegions = locateRegionsInRange( locateStartRow, getRow(), reload); if (locatedRegions.isEmpty()) { throw new DoNotRetryIOException( "Does hbase:meta exist hole? Couldn't get regions for the range from " + Bytes.toStringBinary(locateStartRow) + " to " + Bytes.toStringBinary(getRow())); setStub(getConnection().getClient(getLocation().getServerName())); checkIfRegionServerIsRemote(); instantiated = true;
@Override public ScannerCallable getScannerCallableForReplica(int id) { ReversedScannerCallable r = new ReversedScannerCallable(getConnection(), getTableName(), this.getScan(), this.scanMetrics, rpcControllerFactory, id); r.setCaching(this.getCaching()); return r; } }
@Test public void testPrepareDoesNotUseCache() throws Exception { TableName tableName = TableName.valueOf("MyTable"); Mockito.when(connection.relocateRegion(tableName, ROW, 0)).thenReturn(regionLocations); ReversedScannerCallable callable = new ReversedScannerCallable(connection, tableName, scan, null, rpcFactory); callable.prepare(true); Mockito.verify(connection).relocateRegion(tableName, ROW, 0); }
do { RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), currentKey); HRegionLocation regionLocation = id < rl.size() ? rl.getRegionLocation(id) : null; if (regionLocation != null && regionLocation.getRegionInfo().containsRow(currentKey)) {
@Override protected ReversedScannerCallable createScannerCallable() { return new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, this.rpcControllerFactory); } }
if (scan.includeStartRow() && !isEmptyStartRow(getRow())) { getConnection(), getTableName(), getRow()); this.location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { throw new IOException("Failed to find location, tableName=" + getTableName() + ", row=" + Bytes.toStringBinary(getRow()) + ", reload=" + reload); byte[] locateStartRow = createCloseRowBefore(getRow()); List<HRegionLocation> locatedRegions = locateRegionsInRange( locateStartRow, getRow(), reload); if (locatedRegions.isEmpty()) { throw new DoNotRetryIOException( "Does hbase:meta exist hole? Couldn't get regions for the range from " + Bytes.toStringBinary(locateStartRow) + " to " + Bytes.toStringBinary(getRow())); setStub(getConnection().getClient(getLocation().getServerName())); checkIfRegionServerIsRemote(); instantiated = true;
@Override public ScannerCallable getScannerCallableForReplica(int id) { ReversedScannerCallable r = new ReversedScannerCallable(getConnection(), getTableName(), this.getScan(), this.scanMetrics, rpcControllerFactory, id); r.setCaching(this.getCaching()); return r; } }
@Test public void testPrepareUsesCache() throws Exception { TableName tableName = TableName.valueOf("MyTable"); Mockito.when(connection.locateRegion(tableName, ROW, true, true, 0)) .thenReturn(regionLocations); ReversedScannerCallable callable = new ReversedScannerCallable(connection, tableName, scan, null, rpcFactory); callable.prepare(false); Mockito.verify(connection).locateRegion(tableName, ROW, true, true, 0); } }
protected ScannerCallableWithReplicas getScannerCallable(byte[] localStartKey, int nbRows, byte[] locateStartRow) { scan.setStartRow(localStartKey); ScannerCallable s = new ReversedScannerCallable(getConnection(), getTable(), scan, this.scanMetrics, locateStartRow, this.rpcControllerFactory); s.setCaching(nbRows); ScannerCallableWithReplicas sr = new ScannerCallableWithReplicas(getTable(), getConnection(), s, pool, primaryOperationTimeout, scan, getRetries(), getScannerTimeout(), caching, getConf(), caller); return sr; }