Search in sources :

Example 1 with RebalanceTaskInfoMap

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();
}
Also used : RebalanceTaskInfoMap(voldemort.client.protocol.pb.VAdminProto.RebalanceTaskInfoMap) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Cluster(voldemort.cluster.Cluster) ClusterMapper(voldemort.xml.ClusterMapper) VoldemortException(voldemort.VoldemortException) StoreDefinition(voldemort.store.StoreDefinition) StringReader(java.io.StringReader) RebalanceTaskInfo(voldemort.client.rebalance.RebalanceTaskInfo)

Aggregations

StringReader (java.io.StringReader)1 VoldemortException (voldemort.VoldemortException)1 RebalanceTaskInfoMap (voldemort.client.protocol.pb.VAdminProto.RebalanceTaskInfoMap)1 RebalanceTaskInfo (voldemort.client.rebalance.RebalanceTaskInfo)1 Cluster (voldemort.cluster.Cluster)1 StoreDefinition (voldemort.store.StoreDefinition)1 ClusterMapper (voldemort.xml.ClusterMapper)1 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)1