Search in sources :

Example 6 with VoldemortServer

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

the class E2EClientRequestExecutorPoolAndFailureDetectorTest method tearDown.

public void tearDown() throws IOException {
    // Servers
    for (VoldemortServer server : servers) {
        ServerTestUtils.stopVoldemortServer(server);
    }
    servers = null;
    cluster = null;
    // Clients
    storeClientFactory.close();
    storeClientFactory = null;
    socketStoreFactory.close();
    socketStoreFactory = null;
}
Also used : VoldemortServer(voldemort.server.VoldemortServer)

Example 7 with VoldemortServer

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

the class E2EClientRequestExecutorPoolAndFailureDetectorTest method setUp.

public void setUp(int opSlowMs, int numSelectors, int connectionsPerNode) throws Exception {
    socketStoreFactory = new ClientRequestExecutorPool(numSelectors, connectionsPerNode, CONNECTION_TIMEOUT_MS, SOCKET_TIMEOUT_MS, SOCKET_BUFFER_SIZE, SOCKET_KEEP_ALIVE);
    cluster = ServerTestUtils.getLocalCluster(numServers, new int[][] { { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } });
    servers = new ArrayList<VoldemortServer>();
    Properties p = new Properties();
    String storageConfigs = BdbStorageConfiguration.class.getName() + "," + InMemoryStorageConfiguration.class.getName() + "," + SlowStorageConfiguration.class.getName();
    p.setProperty("storage.configs", storageConfigs);
    p.setProperty("testing.slow.queueing.put.ms", Long.toString(opSlowMs));
    p.setProperty("testing.slow.queueing.get.ms", Long.toString(opSlowMs));
    // Susceptible to BindException...
    for (int i = 0; i < numServers; i++) {
        VoldemortConfig voldemortConfig = ServerTestUtils.createServerConfigWithDefs(this.useNio, i, TestUtils.createTempDir().getAbsolutePath(), cluster, getStoreDef(), p);
        VoldemortServer voldemortServer = ServerTestUtils.startVoldemortServer(socketStoreFactory, voldemortConfig);
        servers.add(voldemortServer);
    }
    Node node = cluster.getNodeById(0);
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl).setMaxConnectionsPerNode(connectionsPerNode).setConnectionTimeout(CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS).setSocketTimeout(SOCKET_TIMEOUT_MS, TimeUnit.MILLISECONDS).setRoutingTimeout(ROUTING_TIMEOUT_MS, TimeUnit.MILLISECONDS).setFailureDetectorThreshold(99).setFailureDetectorThresholdInterval(250));
}
Also used : InMemoryStorageConfiguration(voldemort.store.memory.InMemoryStorageConfiguration) ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) Node(voldemort.cluster.Node) SlowStorageConfiguration(voldemort.store.slow.SlowStorageConfiguration) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) ClientConfig(voldemort.client.ClientConfig) VoldemortConfig(voldemort.server.VoldemortConfig)

Example 8 with VoldemortServer

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

the class E2ENonblockingCheckoutTest method setUp.

