@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); }
static RegionLocations getRegionLocations(boolean useCache, int replicaId, ClusterConnection cConnection, TableName tableName, byte[] row) throws RetriesExhaustedException, DoNotRetryIOException, InterruptedIOException { RegionLocations rl; try { if (useCache) { rl = cConnection.locateRegion(tableName, row, true, true, replicaId); } else { rl = cConnection.relocateRegion(tableName, row, replicaId); } } catch (DoNotRetryIOException | InterruptedIOException | RetriesExhaustedException e) { throw e; } catch (IOException e) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId, e); } if (rl == null) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId); } return rl; } }
try { HRegionLocation location = getConnection().relocateRegion(getTableName(), scan.getStartRow()); LOG.info("Scanner=" + scannerId + " expired, current region location is " + location.toString());
@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); }
static RegionLocations getRegionLocations(boolean useCache, int replicaId, ClusterConnection cConnection, TableName tableName, byte[] row) throws RetriesExhaustedException, DoNotRetryIOException, InterruptedIOException { RegionLocations rl; try { if (useCache) { rl = cConnection.locateRegion(tableName, row, true, true, replicaId); } else { rl = cConnection.relocateRegion(tableName, row, replicaId); } } catch (DoNotRetryIOException | InterruptedIOException | RetriesExhaustedException e) { throw e; } catch (IOException e) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId, e); } if (rl == null) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId); } return rl; } }
while (true) { if (retried) { ((ClusterConnection) connection).relocateRegion( SchemaUtil.getPhysicalName(tableName, this.getProps()), tableKey);
@Override public RegionLocations relocateRegion(TableName tableName, byte[] row, int replicaId) throws IOException { return wrappedConnection.relocateRegion(tableName, row, replicaId); }
@Override public HRegionLocation relocateRegion(byte[] tableName, byte[] row) throws IOException { return wrappedConnection.relocateRegion(tableName, row); }
@Override public HRegionLocation relocateRegion(TableName tableName, byte[] row) throws IOException { return wrappedConnection.relocateRegion(tableName, row); }
try { HRegionLocation location = getConnection().relocateRegion(getTableName(), scan.getStartRow()); LOG.info("Scanner=" + scannerId + " expired, current region location is " + location.toString());
static RegionLocations getRegionLocations(boolean useCache, int replicaId, ClusterConnection cConnection, TableName tableName, byte[] row) throws RetriesExhaustedException, DoNotRetryIOException, InterruptedIOException { RegionLocations rl; try { if (useCache) { rl = cConnection.locateRegion(tableName, row, true, true, replicaId); } else { rl = cConnection.relocateRegion(tableName, row, replicaId); } } catch (DoNotRetryIOException | InterruptedIOException | RetriesExhaustedException e) { throw e; } catch (IOException e) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId, e); } if (rl == null) { throw new RetriesExhaustedException("Can't get the location for replica " + replicaId); } return rl; } }
static RegionLocations getRegionLocations(boolean useCache, int replicaId, ClusterConnection cConnection, TableName tableName, byte[] row) throws RetriesExhaustedException, DoNotRetryIOException, InterruptedIOException { RegionLocations rl; try { if (!useCache) { rl = cConnection.relocateRegion(tableName, row, replicaId); } else { rl = cConnection.locateRegion(tableName, row, useCache, true, replicaId); } } catch (DoNotRetryIOException e) { throw e; } catch (NeedUnmanagedConnectionException e) { throw new DoNotRetryIOException(e); } catch (RetriesExhaustedException e) { throw e; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { throw new RetriesExhaustedException("Can't get the location", e); } if (rl == null) { throw new RetriesExhaustedException("Can't get the locations"); } return rl; } }
@Override protected void handleFailure(Counters counters) throws IOException { Configuration conf = job.getConfiguration(); ClusterConnection conn = (ClusterConnection) ConnectionFactory.createConnection(conf); TableName tableName = TableName.valueOf(COMMON_TABLE_NAME); CounterGroup g = counters.getGroup("undef"); Iterator<Counter> it = g.iterator(); while (it.hasNext()) { String keyString = it.next().getName(); byte[] key = Bytes.toBytes(keyString); HRegionLocation loc = conn.relocateRegion(tableName, key); LOG.error("undefined row " + keyString + ", " + loc); } g = counters.getGroup("unref"); it = g.iterator(); while (it.hasNext()) { String keyString = it.next().getName(); byte[] key = Bytes.toBytes(keyString); HRegionLocation loc = conn.relocateRegion(tableName, key); LOG.error("unreferred row " + keyString + ", " + loc); } } }
while (true) { if (retried) { ((ClusterConnection) connection).relocateRegion( SchemaUtil.getPhysicalName(tableName, this.getProps()), tableKey);
while (true) { if (retried) { ((ClusterConnection) connection).relocateRegion( SchemaUtil.getPhysicalName(tableName, this.getProps()), tableKey);
try { HRegionLocation location = getConnection().relocateRegion(getTableName(), scan.getStartRow()); LOG.info("Scanner=" + scannerId + " expired, current region location is " + location.toString());
try { HRegionLocation location = getConnection().relocateRegion(getTableName(), scan.getStartRow()); LOG.info("Scanner=" + scannerId + " expired, current region location is " + location.toString());