use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class ClientRequestExecutorPoolTest method testNonBlockingCheckoutConnectionFailure.
private void testNonBlockingCheckoutConnectionFailure(ClientRequestExecutorPool execPool, SocketDestination dest, Class<?> expectedExceptionClass) throws Exception {
try {
ClientRequestExecutor resource = execPool.internalGetQueuedPool().internalNonBlockingGet(dest);
// operation and returns null most likely.
if (resource == null) {
Thread.sleep(execPool.getFactory().getTimeout() + 5);
execPool.internalGetQueuedPool().internalNonBlockingGet(dest);
}
fail("should have thrown an connection exception");
} catch (UnreachableStoreException e) {
assertEquals("inner exception should be of type connect exception", expectedExceptionClass, e.getCause().getClass());
}
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class VoldemortBuildAndPushJob method verifyOrAddStore.
/**
* For each node, checks if the store exists and then verifies that the remote schema
* matches the new one. If the remote store doesn't exist, it creates it.
*/
private void verifyOrAddStore(String clusterURL, String keySchema, String valueSchema) {
String newStoreDefXml = VoldemortUtils.getStoreDefXml(storeName, props.getInt(BUILD_REPLICATION_FACTOR, 2), props.getInt(BUILD_REQUIRED_READS, 1), props.getInt(BUILD_REQUIRED_WRITES, 1), props.getNullableInt(BUILD_PREFERRED_READS), props.getNullableInt(BUILD_PREFERRED_WRITES), props.getString(PUSH_FORCE_SCHEMA_KEY, keySchema), props.getString(PUSH_FORCE_SCHEMA_VALUE, valueSchema), description, owners);
log.info("Verifying store against cluster URL: " + clusterURL + "\n" + newStoreDefXml.toString());
StoreDefinition newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml);
try {
adminClientPerCluster.get(clusterURL).storeMgmtOps.verifyOrAddStore(newStoreDef, "BnP config/data", enableStoreCreation, this.storeVerificationExecutorService);
} catch (UnreachableStoreException e) {
log.info("verifyOrAddStore() failed on some nodes for clusterURL: " + clusterURL + " (this is harmless).", e);
// When we can't reach some node, we just skip it and won't create the store on it.
// Next time BnP is run while the node is up, it will get the store created.
}
// Other exceptions need to bubble up!
storeDef = newStoreDef;
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class ThresholdFailureDetector method recordSuccess.
@Override
public void recordSuccess(Node node, long requestTime) {
checkArgs(node, requestTime);
boolean isSuccess = true;
UnreachableStoreException e = null;
if (requestTime > getConfig().getRequestLengthThreshold()) {
// Consider slow requests as "soft" errors that are counted against
// us in our success threshold.
e = new UnreachableStoreException("Node " + node.getId() + " recording success, but request time (" + requestTime + ") exceeded threshold (" + getConfig().getRequestLengthThreshold() + ")");
isSuccess = false;
}
update(node, isSuccess, e);
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class HttpStore method executeRequest.
private DataInputStream executeRequest(HttpPost method, ByteArrayOutputStream output) {
HttpResponse response = null;
try {
method.setEntity(new ByteArrayEntity(output.toByteArray()));
response = httpClient.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpURLConnection.HTTP_OK) {
String message = response.getStatusLine().getReasonPhrase();
VoldemortIOUtils.closeQuietly(response);
throw new UnreachableStoreException("HTTP request to store " + getName() + " returned status code " + statusCode + " " + message);
}
return new DataInputStream(response.getEntity().getContent());
} catch (IOException e) {
VoldemortIOUtils.closeQuietly(response);
throw new UnreachableStoreException("Could not connect to " + storeUrl + " for " + getName(), e);
}
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class HttpStore method get.
@Override
public List<Versioned<byte[]>> get(ByteArray key, byte[] transforms) throws VoldemortException {
StoreUtils.assertValidKey(key);
DataInputStream input = null;
try {
HttpPost method = new HttpPost(this.storeUrl);
ByteArrayOutputStream outputBytes = new ByteArrayOutputStream();
requestFormat.writeGetRequest(new DataOutputStream(outputBytes), getName(), key, transforms, reroute);
input = executeRequest(method, outputBytes);
return requestFormat.readGetResponse(input);
} catch (IOException e) {
throw new UnreachableStoreException("Could not connect to " + storeUrl + " for " + getName(), e);
} finally {
IOUtils.closeQuietly(input);
}
}
Aggregations