use of voldemort.store.rebalancing.RebootstrappingStore in project voldemort by voldemort.
the class StorageService method registerNodeStores.
/**
* For server side routing create NodeStore (socketstore) and pass it on to
* a {@link RebootstrappingStore}.
* <p>
*
* The {@link RebootstrappingStore} handles invalid-metadata exceptions
* introduced due to changes in cluster.xml at different nodes.
*
* @param def
* @param cluster
* @param localNode
*/
public void registerNodeStores(StoreDefinition def, Cluster cluster, int localNode) {
Map<Integer, Store<ByteArray, byte[], byte[]>> nodeStores = new HashMap<Integer, Store<ByteArray, byte[], byte[]>>(cluster.getNumberOfNodes());
Map<Integer, NonblockingStore> nonblockingStores = new HashMap<Integer, NonblockingStore>(cluster.getNumberOfNodes());
try {
for (Node node : cluster.getNodes()) {
Store<ByteArray, byte[], byte[]> store = getNodeStore(def.getName(), node, localNode);
this.storeRepository.addNodeStore(node.getId(), store);
nodeStores.put(node.getId(), store);
NonblockingStore nonblockingStore = routedStoreFactory.toNonblockingStore(store);
nonblockingStores.put(node.getId(), nonblockingStore);
}
Store<ByteArray, byte[], byte[]> store = routedStoreFactory.create(cluster, def, nodeStores, nonblockingStores, null, null, failureDetector, routedStoreConfig);
store = new RebootstrappingStore(metadata, storeRepository, voldemortConfig, (RoutedStore) store, storeFactory);
store = new InconsistencyResolvingStore<ByteArray, byte[], byte[]>(store, new VectorClockInconsistencyResolver<byte[]>());
this.storeRepository.addRoutedStore(store);
} catch (Exception e) {
// Roll back
for (Node node : cluster.getNodes()) this.storeRepository.removeNodeStore(def.getName(), node.getId());
throw new VoldemortException(e);
}
}
Aggregations