use of voldemort.client.SystemStoreRepository in project voldemort by voldemort.
the class CoordinatorProxyService method initialize.
@Override
protected void initialize() {
// Initialize the Voldemort Metadata
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(this.coordinatorConfig.getBootstrapURLs());
storeClientFactory = new SocketStoreClientFactory(clientConfig);
try {
initializeAllFatClients();
// Setup the Async Metadata checker
SystemStoreRepository sysRepository = new SystemStoreRepository(clientConfig);
String clusterXml = storeClientFactory.bootstrapMetadataWithRetries(MetadataStore.CLUSTER_KEY);
sysRepository.createSystemStores(clientConfig, clusterXml, storeClientFactory.getFailureDetector());
// Create a callback for re-bootstrapping the client
Callable<Void> rebootstrapCallback = new Callable<Void>() {
@Override
public Void call() throws Exception {
initializeAllFatClients();
return null;
}
};
asyncMetadataManager = new AsyncMetadataVersionManager(sysRepository, rebootstrapCallback, null);
schedulerService = new SchedulerService(1, SystemTime.INSTANCE, true);
schedulerService.schedule(asyncMetadataManager.getClass().getName(), asyncMetadataManager, new Date(), this.coordinatorConfig.getMetadataCheckIntervalInMs());
} catch (BootstrapFailureException be) {
/*
* While testing, the cluster may not be up, but we may still need
* to verify if the service deploys. Hence, catch a
* BootstrapFailureException if any, but continue to register the
* Netty service (and listener).
*
* TODO: Modify the coordinator service to be more lazy. If it
* cannot initialize the fat clients during initialization, do this
* when we get an actual request.
*/
}
}
use of voldemort.client.SystemStoreRepository in project voldemort by voldemort.
the class AsyncMetadataVersionManagerTest method setUp.
@Before
public void setUp() throws Exception {
servers = new VoldemortServer[cluster.getNodeIds().size()];
int i = 0;
for (Integer nodeId : cluster.getNodeIds()) {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config);
servers[i++] = server;
}
socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
bootStrapUrls = new String[1];
bootStrapUrls[0] = socketUrl;
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(clientZoneId);
SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
repository = new SystemStoreRepository(clientConfig);
repository.addSystemStore(sysVersionStore, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
this.scheduler = new SchedulerService(2, SystemTime.INSTANCE, true);
}
use of voldemort.client.SystemStoreRepository in project voldemort by voldemort.
the class RebalanceRebootstrapConsistencyTest method setUp.
@Before
public void setUp() throws Exception {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
int numServers = 2;
rwStoreDefWithReplication = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
/*
* Bug fix: The old code was trying to rename a store during rebalance !
* God knows why Renaming it back to the original store name and
* changing other preferences (required reads = 2)
*/
rwStoreDefWithReplication2 = new StoreDefinitionBuilder().setName(testStoreNameRW).setType(BdbStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(2).setRequiredReads(2).setPreferredWrites(1).setRequiredWrites(1).build();
List<StoreDefinition> storedefs = new ArrayList<StoreDefinition>();
storedefs.add(rwStoreDefWithReplication);
String storesXmlStr = new StoreDefinitionsMapper().writeStoreList(storedefs);
// create a temp file
File tempStoresXml = ServerTestUtils.createTempFile("tempfile", ".tmp");
BufferedWriter bw = new BufferedWriter(new FileWriter(tempStoresXml));
bw.write(storesXmlStr);
bw.close();
VoldemortServer[] voldemortServers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1 }, {} };
cluster = ServerTestUtils.startVoldemortCluster(numServers, voldemortServers, partitionMap, socketStoreFactory, false, null, tempStoresXml.getAbsolutePath(), new Properties());
servers = Lists.newArrayList();
for (int i = 0; i < numServers; ++i) {
servers.add(voldemortServers[i]);
}
socketUrl = voldemortServers[0].getIdentityNode().getSocketUrl().toString();
bootStrapUrls = new String[1];
bootStrapUrls[0] = socketUrl;
ClientConfig clientConfig = new ClientConfig();
clientConfig.setBootstrapUrls(bootStrapUrls).setClientZoneId(this.CLIENT_ZONE_ID);
SystemStoreClientFactory<String, String> systemStoreFactory = new SystemStoreClientFactory<String, String>(clientConfig);
sysVersionStore = systemStoreFactory.createSystemStore(SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
repository = new SystemStoreRepository(clientConfig);
repository.addSystemStore(sysVersionStore, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name());
this.scheduler = new SchedulerService(2, SystemTime.INSTANCE, true);
Callable<Void> rebootstrapCallback = new Callable<Void>() {
@Override
public Void call() throws Exception {
// callbackForClusterChange();
checkConsistentMetadata();
return null;
}
};
// Starting the Version Metadata Manager
this.asyncCheckMetadata = new AsyncMetadataVersionManager(this.repository, rebootstrapCallback, null);
scheduler.schedule(asyncCheckMetadata.getClass().getName(), asyncCheckMetadata, new Date(), 500);
while (maxRetries < 3 && !asyncCheckMetadata.isActive) {
Thread.sleep(500);
maxRetries++;
}
}
Aggregations