use of voldemort.client.BootstrapFailureException 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.BootstrapFailureException in project voldemort by voldemort.
the class FileBasedStoreClientConfigService method putConfigsMap.
@Override
protected Map<String, Properties> putConfigsMap(Map<String, Properties> configsToPut) {
Map<String, Properties> allConfigs = getAllConfigsMap();
Map<String, Properties> newConfigs = Maps.newHashMap(allConfigs);
Map<String, Properties> response = Maps.newHashMap();
// TODO For now assuming the only Listener is CoordinatorProxyService.
// Later need to change the API to accept a servicetype as second
// parameter
StoreClientConfigServiceListener listener = this.storeClientConfigListeners.get(ServiceType.COORDINATOR_PROXY.getDisplayName());
for (String storeNameToPut : configsToPut.keySet()) {
if (allConfigs.containsKey(storeNameToPut)) {
Properties existingProperties = allConfigs.get(storeNameToPut);
if (existingProperties.equals(configsToPut.get(storeNameToPut))) {
response.put(storeNameToPut, STORE_UNCHANGED_PROPS);
} else {
try {
listener.onStoreConfigAddOrUpdate(storeNameToPut, configsToPut.get(storeNameToPut));
} catch (Exception e) {
String errorMessage = "Got exception when trying to update the fat client for store " + storeNameToPut + " - " + e.getMessage();
logger.error(errorMessage);
STORE_NOT_UPDATED_PROPS.put(ERROR_MESSAGE_PARAM_KEY, errorMessage);
response.put(storeNameToPut, STORE_NOT_UPDATED_PROPS);
continue;
}
newConfigs.put(storeNameToPut, configsToPut.get(storeNameToPut));
response.put(storeNameToPut, STORE_UPDATED_PROPS);
}
} else {
// Store does not already exist
try {
listener.onStoreConfigAddOrUpdate(storeNameToPut, configsToPut.get(storeNameToPut));
} catch (BootstrapFailureException bootstrapException) {
logger.error("The store " + storeNameToPut + " is not served by Voldemort currently. Exception Message - " + bootstrapException.getMessage());
response.put(storeNameToPut, STORE_NOT_SERVED_BY_VOLDEMORT_PROPS);
continue;
} catch (Exception e) {
String errorMessage = "Got exception when trying to create fat client for store " + storeNameToPut + ". Exception Message - " + e.getMessage();
logger.error(errorMessage);
STORE_NOT_CREATED_PROPS.put(ERROR_MESSAGE_PARAM_KEY, errorMessage);
response.put(storeNameToPut, STORE_NOT_CREATED_PROPS);
continue;
}
newConfigs.put(storeNameToPut, configsToPut.get(storeNameToPut));
response.put(storeNameToPut, STORE_CREATED_PROPS);
}
}
persistNewConfigFile(newConfigs);
return response;
}
Aggregations