Search in sources :

Example 11 with UnreachableStoreException

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());
}
Also used : StoreDefinition(voldemort.store.StoreDefinition) UnreachableStoreException(voldemort.store.UnreachableStoreException) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) VoldemortConfig(voldemort.server.VoldemortConfig) ConnectException(java.net.ConnectException)

Example 12 with UnreachableStoreException

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));
}
Also used : UnknownHostException(java.net.UnknownHostException) Node(voldemort.cluster.Node) UnreachableStoreException(voldemort.store.UnreachableStoreException) NoRouteToHostException(java.net.NoRouteToHostException) ConnectException(java.net.ConnectException) Test(org.junit.Test)

Example 13 with UnreachableStoreException

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);
}
Also used : UnknownHostException(java.net.UnknownHostException) Node(voldemort.cluster.Node) UnreachableStoreException(voldemort.store.UnreachableStoreException) Test(org.junit.Test)

Example 14 with UnreachableStoreException

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));
}
Also used : UnknownHostException(java.net.UnknownHostException) Node(voldemort.cluster.Node) UnreachableStoreException(voldemort.store.UnreachableStoreException) Test(org.junit.Test)

Example 15 with UnreachableStoreException

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);
        }
    }
}
Also used : UnreachableStoreException(voldemort.store.UnreachableStoreException) UnreachableStoreException(voldemort.store.UnreachableStoreException)

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