Search in sources :

Example 41 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class ZoneCountWriteTest method testFastPath.

@Test
public void testFastPath() {
    try {
        client.put("AB", new Versioned<String>("CD"), null);
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (Integer nodeId : vservers.keySet()) {
            VoldemortServer vs = vservers.get(nodeId);
            Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
            byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
            assertTrue(Arrays.equals(real, "CD".getBytes()));
        }
    } catch (InsufficientOperationalNodesException e) {
        fail("Failed with exception: " + e);
    }
}
Also used : InsufficientOperationalNodesException(voldemort.store.InsufficientOperationalNodesException) ByteArray(voldemort.utils.ByteArray) VoldemortServer(voldemort.server.VoldemortServer) Test(org.junit.Test)

Example 42 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class ZoneCountWriteTest method testRemoteZoneNodeFail.

@Test
public void testRemoteZoneNodeFail() {
    try {
        for (Integer nodeId : stoppedServersForRemoteZoneNodeFail) {
            vservers.get(nodeId).stop();
        }
        client.put("AB", new Versioned<String>("CD"), null);
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
        }
        for (Integer nodeId : vservers.keySet()) {
            // skip stopped ones
            if (stoppedServersForRemoteZoneNodeFail.contains(nodeId)) {
                continue;
            }
            VoldemortServer vs = vservers.get(nodeId);
            Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
            byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
            assertTrue(Arrays.equals(real, "CD".getBytes()));
        }
    } catch (InsufficientOperationalNodesException e) {
        fail("Failed with exception: " + e);
        e.printStackTrace();
    }
}
Also used : InsufficientOperationalNodesException(voldemort.store.InsufficientOperationalNodesException) ByteArray(voldemort.utils.ByteArray) VoldemortServer(voldemort.server.VoldemortServer) Test(org.junit.Test)

Example 43 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class ZoneShrinkageCLITest method setup.

public void setup() throws IOException {
    // setup cluster
    bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
    for (Node node : cluster.getNodes()) {
        SocketStoreFactory ssf = new TestSocketStoreFactory();
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, oldStores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
        vservers.put(node.getId(), vs);
        socketStoreFactories.put(node.getId(), ssf);
    }
}
Also used : TestSocketStoreFactory(voldemort.store.socket.TestSocketStoreFactory) Node(voldemort.cluster.Node) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) TestSocketStoreFactory(voldemort.store.socket.TestSocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig)

Example 44 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class AvroAddStoreTest method testUpdateAvroSchema.

@Test
public void testUpdateAvroSchema() throws Exception {
    for (VoldemortServer vs : vservers.values()) {
        assertNull(vs.getStoreRepository().getLocalStore("test"));
    }
    logger.info("Now inserting stores with backward compatible schema. Should not see exception");
    adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardCompatibleSchema)));
    try {
        logger.info("Now updating store with non backward compatible schema. Should see exception");
        List<StoreDefinition> stores = new ArrayList<StoreDefinition>();
        stores.add(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardIncompatibleSchema)));
        adminClient.metadataMgmtOps.updateRemoteStoreDefList(stores);
        Assert.fail("Did not throw exception");
    } catch (VoldemortException e) {
    }
    for (VoldemortServer vs : vservers.values()) {
        assertNotNull(vs.getStoreRepository().getLocalStore("test"));
    }
}
Also used : StoreDefinition(voldemort.store.StoreDefinition) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) StringReader(java.io.StringReader) ArrayList(java.util.ArrayList) VoldemortServer(voldemort.server.VoldemortServer) VoldemortException(voldemort.VoldemortException) Test(org.junit.Test)

Example 45 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class AvroAddStoreTest method setup.

/**
     * This test is to partially test the functionality of SetMetadata feature
     * of the VoldemortAdminTool
     */
@Before
public void setup() throws IOException {
    // setup cluster
    cluster = ClusterTestUtils.getZZZCluster();
    oldStores = ClusterTestUtils.getZZZStoreDefsInMemory();
    bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
    for (Node node : cluster.getNodes()) {
        SocketStoreFactory ssf = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, oldStores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
        vservers.put(node.getId(), vs);
        socketStoreFactories.put(node.getId(), ssf);
    }
    adminClient = new AdminClient(cluster);
}
Also used : ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) Node(voldemort.cluster.Node) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Aggregations

VoldemortServer (voldemort.server.VoldemortServer)86 Properties (java.util.Properties)36 VoldemortConfig (voldemort.server.VoldemortConfig)24 Test (org.junit.Test)23 Node (voldemort.cluster.Node)23 Before (org.junit.Before)21 SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)20 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)18 ClientConfig (voldemort.client.ClientConfig)17 ByteArray (voldemort.utils.ByteArray)17 ArrayList (java.util.ArrayList)16 After (org.junit.After)15 StoreDefinition (voldemort.store.StoreDefinition)15 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)14 Cluster (voldemort.cluster.Cluster)14 IOException (java.io.IOException)11 HashMap (java.util.HashMap)11 AdminClient (voldemort.client.protocol.admin.AdminClient)11 VectorClock (voldemort.versioning.VectorClock)10 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)9