解除限流速率配置
This commit is contained in:
@@ -33,8 +33,8 @@ public class TopicPartitionVO {
|
||||
TopicPartitionVO partitionVO = new TopicPartitionVO();
|
||||
partitionVO.setPartition(partitionInfo.partition());
|
||||
partitionVO.setLeader(partitionInfo.leader().toString());
|
||||
partitionVO.setReplicas(partitionInfo.replicas().stream().map(Node::toString).collect(Collectors.toList()));
|
||||
partitionVO.setIsr(partitionInfo.isr().stream().map(Node::toString).collect(Collectors.toList()));
|
||||
partitionVO.setReplicas(partitionInfo.replicas().stream().map(node -> node.host() + ":" + node.port() + " (id: " + node.idString() + ")").collect(Collectors.toList()));
|
||||
partitionVO.setIsr(partitionInfo.isr().stream().map(Node::idString).collect(Collectors.toList()));
|
||||
return partitionVO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,9 @@ public class OperationController {
|
||||
public Object configThrottle(@RequestBody BrokerThrottleDTO dto) {
|
||||
return operationService.configThrottle(dto.getBrokerList(), dto.getUnit().toKb(dto.getThrottle()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/broker/throttle")
|
||||
public Object removeThrottle(@RequestBody BrokerThrottleDTO dto) {
|
||||
return operationService.removeThrottle(dto.getBrokerList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,6 @@ public interface OperationService {
|
||||
ResponseData electPreferredLeader(String topic, int partition);
|
||||
|
||||
ResponseData configThrottle(List<Integer> brokerList, long size);
|
||||
|
||||
ResponseData removeThrottle(List<Integer> brokerList);
|
||||
}
|
||||
|
||||
@@ -129,4 +129,10 @@ public class OperationServiceImpl implements OperationService {
|
||||
|
||||
return (boolean) tuple2._1() ? ResponseData.create().success() : ResponseData.create().failed(tuple2._2());
|
||||
}
|
||||
|
||||
@Override public ResponseData removeThrottle(List<Integer> brokerList) {
|
||||
Tuple2<Object, String> tuple2 = operationConsole.clearBrokerLevelThrottles(new HashSet<>(brokerList));
|
||||
|
||||
return (boolean) tuple2._1() ? ResponseData.create().success() : ResponseData.create().failed(tuple2._2());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,4 +221,14 @@ class OperationConsole(config: KafkaConfig, topicConsole: TopicConsole,
|
||||
(false, e.getMessage)
|
||||
}).asInstanceOf[(Boolean, String)]
|
||||
}
|
||||
|
||||
def clearBrokerLevelThrottles(brokers: util.Set[Int]): (Boolean, String) = {
|
||||
withAdminClientAndCatchError(admin => {
|
||||
ReassignPartitionsCommand.clearBrokerLevelThrottles(admin, brokers.asScala.toSet)
|
||||
(true, "")
|
||||
}, e => {
|
||||
log.error("clearBrokerLevelThrottles error.", e)
|
||||
(false, e.getMessage)
|
||||
}).asInstanceOf[(Boolean, String)]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user