Search in sources :

Example 21 with SocketStoreFactory

use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.

the class AbstractZoneAffinityTest method tearDown.

@After
public void tearDown() throws IOException {
    client.close();
    for (VoldemortServer vs : this.vservers.values()) {
        ServerTestUtils.stopVoldemortServer(vs);
    }
    for (SocketStoreFactory ssf : this.socketStoreFactories.values()) {
        ssf.close();
    }
    ClusterTestUtils.reset();
}
Also used : SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) VoldemortServer(voldemort.server.VoldemortServer) After(org.junit.After)

Example 22 with SocketStoreFactory

use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.

the class AbstractZoneAffinityTest method setup.

@Before
public void setup() throws IOException {
    byte[] v1_bytes = { (byte) 'V', (byte) '1' };
    byte[] v2_bytes = { (byte) 'V', (byte) '2' };
    byte[] k1_bytes = { (byte) 'K', (byte) '1' };
    byte[] k2_bytes = { (byte) 'K', (byte) '2' };
    byte[] k3_bytes = { (byte) 'K', (byte) '3' };
    clientConfig = new ClientConfig();
    clientConfig.setBootstrapUrls(cluster.getNodes().iterator().next().getSocketUrl().toString());
    clientConfig.setClientZoneId(clientZoneId);
    setupZoneAffinitySettings();
    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, stores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
        vservers.put(nodeId, vs);
        socketStoreFactories.put(nodeId, socketStoreFactory);
        Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
        Node node = cluster.getNodeById(nodeId);
        VectorClock version1 = new VectorClock();
        version1.incrementVersion(0, System.currentTimeMillis());
        VectorClock version2 = version1.incremented(0, System.currentTimeMillis());
        if (node.getZoneId() == clientZoneId) {
            // local zone
            store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
            store.put(new ByteArray(k2_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
        } else {
            // remote zone
            store.put(new ByteArray(k1_bytes), new Versioned<byte[]>(v2_bytes, version2), null);
            store.put(new ByteArray(k2_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
            store.put(new ByteArray(k3_bytes), new Versioned<byte[]>(v1_bytes, version1), null);
        }
    }
    client = socketStoreClientFactory.getRawStore(storeDef.getName(), null);
}
Also used : Node(voldemort.cluster.Node) VectorClock(voldemort.versioning.VectorClock) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) ByteArray(voldemort.utils.ByteArray) ClientConfig(voldemort.client.ClientConfig) Before(org.junit.Before)

Example 23 with SocketStoreFactory

use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.

the class QuotaOperationsTest method setup.

@Before
public void setup() throws IOException {
    // setup cluster
    cluster = ServerTestUtils.getLocalCluster(2);
    stores = ServerTestUtils.getStoreDefs(2);
    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, stores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
        vservers.put(node.getId(), vs);
        socketStoreFactories.put(node.getId(), ssf);
    }
    adminClient = new AdminClient(cluster);
    storeName = stores.iterator().next().getName();
}
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)

Example 24 with SocketStoreFactory

use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.

the class ClusterForkLiftToolTest method setUpClusters.

@Before
public void setUpClusters() {
    // setup four nodes with one store and one partition
    final SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
    try {
        int[][] srcPartitionMap = { { 0 }, { 1 }, { 2 }, { 3 } };
        srcServers = new VoldemortServer[4];
        srcCluster = ServerTestUtils.startVoldemortCluster(4, srcServers, srcPartitionMap, socketStoreFactory, true, null, SRC_STORES_XML, new Properties());
        Node node = srcCluster.getNodeById(0);
        srcBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
        int[][] dstPartitionMap = { { 0 }, { 1 }, { 2 } };
        dstServers = new VoldemortServer[3];
        dstCluster = ServerTestUtils.startVoldemortCluster(3, dstServers, dstPartitionMap, socketStoreFactory, true, null, DST_STORES_XML, new Properties());
        node = dstCluster.getNodeById(0);
        dstBootStrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
        kvPairs = ServerTestUtils.createRandomKeyValueString(100);
        int keyCount = 0;
        for (String key : kvPairs.keySet()) {
            if (keyCount == 0)
                firstKey = key;
            if (keyCount == kvPairs.size() - 1)
                lastKey = key;
            if (keyCount == kvPairs.size() / 2)
                conflictKey = key;
            keyCount++;
        }
        srcAdminClient = new AdminClient(srcCluster);
        List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(SRC_STORES_XML));
        primaryResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, PRIMARY_RESOLVING_STORE_NAME);
        globallyResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, GLOBALLY_RESOLVING_STORE_NAME);
        nonResolvingStoreDef = StoreUtils.getStoreDef(storeDefs, MULTIPLE_VERSIONS_STORE_NAME);
        srcfactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(srcBootStrapUrl).setSelectors(1).setRoutingTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setSocketTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setMaxConnectionsPerNode(1));
        srcPrimaryResolvingStoreClient = srcfactory.getStoreClient(PRIMARY_RESOLVING_STORE_NAME);
        srcGloballyResolvingStoreClient = srcfactory.getStoreClient(GLOBALLY_RESOLVING_STORE_NAME);
        dstfactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(dstBootStrapUrl).setSelectors(1).setRoutingTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setSocketTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionTimeout(1000, java.util.concurrent.TimeUnit.MILLISECONDS).setMaxConnectionsPerNode(1));
        dstPrimaryResolvingStoreClient = dstfactory.getStoreClient(PRIMARY_RESOLVING_STORE_NAME);
        dstGloballyResolvingStoreClient = dstfactory.getStoreClient(GLOBALLY_RESOLVING_STORE_NAME);
    } catch (IOException e) {
        e.printStackTrace();
        fail("Unexpected exception");
    }
}
Also used : Node(voldemort.cluster.Node) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) IOException(java.io.IOException) Properties(java.util.Properties) ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) StoreDefinition(voldemort.store.StoreDefinition) ClientConfig(voldemort.client.ClientConfig) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 25 with SocketStoreFactory

use of voldemort.store.socket.SocketStoreFactory in project voldemort by voldemort.

the class MetaOperationsTest method setup.

@Before
public void setup() throws IOException {
    // setup cluster
    cluster = ServerTestUtils.getLocalCluster(2);
    stores = ServerTestUtils.getStoreDefs(2);
    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, stores, 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

SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)26 VoldemortServer (voldemort.server.VoldemortServer)20 Properties (java.util.Properties)19 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)18 Node (voldemort.cluster.Node)16 Before (org.junit.Before)14 VoldemortConfig (voldemort.server.VoldemortConfig)13 StoreDefinition (voldemort.store.StoreDefinition)10 Cluster (voldemort.cluster.Cluster)8 ClientConfig (voldemort.client.ClientConfig)6 AdminClient (voldemort.client.protocol.admin.AdminClient)6 ByteArray (voldemort.utils.ByteArray)5 File (java.io.File)4 ArrayList (java.util.ArrayList)4 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)4 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)4 RoutingStrategyFactory (voldemort.routing.RoutingStrategyFactory)3 TestSocketStoreFactory (voldemort.store.socket.TestSocketStoreFactory)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2