use of voldemort.client.protocol.pb.VAdminProto.RebalanceTaskInfoMap in project voldemort by voldemort.
the class AdminServiceRequestHandler method handleRebalanceStateChange.
public VAdminProto.RebalanceStateChangeResponse handleRebalanceStateChange(VAdminProto.RebalanceStateChangeRequest request) {
VAdminProto.RebalanceStateChangeResponse.Builder response = VAdminProto.RebalanceStateChangeResponse.newBuilder();
synchronized (rebalancer) {
try {
// Retrieve all values first
List<RebalanceTaskInfo> rebalanceTaskInfo = Lists.newArrayList();
for (RebalanceTaskInfoMap map : request.getRebalanceTaskListList()) {
rebalanceTaskInfo.add(ProtoUtils.decodeRebalanceTaskInfoMap(map));
}
Cluster cluster = new ClusterMapper().readCluster(new StringReader(request.getClusterString()));
List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new StringReader(request.getStoresString()));
boolean swapRO = request.getSwapRo();
boolean changeClusterMetadata = request.getChangeClusterMetadata();
boolean changeRebalanceState = request.getChangeRebalanceState();
boolean rollback = request.getRollback();
rebalancer.rebalanceStateChange(cluster, storeDefs, rebalanceTaskInfo, swapRO, changeClusterMetadata, changeRebalanceState, rollback);
} catch (VoldemortException e) {
response.setError(ProtoUtils.encodeError(errorCodeMapper, e));
logger.error("handleRebalanceStateChange failed for request(" + request.toString() + ")", e);
}
}
return response.build();
}
Aggregations