Search in sources :

Example 21 with ClientConfig

use of voldemort.client.ClientConfig in project voldemort by voldemort.

the class AsyncMetadataVersionManagerTest method setUp.

@Before
public void setUp() throws Exception {
    servers = new VoldemortServer[cluster.getNodeIds().size()];
    int i = 0;
    for (Integer nodeId : cluster.getNodeIds()) {
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
        VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
        servers[i++] = server;
    }
    socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
    bootStrapUrls = new String[1];
    bootStrapUrls[0] = socketUrl;
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(clientZoneId);
    SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
    sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
    repository = new SystemStoreRepository(clientConfig);
    repository.addSystemStore(sysVersionStore, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
    this.scheduler = new SchedulerService(2, SystemTime.INSTANCE, true);
}
Also used : SchedulerService(voldemort.common.service.SchedulerService) SystemStoreClientFactory(voldemort.client.SystemStoreClientFactory) SystemStoreRepository(voldemort.client.SystemStoreRepository) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) ClientConfig(voldemort.client.ClientConfig) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 22 with ClientConfig

use of voldemort.client.ClientConfig in project voldemort by voldemort.

the class SystemStoreTest method setUp.

@Before
public void setUp() throws Exception {
    servers = new VoldemortServer[cluster.getNodeIds().size()];
    int i = 0;
    for (Integer nodeId : cluster.getNodeIds()) {
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
        VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
        servers[i++] = server;
    }
    socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
    ClientConfig clientConfig = new ClientConfig().setMaxTotalConnections(4).setMaxConnectionsPerNode(4).setBootstrapUrls(socketUrl);
    SocketStoreClientFactory socketFactory = new SocketStoreClientFactory(clientConfig);
    bootStrapUrls = new String[1];
    bootStrapUrls[0] = socketUrl;
    clusterXml = ((AbstractStoreClientFactory) socketFactory).bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY);
}
Also used : SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) ClientConfig(voldemort.client.ClientConfig) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 23 with ClientConfig

use of voldemort.client.ClientConfig in project voldemort by voldemort.

the class SystemStoreTest method testCustomClusterXmlStore.

@Test
public void testCustomClusterXmlStore() {
    try {
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(this.clientZoneId);
        SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
        SystemStoreClient<String, String> sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name(), this.clusterXml, null);
        long storesVersion = 1;
        sysVersionStore.putSysStore("stores.xml", Long.toString(storesVersion));
        long version = Long.parseLong(sysVersionStore.getValueSysStore("stores.xml"));
        assertEquals("Received incorrect version from the voldsys$_metadata_version system store", storesVersion, version);
    } catch (Exception e) {
        fail("Failed to create System Store with custom cluster Xml: " + e.getMessage());
    }
}
Also used : SystemStoreClientFactory(voldemort.client.SystemStoreClientFactory) ClientConfig(voldemort.client.ClientConfig) Test(org.junit.Test)

Example 24 with ClientConfig

use of voldemort.client.ClientConfig in project voldemort by voldemort.

the class ChainedInconsistencyResolverTest method setUp.

@Before
public void setUp() throws IOException {
    boolean useNio = false;
    int numServers = 2;
    VoldemortServer[] servers = new VoldemortServer[numServers];
    Cluster cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, null, socketStoreFactory, useNio, null, STORES_XML, new Properties());
    // Initialize versioned puts for basic test
    v1 = getVersioned(0, 1, 1, 1, 1, 1);
    v2 = getVersioned(0, 0, 1, 1, 1, 1);
    // Initialize versioned puts for > 1 conflicts
    conflict1 = getVersioned(0, 1, 1, 1, 1, 1, 1, 1, 1, 1);
    conflict2 = getVersioned(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
    conflict3 = getVersioned(0, 0, 0, 1, 1, 1, 1, 1, 1, 1);
    conflict4 = getVersioned(0, 0, 0, 0, 1, 1, 1, 1, 1, 1);
    conflict5 = getVersioned(0, 0, 0, 0, 0, 1, 1, 1, 1, 1);
    conflict6 = getVersioned(0, 0, 0, 0, 0, 0, 1, 1, 1, 1);
    Node node = cluster.getNodes().iterator().next();
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    StoreClientFactory storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
    defaultStoreClient = storeClientFactory.getStoreClient("test");
    socketStore = ServerTestUtils.getSocketStore(socketStoreFactory, "test", node.getSocketPort(), RequestFormatType.VOLDEMORT_V1);
}
Also used : SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) Node(voldemort.cluster.Node) Cluster(voldemort.cluster.Cluster) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) ClientConfig(voldemort.client.ClientConfig) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) StoreClientFactory(voldemort.client.StoreClientFactory) Before(org.junit.Before)

Example 25 with ClientConfig

use of voldemort.client.ClientConfig in project YCSB by brianfrankcooper.

the class VoldemortClient method init.

/**
   * Initialize the DB layer. This accepts all properties allowed by the
   * Voldemort client. A store maps to a table. Required : bootstrap_urls
   * Additional property : store_name -> to preload once, should be same as -t
   * {@link ClientConfig}
   */
public void init() throws DBException {
    ClientConfig clientConfig = new ClientConfig(getProperties());
    socketFactory = new SocketStoreClientFactory(clientConfig);
    // Retrieve store name
    storeName = getProperties().getProperty("store_name", "usertable");
    // Use store name to retrieve client
    storeClient = socketFactory.getStoreClient(storeName);
    if (storeClient == null) {
        throw new DBException("Unable to instantiate store client");
    }
}
Also used : DBException(com.yahoo.ycsb.DBException) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) ClientConfig(voldemort.client.ClientConfig)

Aggregations

ClientConfig (voldemort.client.ClientConfig)51 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)37 VoldemortServer (voldemort.server.VoldemortServer)17 IOException (java.io.IOException)15 Properties (java.util.Properties)15 Test (org.junit.Test)15 Before (org.junit.Before)14 ByteArray (voldemort.utils.ByteArray)13 ArrayList (java.util.ArrayList)12 Cluster (voldemort.cluster.Cluster)12 ExecutorService (java.util.concurrent.ExecutorService)10 AdminClient (voldemort.client.protocol.admin.AdminClient)10 Node (voldemort.cluster.Node)10 StoreClientFactory (voldemort.client.StoreClientFactory)9 HashMap (java.util.HashMap)8 List (java.util.List)8 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)8 File (java.io.File)7 VoldemortException (voldemort.VoldemortException)7 CountDownLatch (java.util.concurrent.CountDownLatch)6