Merge branch 'master' into dev

This commit is contained in:
zengqiao
2020-09-25 11:44:23 +08:00
44 changed files with 1096 additions and 167 deletions

View File

@@ -176,7 +176,7 @@ public class OrderController {
TopicDO topicInfoDO = OrderConverter.convert2TopicInfoDO(orderTopicDO);
List<Integer> brokerIdList = regionService.getFullBrokerId(clusterDO.getId(), reqObj.getRegionIdList(), reqObj.getBrokerIdList());
Properties topicConfig = new Properties();
topicConfig.setProperty("retention.ms", String.valueOf(reqObj.getRetentionTime()));
topicConfig.setProperty("retention.ms", String.valueOf(reqObj.getRetentionTime() * 60 * 60 * 1000));
try {
TopicMetadata topicMetadata = new TopicMetadata();
topicMetadata.setTopic(orderTopicDO.getTopicName());
@@ -325,14 +325,16 @@ public class OrderController {
orderPartitionDO.setApprover(username);
orderPartitionDO.setOpinion(reqObj.getApprovalOpinions());
orderPartitionDO.setOrderStatus(reqObj.getOrderStatus());
result = orderService.modifyOrderPartition(orderPartitionDO, username);
result = orderService.modifyOrderPartition(orderPartitionDO, username, true);
if (!StatusCode.SUCCESS.equals(result.getCode())) {
return new Result(StatusCode.OPERATION_ERROR, "create topic success, but update order status failed, err:" + result.getMessage());
return new Result(StatusCode.OPERATION_ERROR, "expand topic success, but update order status failed, err:" + result.getMessage());
}
return new Result();
}
private Result expandTopic(ClusterDO clusterDO, OrderPartitionExecModel reqObj, OrderPartitionDO orderPartitionDO) {
private Result expandTopic(ClusterDO clusterDO,
OrderPartitionExecModel reqObj,
OrderPartitionDO orderPartitionDO) {
List<Integer> brokerIdList = regionService.getFullBrokerId(clusterDO.getId(), reqObj.getRegionIdList(), reqObj.getBrokerIdList());
try {
TopicMetadata topicMetadata = new TopicMetadata();
@@ -343,6 +345,8 @@ public class OrderController {
if (!AdminTopicStatusEnum.SUCCESS.equals(adminTopicStatusEnum)) {
return new Result(StatusCode.OPERATION_ERROR, adminTopicStatusEnum.getMessage());
}
orderPartitionDO.setPartitionNum(reqObj.getPartitionNum());
orderPartitionDO.setBrokerList(ListUtils.intList2String(brokerIdList));
} catch (Exception e) {
logger.error("expandTopic@OrderController, create failed, req:{}.", reqObj);
return new Result(StatusCode.OPERATION_ERROR, Constant.KAFKA_MANAGER_INNER_ERROR);

View File

@@ -86,7 +86,8 @@ public class OrderConverter {
public static OrderPartitionVO convert2OrderPartitionVO(OrderPartitionDO orderPartitionDO,
TopicMetadata topicMetadata,
Long maxAvgBytes, List<RegionDO> regionDOList) {
Long maxAvgBytes,
List<RegionDO> regionDOList) {
if (orderPartitionDO == null) {
return null;
}
@@ -100,8 +101,12 @@ public class OrderConverter {
if (topicMetadata == null) {
return orderPartitionVO;
}
orderPartitionVO.setPartitionNum(topicMetadata.getPartitionNum());
orderPartitionVO.setPartitionNum(null);
orderPartitionVO.setBrokerIdList(new ArrayList<>(topicMetadata.getBrokerIdSet()));
if (OrderStatusEnum.PASSED.getCode().equals(orderPartitionDO.getOrderStatus())) {
orderPartitionVO.setPartitionNum(orderPartitionDO.getPartitionNum());
}
if (regionDOList == null || regionDOList.isEmpty()) {
orderPartitionVO.setRegionNameList(new ArrayList<>());

View File

@@ -0,0 +1,33 @@
server:
port: 8080
tomcat:
accept-count: 100
max-connections: 1000
max-threads: 20
min-spare-threads: 20
spring:
application:
name: kafkamanager
datasource:
kafka-manager:
driver-class-name: org.postgresql.Driver
jdbc-url: jdbc:postgresql://localhost:5432/kafka_manager?reWriteBatchedInserts=true
username: admin
password: admin
type: com.zaxxer.hikari.HikariDataSource
hikari:
connection-init-sql: "SET TIME ZONE 'Asia/Chongqing';SET CLIENT_ENCODING TO 'UTF-8';"
connection-test-query: "select 1;"
main:
allow-bean-definition-overriding: true
logging:
config: classpath:logback-spring.xml
# kafka监控
kafka-monitor:
enabled: true
notify-kafka:
cluster-id: 95
topic-name: kmo_monitor

View File

@@ -11,16 +11,13 @@ spring:
name: kafkamanager
datasource:
kafka-manager:
driver-class-name: org.mariadb.jdbc.Driver
jdbc-url: jdbc:mysql://localhost:3306/kafka_manager?characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: admin
password: admin
driver-class-name: org.mariadb.jdbc.Driver
main:
allow-bean-definition-overriding: true
profiles:
active: dev
logging:
config: classpath:logback-spring.xml