Search in sources :

Example 1 with VoldemortServer

use of voldemort.server.VoldemortServer in project qi4j-sdk by Qi4j.

the class VoldemortTest method startServer.

private void startServer(File voldemortHome, String serverProps) throws IOException {
    Properties props = new Properties();
    InputStream in = getClass().getResourceAsStream(serverProps);
    props.load(in);
    props.setProperty("voldemort.home", voldemortHome.getCanonicalPath());
    VoldemortConfig config = new VoldemortConfig(props);
    config.setEnableJmx(false);
    VoldemortServer server = new VoldemortServer(config);
    server.start();
    this.servers.add(server);
}
Also used : Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig)

Example 2 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 3 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 4 with VoldemortServer

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

the class ZoneCountWriteTest method setup.

@Before
public void setup() throws IOException {
    storeDef = storeDefs.get(0);
    Integer zoneCountWrite = 1;
    // override
    storeDef = new StoreDefinition(storeDef.getName(), storeDef.getType(), storeDef.getDescription(), storeDef.getKeySerializer(), storeDef.getValueSerializer(), storeDef.getTransformsSerializer(), storeDef.getRoutingPolicy(), storeDef.getRoutingStrategyType(), storeDef.getReplicationFactor(), storeDef.getPreferredReads(), storeDef.getRequiredReads(), storeDef.getPreferredWrites(), storeDef.getRequiredWrites(), storeDef.getViewTargetStoreName(), storeDef.getValueTransformation(), storeDef.getZoneReplicationFactor(), storeDef.getZoneCountReads(), zoneCountWrite, storeDef.getRetentionDays(), storeDef.getRetentionScanThrottleRate(), storeDef.getRetentionFrequencyDays(), storeDef.getSerializerFactory(), storeDef.getHintedHandoffStrategyType(), storeDef.getHintPrefListSize(), storeDef.getOwners(), storeDef.getMemoryFootprintMB());
    storeDefs.set(0, storeDef);
    SocketStoreClientFactory socketStoreClientFactory = new SocketStoreClientFactory(clientConfig);
    for (Integer nodeId : cluster.getNodeIds()) {
        SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
        vservers.put(nodeId, vs);
    }
    client = socketStoreClientFactory.getRawStore(storeDef.getName(), null);
}
Also used : ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) StoreDefinition(voldemort.store.StoreDefinition) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 5 with VoldemortServer

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

the class RebootstrappingStoreTest method setUp.

@Before
public void setUp() throws Exception {
    SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
    int numServers = 2;
    VoldemortServer[] voldemortServers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1 }, {} };
    cluster = ServerTestUtils.startVoldemortCluster(numServers, voldemortServers, partitionMap, socketStoreFactory, false, null, STORES_XML, new Properties());
    servers = Lists.newArrayList();
    for (int i = 0; i < numServers; ++i) {
        servers.add(voldemortServers[i]);
    }
    String bootstrapUrl = cluster.getNodeById(0).getSocketUrl().toString();
    storeClient = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)).getStoreClient(STORE_NAME);
    Map<String, String> entries = Maps.newHashMap();
    entries.put("a", "1");
    entries.put("b", "2");
    for (Map.Entry<String, String> entry : entries.entrySet()) storeClient.put(entry.getKey(), entry.getValue());
}
Also used : SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) ClientConfig(voldemort.client.ClientConfig) Map(java.util.Map) 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