use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class AsyncProxyPutTask method run.
@Override
public void run() {
Node proxyNode = metadata.getCluster().getNodeById(destinationNode);
long startNs = System.nanoTime();
try {
// TODO there are no retries now if the node we want to write to is
// unavailable
redirectingStore.checkNodeAvailable(proxyNode);
Store<ByteArray, byte[], byte[]> socketStore = redirectingStore.getRedirectingSocketStore(redirectingStore.getName(), destinationNode);
socketStore.put(key, value, transforms);
redirectingStore.recordSuccess(proxyNode, startNs);
redirectingStore.reportProxyPutSuccess();
if (logger.isTraceEnabled()) {
logger.trace("Proxy write for store " + redirectingStore.getName() + " key " + ByteUtils.toHexString(key.get()) + " to destinationNode:" + destinationNode);
}
} catch (UnreachableStoreException e) {
redirectingStore.recordException(proxyNode, startNs, e);
logFailedProxyPutIfNeeded(e);
} catch (ObsoleteVersionException ove) {
/*
* Proxy puts can get an OVE if somehow there are two stealers for
* the same proxy node and the other stealer's proxy put already got
* tothe proxy node.. This will not result from online put winning,
* since we don't issue proxy puts if the proxy node is still a
* replica
*/
logFailedProxyPutIfNeeded(ove);
} catch (Exception e) {
// Just log the key.. Not sure having values in the log is a good
// idea.
logFailedProxyPutIfNeeded(e);
}
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class RedirectingStore method proxyGet.
/**
* Performs a back-door proxy get to proxy node
*
* @param key Key
* @param proxyNodeId proxy node id
* @throws ProxyUnreachableException if proxy node can't be reached
*/
private List<Versioned<byte[]>> proxyGet(ByteArray key, int proxyNodeId, byte[] transform) {
Node proxyNode = metadata.getCluster().getNodeById(proxyNodeId);
checkNodeAvailable(proxyNode);
long startNs = System.nanoTime();
try {
Store<ByteArray, byte[], byte[]> redirectingStore = getRedirectingSocketStore(getName(), proxyNodeId);
List<Versioned<byte[]>> values = redirectingStore.get(key, transform);
recordSuccess(proxyNode, startNs);
return values;
} catch (UnreachableStoreException e) {
recordException(proxyNode, startNs, e);
throw new ProxyUnreachableException("Failed to reach proxy node " + proxyNode, e);
}
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class GetAllConfigureNodesTest method testConfigureNodesNotEnoughNodes.
@Test(expected = InsufficientOperationalNodesException.class)
public void testConfigureNodesNotEnoughNodes() throws Exception {
for (Node node : cluster.getNodes()) failureDetector.recordException(node, 0, new UnreachableStoreException("Test for " + getClass().getName()));
RoutingStrategy routingStrategy = new RouteToAllStrategy(cluster.getNodesShuffled());
GetAllPipelineData pipelineData = new GetAllPipelineData();
GetAllConfigureNodes action = new GetAllConfigureNodes(pipelineData, Event.COMPLETED, failureDetector, 1, 1, routingStrategy, Arrays.asList(aKey), null, null, null);
Pipeline pipeline = new Pipeline(Operation.GET, 10000, TimeUnit.MILLISECONDS);
pipeline.addEventAction(Event.STARTED, action);
pipeline.addEvent(Event.STARTED);
pipeline.execute();
throw pipelineData.getFatalError();
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class RoutedStoreTest method testBasicOperationFailure.
private void testBasicOperationFailure(int reads, int writes, int failures, int threads, RoutedStore customRoutedStore) throws Exception {
VectorClock clock = getClock(1);
Versioned<byte[]> versioned = new Versioned<byte[]>(aValue, clock);
RoutedStore routedStore = null;
if (customRoutedStore == null) {
routedStore = getStore(cluster, reads, writes, threads, failures, 0, RoutingStrategyType.TO_ALL_STRATEGY, new UnreachableStoreException("no go"));
} else {
routedStore = customRoutedStore;
}
try {
routedStore.put(aKey, versioned, aTransform);
fail("Put succeeded with too few operational nodes.");
} catch (InsufficientOperationalNodesException e) {
// expected
}
try {
routedStore.get(aKey, aTransform);
fail("Get succeeded with too few operational nodes.");
} catch (InsufficientOperationalNodesException e) {
// expected
}
try {
routedStore.delete(aKey, versioned.getVersion());
fail("Get succeeded with too few operational nodes.");
} catch (InsufficientOperationalNodesException e) {
// expected
}
}
use of voldemort.store.UnreachableStoreException in project voldemort by voldemort.
the class ClientRequestExecutorPoolTest method testRememberedExceptions.
@Test
public void testRememberedExceptions() {
ConnectException connectEx = new ConnectException("Connect exception");
UnreachableStoreException unreachableEx = new UnreachableStoreException("test Exception", connectEx);
final int COUNT = 10;
for (int i = 0; i < COUNT; i++) {
this.pool.internalGetQueuedPool().reportException(dest1, unreachableEx);
}
for (int i = 0; i < COUNT; i++) {
try {
this.pool.internalGetQueuedPool().checkout(dest1);
fail("should have thrown an exception");
} catch (Exception ex) {
assertEquals("Expected Unreachable Store Exception", unreachableEx.getClass(), ex.getClass());
assertEquals("Expected Unreachable Store Exception", unreachableEx.getMessage(), ex.getMessage());
assertEquals("InnerException is connect Exception", connectEx.getClass(), ex.getCause().getClass());
assertEquals("InnerException is connect Exception", connectEx.getMessage(), ex.getCause().getMessage());
}
}
// should not fail
this.pool.checkout(dest1);
}
Aggregations