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));
}
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();
}
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);
}
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();
}
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);
}
Aggregations