use of org.apache.hadoop.hbase.client.RetriesExhaustedException in project hbase by apache.
the class MetaTableLocator method verifyRegionLocation.
/**
* Verify we can connect to <code>hostingServer</code> and that its carrying
* <code>regionName</code>.
* @param hostingServer Interface to the server hosting <code>regionName</code>
* @param address The servername that goes with the <code>metaServer</code>
* Interface. Used logging.
* @param regionName The regionname we are interested in.
* @return True if we were able to verify the region located at other side of
* the Interface.
* @throws IOException
*/
// TODO: We should be able to get the ServerName from the AdminProtocol
// rather than have to pass it in. Its made awkward by the fact that the
// HRI is likely a proxy against remote server so the getServerName needs
// to be fixed to go to a local method or to a cache before we can do this.
private boolean verifyRegionLocation(final ClusterConnection connection, AdminService.BlockingInterface hostingServer, final ServerName address, final byte[] regionName) throws IOException {
if (hostingServer == null) {
LOG.info("Passed hostingServer is null");
return false;
}
Throwable t;
HBaseRpcController controller = connection.getRpcControllerFactory().newController();
try {
// Try and get regioninfo from the hosting server.
return ProtobufUtil.getRegionInfo(controller, hostingServer, regionName) != null;
} catch (ConnectException e) {
t = e;
} catch (RetriesExhaustedException e) {
t = e;
} catch (RemoteException e) {
IOException ioe = e.unwrapRemoteException();
t = ioe;
} catch (IOException e) {
Throwable cause = e.getCause();
if (cause != null && cause instanceof EOFException) {
t = cause;
} else if (cause != null && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
t = cause;
} else {
t = e;
}
}
LOG.info("Failed verification of " + Bytes.toStringBinary(regionName) + " at address=" + address + ", exception=" + t.getMessage());
return false;
}
use of org.apache.hadoop.hbase.client.RetriesExhaustedException in project hbase by apache.
the class SplitLogWorker method splitLog.
/**
* @return Result either DONE, RESIGNED, or ERR.
*/
static Status splitLog(String filename, CancelableProgressable p, Configuration conf, RegionServerServices server, LastSequenceId sequenceIdChecker, WALFactory factory) {
Path walDir;
FileSystem fs;
try {
walDir = CommonFSUtils.getWALRootDir(conf);
fs = walDir.getFileSystem(conf);
} catch (IOException e) {
LOG.warn("Resigning, could not find root dir or fs", e);
return Status.RESIGNED;
}
try {
if (!processSyncReplicationWAL(filename, conf, server, fs, walDir)) {
return Status.DONE;
}
} catch (IOException e) {
LOG.warn("failed to process sync replication wal {}", filename, e);
return Status.RESIGNED;
}
// encountered a bad non-retry-able persistent error.
try {
SplitLogWorkerCoordination splitLogWorkerCoordination = server.getCoordinatedStateManager() == null ? null : server.getCoordinatedStateManager().getSplitLogWorkerCoordination();
if (!WALSplitter.splitLogFile(walDir, fs.getFileStatus(new Path(walDir, filename)), fs, conf, p, sequenceIdChecker, splitLogWorkerCoordination, factory, server)) {
return Status.PREEMPTED;
}
} catch (InterruptedIOException iioe) {
LOG.warn("Resigning, interrupted splitting WAL {}", filename, iioe);
return Status.RESIGNED;
} catch (IOException e) {
if (e instanceof FileNotFoundException) {
// A wal file may not exist anymore. Nothing can be recovered so move on
LOG.warn("Done, WAL {} does not exist anymore", filename, e);
return Status.DONE;
}
Throwable cause = e.getCause();
if (e instanceof RetriesExhaustedException && (cause instanceof NotServingRegionException || cause instanceof ConnectException || cause instanceof SocketTimeoutException)) {
LOG.warn("Resigning, can't connect to target regionserver splitting WAL {}", filename, e);
return Status.RESIGNED;
} else if (cause instanceof InterruptedException) {
LOG.warn("Resigning, interrupted splitting WAL {}", filename, e);
return Status.RESIGNED;
}
LOG.warn("Error splitting WAL {}", filename, e);
return Status.ERR;
}
LOG.debug("Done splitting WAL {}", filename);
return Status.DONE;
}
use of org.apache.hadoop.hbase.client.RetriesExhaustedException in project hbase by apache.
the class TestClientOperationTimeout method testPutTimeout.
/**
* Tests that a put on a table throws {@link RetriesExhaustedException} when the operation takes
* longer than 'hbase.client.operation.timeout'.
*/
@Test
public void testPutTimeout() {
DELAY_MUTATE = 600;
Put put = new Put(ROW);
put.addColumn(FAMILY, QUALIFIER, VALUE);
try {
TABLE.put(put);
fail("should not reach here");
} catch (Exception e) {
LOG.info("Got exception for put", e);
assertThat(e, instanceOf(RetriesExhaustedException.class));
assertThat(e.getCause(), instanceOf(CallTimeoutException.class));
}
}
use of org.apache.hadoop.hbase.client.RetriesExhaustedException in project hbase by apache.
the class TestClientOperationTimeout method testScanTimeout.
/**
* Tests that scan on a table throws {@link RetriesExhaustedException} when the operation takes
* longer than 'hbase.client.scanner.timeout.period'.
*/
@Test
public void testScanTimeout() throws IOException, InterruptedException {
// cache the region location.
try (RegionLocator locator = TABLE.getRegionLocator()) {
locator.getRegionLocation(HConstants.EMPTY_BYTE_ARRAY);
}
// sleep a bit to make sure the location has been cached as it is an async operation.
Thread.sleep(100);
DELAY_SCAN = 600;
try (ResultScanner scanner = TABLE.getScanner(new Scan())) {
scanner.next();
fail("should not reach here");
} catch (Exception e) {
LOG.info("Got exception for scan", e);
assertThat(e, instanceOf(RetriesExhaustedException.class));
assertThat(e.getCause(), instanceOf(CallTimeoutException.class));
}
}
use of org.apache.hadoop.hbase.client.RetriesExhaustedException in project hbase by apache.
the class TestClientOperationTimeout method testGetTimeout.
/**
* Tests that a get on a table throws {@link RetriesExhaustedException} when the operation takes
* longer than 'hbase.client.operation.timeout'.
*/
@Test
public void testGetTimeout() {
DELAY_GET = 600;
try {
TABLE.get(new Get(ROW));
fail("should not reach here");
} catch (Exception e) {
LOG.info("Got exception for get", e);
assertThat(e, instanceOf(RetriesExhaustedException.class));
assertThat(e.getCause(), instanceOf(CallTimeoutException.class));
}
}
Aggregations