Search in sources :

Example 31 with UnreachableStoreException

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);
    }
}
Also used : ObsoleteVersionException(voldemort.versioning.ObsoleteVersionException) Node(voldemort.cluster.Node) ByteArray(voldemort.utils.ByteArray) UnreachableStoreException(voldemort.store.UnreachableStoreException) ObsoleteVersionException(voldemort.versioning.ObsoleteVersionException) UnreachableStoreException(voldemort.store.UnreachableStoreException)

Example 32 with UnreachableStoreException

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);
    }
}
Also used : Versioned(voldemort.versioning.Versioned) Node(voldemort.cluster.Node) ByteArray(voldemort.utils.ByteArray) UnreachableStoreException(voldemort.store.UnreachableStoreException)

Example 33 with UnreachableStoreException

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();
}
Also used : RouteToAllStrategy(voldemort.routing.RouteToAllStrategy) GetAllPipelineData(voldemort.store.routed.GetAllPipelineData) Node(voldemort.cluster.Node) RoutingStrategy(voldemort.routing.RoutingStrategy) UnreachableStoreException(voldemort.store.UnreachableStoreException) Pipeline(voldemort.store.routed.Pipeline) Test(org.junit.Test)

Example 34 with UnreachableStoreException

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
    }
}
Also used : Versioned(voldemort.versioning.Versioned) VectorClock(voldemort.versioning.VectorClock) InsufficientOperationalNodesException(voldemort.store.InsufficientOperationalNodesException) UnreachableStoreException(voldemort.store.UnreachableStoreException)

Example 35 with UnreachableStoreException

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);
}
Also used : UnreachableStoreException(voldemort.store.UnreachableStoreException) ConnectException(java.net.ConnectException) UnreachableStoreException(voldemort.store.UnreachableStoreException) IOException(java.io.IOException) UnresolvedAddressException(java.nio.channels.UnresolvedAddressException) ConnectException(java.net.ConnectException) Test(org.junit.Test)

Aggregations

UnreachableStoreException (voldemort.store.UnreachableStoreException)45 Node (voldemort.cluster.Node)19 ByteArray (voldemort.utils.ByteArray)13 Test (org.junit.Test)11 IOException (java.io.IOException)10 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)10 VoldemortException (voldemort.VoldemortException)7 InsufficientOperationalNodesException (voldemort.store.InsufficientOperationalNodesException)7 DataInputStream (java.io.DataInputStream)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 DataOutputStream (java.io.DataOutputStream)5 ConnectException (java.net.ConnectException)5 HttpPost (org.apache.http.client.methods.HttpPost)5 Versioned (voldemort.versioning.Versioned)5 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)4 ExecutionException (java.util.concurrent.ExecutionException)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 VoldemortApplicationException (voldemort.VoldemortApplicationException)4 NonblockingStoreCallback (voldemort.store.nonblockingstore.NonblockingStoreCallback)4 UnknownHostException (java.net.UnknownHostException)3