use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class OfflineStateTest method verifyNewServer.
private void verifyNewServer(VoldemortServer originalServer) throws Exception {
String baseDirPath = originalServer.getVoldemortConfig().getVoldemortHome();
String parentDirPath = Paths.get(baseDirPath).getParent().toString();
List<StoreDefinition> storeDefs = originalServer.getMetadataStore().getStoreDefList();
VoldemortServer newServer = null;
try {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(useNio, 0, parentDirPath, cluster, storeDefs, new Properties());
newServer = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster, false);
ServerTestUtils.waitForServerStart(socketStoreFactory, newServer.getIdentityNode());
fail("should have thrown an connection exception");
} catch (UnreachableStoreException e) {
assertEquals(ConnectException.class, e.getCause().getClass());
}
newServer.goOnline();
servers[0] = newServer;
assertTrue(testOnlineTraffic());
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class BannagePeriodFailureDetectorTest method testCatastrophicErrors.
@Test
public void testCatastrophicErrors() throws Exception {
Node node = Iterables.get(cluster.getNodes(), 8);
failureDetector.recordException(node, 0, new UnreachableStoreException("intentionalerror", new ConnectException("intentionalerror")));
assertEquals(false, failureDetector.isAvailable(node));
time.sleep(BANNAGE_MILLIS + 1);
assertTrue(failureDetector.isAvailable(node));
failureDetector.recordException(node, 0, new UnreachableStoreException("intentionalerror", new UnknownHostException("intentionalerror")));
assertEquals(false, failureDetector.isAvailable(node));
time.sleep(BANNAGE_MILLIS + 1);
assertTrue(failureDetector.isAvailable(node));
failureDetector.recordException(node, 0, new UnreachableStoreException("intentionalerror", new NoRouteToHostException("intentionalerror")));
assertEquals(false, failureDetector.isAvailable(node));
time.sleep(BANNAGE_MILLIS + 1);
assertTrue(failureDetector.isAvailable(node));
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class ThresholdFailureDetectorTest method testCatastrophicErrors.
@Test
public void testCatastrophicErrors() throws Exception {
Node node = Iterables.get(cluster.getNodes(), 8);
for (int i = 0; i < 1000; i++) {
failureDetector.recordSuccess(node, 1);
}
UnreachableStoreException normalError = new UnreachableStoreException("intentionalerror");
for (int i = 0; i < 10; i++) {
failureDetector.recordException(node, 0, normalError);
}
assertAvailable(node);
UnreachableStoreException catastrophicError = new UnreachableStoreException("intentionalerror", new UnknownHostException("intentionalerror"));
for (int i = 0; i < 10; i++) {
failureDetector.recordException(node, 0, catastrophicError);
}
assertEquals(false, failureDetector.isAvailable(node));
failureDetector.waitForAvailability(node);
for (int i = 0; i < 10; i++) {
failureDetector.recordException(node, 0, catastrophicError);
}
assertEquals(false, failureDetector.isAvailable(node));
failureDetector.recordSuccess(node, failureDetector.getConfig().getRequestLengthThreshold() + 1);
assertEquals(false, failureDetector.isAvailable(node));
failureDetector.recordException(node, 0, normalError);
assertEquals(false, failureDetector.isAvailable(node));
failureDetector.waitForAvailability(node);
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class ThresholdFailureDetectorTest method testChangeMetadata.
@Test
public void testChangeMetadata() throws Exception {
cluster = getTenNodeCluster();
Node node = cluster.getNodeById(9);
connectionVerifier.addStore(node);
for (int i = 0; i < 10; i++) {
failureDetector.recordException(node, 0, new UnreachableStoreException("intentionalerror", new UnknownHostException("intentionalerror")));
}
/**
* Update the failure detector state with the new cluster
*/
failureDetector.getConfig().setCluster(this.cluster);
assertEquals(false, failureDetector.isAvailable(node));
Thread.sleep(failureDetector.getConfig().getAsyncRecoveryInterval() * 2);
assertEquals(true, failureDetector.isAvailable(node));
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class QueuedKeyedResourcePool method destroyRequest.
/**
* A safe wrapper to destroy the given resource request.
*/
protected void destroyRequest(AsyncResourceRequest<V> resourceRequest) {
if (resourceRequest != null) {
try {
// To hand control back to the owner of the
// AsyncResourceRequest, treat "destroy" as an exception since
// there is no resource to pass into useResource, and the
// timeout has not expired.
Exception e = new UnreachableStoreException("Client request was terminated while waiting in the queue.");
resourceRequest.handleException(e);
} catch (Exception ex) {
logger.error("Exception while destroying resource request:", ex);
}
}
}
Aggregations