@Before
public void setUp() throws Exception {
    // PatternLayout patternLayout = new
    // PatternLayout("%d{ABSOLUTE} %-5p [%t/%c]: %m%n");
    Logger logger;
    /*-
        // To analyze whether checkout/checkin paths are blocking add
        // log4j.trace statements to KeyedResourcePool checkout/checkin methods.
         */
    logger = Logger.getLogger("voldemort.store.socket.clientrequest.ClientRequestExecutorPool");
    logger.setLevel(Level.TRACE);
    logger = Logger.getLogger("voldemort.utils.pool.KeyedResourcePool");
    logger.setLevel(Level.TRACE);
    logger = Logger.getLogger("voldemort.utils.pool.QueuedKeyedResourcePool");
    logger.setLevel(Level.TRACE);
    logger = Logger.getLogger("voldemort.store.socket.SocketStore");
    logger.setLevel(Level.DEBUG);
    logger = Logger.getLogger("voldemort.store.routed.action.PerformParallelPutRequests");
    logger.setLevel(Level.DEBUG);
    logger = Logger.getLogger("voldemort.store.routed.action.PerformSerialPutRequests");
    logger.setLevel(Level.DEBUG);
    cluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 3 }, { 1, 4 }, { 2, 5 } });
    servers = new ArrayList<VoldemortServer>();
    Properties p = new Properties();
    String storageConfigs = BdbStorageConfiguration.class.getName() + "," + InMemoryStorageConfiguration.class.getName() + "," + SlowStorageConfiguration.class.getName();
    p.setProperty("storage.configs", storageConfigs);
    p.setProperty("testing.slow.queueing.put.ms", Long.toString(SLOW_PUT_MS));
    p.setProperty("client.connection.timeout.ms", Integer.toString(CONNECTION_TIMEOUT_MS));
    p.setProperty("client.routing.timeout.ms", Integer.toString(ROUTING_TIMEOUT_MS));
    for (int i = 0; i < 3; i++) {
        VoldemortConfig voldemortConfig = ServerTestUtils.createServerConfigWithDefs(this.useNio, i, TestUtils.createTempDir().getAbsolutePath(), cluster, getStoreDef(i), p);
        VoldemortServer voldemortServer = ServerTestUtils.startVoldemortServer(socketStoreFactory, voldemortConfig);
        servers.add(voldemortServer);
    }
    Node node = cluster.getNodeById(0);
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl).setMaxConnectionsPerNode(CONNECTIONS_PER_NODE).setConnectionTimeout(CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS));
}
Also used : InMemoryStorageConfiguration(voldemort.store.memory.InMemoryStorageConfiguration) SocketStoreClientFactory(voldemort.client.SocketStoreClientFactory) Node(voldemort.cluster.Node) SlowStorageConfiguration(voldemort.store.slow.SlowStorageConfiguration) Logger(org.apache.log4j.Logger) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) ClientConfig(voldemort.client.ClientConfig) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 9 with VoldemortServer

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

the class AdminServiceFilterTest method setUp.

@Override
@Before
public void setUp() throws IOException {
    cluster = ServerTestUtils.getLocalCluster(2);
    VoldemortConfig config = ServerTestUtils.createServerConfig(useNio, 0, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties());
    config.setEnableNetworkClassLoader(true);
    List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
    storeDef = StoreDefinitionUtils.getStoreDefinitionWithName(storeDefs, testStoreName);
    server = new VoldemortServer(config, cluster);
    server.start();
    adminClient = ServerTestUtils.getAdminClient(cluster);
}
Also used : StoreDefinition(voldemort.store.StoreDefinition) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) File(java.io.File) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 10 with VoldemortServer

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

the class AbstractRebalanceTest method startServers.

// This method is susceptible to BindException issues due to TOCTOU
// problem with getLocalCluster (which is used to construct cluster that is
// passed in).
// TODO: (refactor) AbstractRebalanceTest to take advantage of
// ServerTestUtils.startVoldemortCluster.
protected Cluster startServers(Cluster cluster, String storeXmlFile, List<Integer> nodeToStart, Map<String, String> configProps) throws Exception {
    for (int node : nodeToStart) {
        Properties properties = new Properties();
        if (null != configProps) {
            for (Entry<String, String> property : configProps.entrySet()) {
                properties.put(property.getKey(), property.getValue());
            }
        }
        // turn proxy puts on
        properties.put("proxy.puts.during.rebalance", "true");
        properties.put("bdb.cache.size", "" + (5 * 1024 * 1024));
        properties.put("bdb.one.env.per.store", "true");
        VoldemortConfig config = ServerTestUtils.createServerConfig(true, node, TestUtils.createTempDir().getAbsolutePath(), null, storeXmlFile, properties);
        VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
        serverMap.put(node, server);
    }
    return cluster;
}
Also used : Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig)

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