use of voldemort.store.metadata.MetadataStore in project voldemort by voldemort.
the class VoldemortServer method createMetadataFromConfig.
private static MetadataStore createMetadataFromConfig(VoldemortConfig voldemortConfig) {
MetadataStore metadataStore = MetadataStore.readFromDirectory(new File(voldemortConfig.getMetadataDirectory()));
int nodeId = getNodeId(voldemortConfig, metadataStore.getCluster());
metadataStore.initNodeId(nodeId);
return metadataStore;
}
use of voldemort.store.metadata.MetadataStore in project voldemort by voldemort.
the class ServerTestUtils method getStores.
public static StoreRepository getStores(String storeName, String clusterXml, String storesXml) {
StoreRepository repository = new StoreRepository();
Store<ByteArray, byte[], byte[]> store = new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeName);
repository.addLocalStore(store);
repository.addRoutedStore(store);
// create new metadata store.
MetadataStore metadata = createMetadataStore(new ClusterMapper().readCluster(new StringReader(clusterXml)), new StoreDefinitionsMapper().readStoreList(new StringReader(storesXml)));
repository.addLocalStore(metadata);
return repository;
}
use of voldemort.store.metadata.MetadataStore in project voldemort by voldemort.
the class InvalidMetadataCheckingStoreTest method testAddingPartition.
/**
* NOTE: the total number of partitions should remain same for hash
* consistency
*/
public void testAddingPartition() {
StoreDefinition storeDef = ServerTestUtils.getStoreDefs(1).get(0);
Cluster cluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10 } });
MetadataStore metadata = ServerTestUtils.createMetadataStore(cluster, Arrays.asList(storeDef));
InvalidMetadataCheckingStore store = new InvalidMetadataCheckingStore(0, new DoNothingStore<ByteArray, byte[], byte[]>(storeDef.getName()), metadata);
try {
// add partitions to node 0 on client side.
Cluster updatedCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 1, 2, 3, 4, 5, 10 }, { 6, 7 }, { 8, 9 } });
MetadataStore updatedMetadata = ServerTestUtils.createMetadataStore(updatedCluster, Arrays.asList(storeDef));
doOperations(0, store, updatedMetadata, storeDef);
fail("Should see InvalidMetadataExceptions");
} catch (InvalidMetadataException e) {
// ignore
}
}
use of voldemort.store.metadata.MetadataStore in project voldemort by voldemort.
the class InvalidMetadataCheckingStoreTest method testRemovingPartition.
public void testRemovingPartition() {
StoreDefinition storeDef = ServerTestUtils.getStoreDefs(1).get(0);
Cluster cluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10 } });
MetadataStore metadata = ServerTestUtils.createMetadataStore(cluster, Arrays.asList(storeDef));
InvalidMetadataCheckingStore store = new InvalidMetadataCheckingStore(0, new DoNothingStore<ByteArray, byte[], byte[]>(storeDef.getName()), metadata);
try {
// remove partitions to node 0 on client side.
Cluster updatedCluster = ServerTestUtils.getLocalCluster(3, new int[][] { { 0, 1 }, { 2, 4, 5, 6, 7 }, { 3, 8, 9, 10 } });
MetadataStore updatedMetadata = ServerTestUtils.createMetadataStore(updatedCluster, Arrays.asList(storeDef));
doOperations(0, store, updatedMetadata, storeDef);
} catch (InvalidMetadataException e) {
throw new RuntimeException("Should not see any InvalidMetaDataException", e);
}
}
use of voldemort.store.metadata.MetadataStore in project voldemort by voldemort.
the class BlockingSlopPusherTest method setUp.
@Override
protected void setUp() throws Exception {
Cluster cluster = makeCluster(3);
repo = new StoreRepository();
repo.setSlopStore(new SlopStorageEngine(new InMemoryStorageEngine<ByteArray, byte[], byte[]>("slop"), cluster));
repo.addNodeStore(0, new InMemoryStorageEngine<ByteArray, byte[], byte[]>(STORE_NAME));
repo.addNodeStore(1, new InMemoryStorageEngine<ByteArray, byte[], byte[]>(STORE_NAME));
repo.addNodeStore(2, new FailingStore<ByteArray, byte[], byte[]>(STORE_NAME));
MetadataStore metadataStore = ServerTestUtils.createMetadataStore(cluster, ServerTestUtils.getStoreDefs(1));
Props props = new Props();
props.put("node.id", 0);
props.put("voldemort.home", "/");
pusher = new BlockingSlopPusherJob(repo, metadataStore, new NoopFailureDetector(), new VoldemortConfig(props), new ScanPermitWrapper(1));
}
Aggregations