Search in sources :

Example 46 with VoldemortConfig

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

the class DataCleanupJobTest method setUp.

@Before
public void setUp() throws Exception {
    time = new MockTime();
    storeDir = TestUtils.createTempDir();
    FileDeleteStrategy.FORCE.delete(storeDir);
    // lets use all the default values.
    Props props = new Props();
    props.put("node.id", 1);
    props.put("voldemort.home", "test/common/voldemort/config");
    VoldemortConfig voldemortConfig = new VoldemortConfig(props);
    voldemortConfig.setBdbCacheSize(1024 * 1024);
    voldemortConfig.setBdbOneEnvPerStore(true);
    voldemortConfig.setBdbDataDirectory(storeDir.toURI().getPath());
    voldemortConfig.setBdbPrefixKeysWithPartitionId(prefixPartitionId);
    bdbStorage = new BdbStorageConfiguration(voldemortConfig);
    StoreDefinition storeDef = getStoreDef(START_RETENTION);
    engine = bdbStorage.getStore(storeDef, TestUtils.makeSingleNodeRoutingStrategy());
    List<Node> nodes = Lists.newArrayList();
    nodes.add(new Node(0, "test-host", 1234, 1235, 1236, Arrays.asList(0)));
    Cluster cluster = new Cluster("cluster", nodes);
    StoreRepository repo = new StoreRepository();
    repo.setSlopStore(new SlopStorageEngine(new InMemoryStorageEngine<ByteArray, byte[], byte[]>("slop"), cluster));
    repo.addNodeStore(0, engine);
    metadataStore = ServerTestUtils.createMetadataStore(cluster, Arrays.asList(storeDef));
}
Also used : InMemoryStorageEngine(voldemort.store.memory.InMemoryStorageEngine) StoreDefinition(voldemort.store.StoreDefinition) Node(voldemort.cluster.Node) Cluster(voldemort.cluster.Cluster) StoreRepository(voldemort.server.StoreRepository) SlopStorageEngine(voldemort.store.slop.SlopStorageEngine) Props(voldemort.utils.Props) BdbStorageConfiguration(voldemort.store.bdb.BdbStorageConfiguration) MockTime(voldemort.MockTime) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 47 with VoldemortConfig

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

the class StorageService method initStorageConfig.

private void initStorageConfig(String configClassName) {
    // add the configurations of the storage engines needed by user stores
    try {
        Class<?> configClass = ReflectUtils.loadClass(configClassName);
        StorageConfiguration configuration = (StorageConfiguration) ReflectUtils.callConstructor(configClass, new Class<?>[] { VoldemortConfig.class }, new Object[] { voldemortConfig });
        logger.info("Initializing " + configuration.getType() + " storage engine.");
        storageConfigs.put(configuration.getType(), configuration);
        if (voldemortConfig.isJmxEnabled())
            JmxUtils.registerMbean(configuration.getType() + "StorageConfiguration", configuration);
    } catch (IllegalStateException e) {
        logger.error("Error loading storage configuration '" + configClassName + "'.", e);
    }
    if (storageConfigs.size() == 0)
        throw new ConfigurationException("No storage engine has been enabled!");
    // now, add the configurations of the storage engines needed by system
    // stores, if not yet exist
    initSystemStorageConfig();
}
Also used : ConfigurationException(voldemort.utils.ConfigurationException) StorageConfiguration(voldemort.store.StorageConfiguration) FileBackedCachingStorageConfiguration(voldemort.store.configuration.FileBackedCachingStorageConfiguration) InMemoryStorageConfiguration(voldemort.store.memory.InMemoryStorageConfiguration) ViewStorageConfiguration(voldemort.store.views.ViewStorageConfiguration) ReadOnlyStorageConfiguration(voldemort.store.readonly.ReadOnlyStorageConfiguration) VoldemortConfig(voldemort.server.VoldemortConfig)

Example 48 with VoldemortConfig

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

the class PartitionPrefixedBdbStorageEngineTest method setUp.

@Before
public void setUp() throws Exception {
    bdbMasterDir = TestUtils.createTempDir();
    FileDeleteStrategy.FORCE.delete(bdbMasterDir);
    // lets use all the default values.
    Props props = new Props();
    props.put("node.id", 1);
    props.put("voldemort.home", "test/common/voldemort/config");
    VoldemortConfig voldemortConfig = new VoldemortConfig(props);
    voldemortConfig.setBdbCacheSize(10 * 1024 * 1024);
    voldemortConfig.setBdbOneEnvPerStore(true);
    voldemortConfig.setBdbDataDirectory(bdbMasterDir.toURI().getPath());
    voldemortConfig.setBdbPrefixKeysWithPartitionId(true);
    bdbStorage = new BdbStorageConfiguration(voldemortConfig);
}
Also used : Props(voldemort.utils.Props) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 49 with VoldemortConfig

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

the class RocksdbStorageEngineTest method setUp.

@Override
@Before
public void setUp() {
    Properties props = new Properties();
    // Doesnt matter what node.id and voldemort.home values are for this
    // test
    props.setProperty("node.id", "0");
    props.setProperty("voldemort.home", "tmp/voldemort");
    voldemortConfig = new VoldemortConfig(props);
    voldemortConfig.setRocksdbPrefixKeysWithPartitionId(this.prefixPartitionId);
    this.rocksDbConfig = new RocksDbStorageConfiguration(voldemortConfig);
    this.rocksDbStore = (RocksDbStorageEngine) rocksDbConfig.getStore(TestUtils.makeStoreDefinition("test"), TestUtils.makeSingleNodeRoutingStrategy());
    random = new Random();
}
Also used : Random(java.util.Random) Properties(java.util.Properties) VoldemortConfig(voldemort.server.VoldemortConfig) Before(org.junit.Before)

Example 50 with VoldemortConfig

use of voldemort.server.VoldemortConfig 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)

Aggregations

VoldemortConfig (voldemort.server.VoldemortConfig)53 Properties (java.util.Properties)29 VoldemortServer (voldemort.server.VoldemortServer)24 Before (org.junit.Before)18 Node (voldemort.cluster.Node)16 StoreDefinition (voldemort.store.StoreDefinition)16 File (java.io.File)15 Props (voldemort.utils.Props)14 SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)13 ByteArray (voldemort.utils.ByteArray)12 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)11 Cluster (voldemort.cluster.Cluster)7 Test (org.junit.Test)6 ClientConfig (voldemort.client.ClientConfig)6 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)6 BdbStorageConfiguration (voldemort.store.bdb.BdbStorageConfiguration)6 AdminClient (voldemort.client.protocol.admin.AdminClient)5 OptionParser (joptsimple.OptionParser)4 OptionSet (joptsimple.OptionSet)4 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)4