mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-07 06:02:07 +08:00
扩分区工单优化
This commit is contained in:
@@ -9,6 +9,10 @@ public class OrderPartitionDO extends BaseDO{
|
|||||||
|
|
||||||
private String applicant;
|
private String applicant;
|
||||||
|
|
||||||
|
private Integer partitionNum;
|
||||||
|
|
||||||
|
private String brokerList;
|
||||||
|
|
||||||
private Long peakBytesIn;
|
private Long peakBytesIn;
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
@@ -51,6 +55,22 @@ public class OrderPartitionDO extends BaseDO{
|
|||||||
this.applicant = applicant;
|
this.applicant = applicant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getPartitionNum() {
|
||||||
|
return partitionNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPartitionNum(Integer partitionNum) {
|
||||||
|
this.partitionNum = partitionNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBrokerList() {
|
||||||
|
return brokerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrokerList(String brokerList) {
|
||||||
|
this.brokerList = brokerList;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getPeakBytesIn() {
|
public Long getPeakBytesIn() {
|
||||||
return peakBytesIn;
|
return peakBytesIn;
|
||||||
}
|
}
|
||||||
@@ -98,6 +118,8 @@ public class OrderPartitionDO extends BaseDO{
|
|||||||
", clusterName='" + clusterName + '\'' +
|
", clusterName='" + clusterName + '\'' +
|
||||||
", topicName='" + topicName + '\'' +
|
", topicName='" + topicName + '\'' +
|
||||||
", applicant='" + applicant + '\'' +
|
", applicant='" + applicant + '\'' +
|
||||||
|
", partitionNum=" + partitionNum +
|
||||||
|
", brokerList='" + brokerList + '\'' +
|
||||||
", peakBytesIn=" + peakBytesIn +
|
", peakBytesIn=" + peakBytesIn +
|
||||||
", description='" + description + '\'' +
|
", description='" + description + '\'' +
|
||||||
", orderStatus=" + orderStatus +
|
", orderStatus=" + orderStatus +
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
<result column="cluster_name" property="clusterName" />
|
<result column="cluster_name" property="clusterName" />
|
||||||
<result column="topic_name" property="topicName" />
|
<result column="topic_name" property="topicName" />
|
||||||
<result column="applicant" property="applicant" />
|
<result column="applicant" property="applicant" />
|
||||||
|
<result column="partition_num" property="partitionNum" />
|
||||||
|
<result column="broker_list" property="brokerList" />
|
||||||
<result column="peak_bytes_in" property="peakBytesIn" />
|
<result column="peak_bytes_in" property="peakBytesIn" />
|
||||||
<result column="description" property="description" />
|
<result column="description" property="description" />
|
||||||
<result column="order_status" property="orderStatus" />
|
<result column="order_status" property="orderStatus" />
|
||||||
@@ -38,6 +40,16 @@
|
|||||||
cluster_name=#{clusterName},
|
cluster_name=#{clusterName},
|
||||||
topic_name=#{topicName},
|
topic_name=#{topicName},
|
||||||
applicant=#{applicant},
|
applicant=#{applicant},
|
||||||
|
<trim>
|
||||||
|
<if test="partitionNum!=null">
|
||||||
|
partition_num=#{partitionNum},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim>
|
||||||
|
<if test="brokerList!=null">
|
||||||
|
broker_list=#{brokerList},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
peak_bytes_in=#{peakBytesIn},
|
peak_bytes_in=#{peakBytesIn},
|
||||||
description=#{description},
|
description=#{description},
|
||||||
order_status=#{orderStatus},
|
order_status=#{orderStatus},
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ CREATE TABLE `order_partition` (
|
|||||||
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
|
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
|
||||||
`cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称',
|
`cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称',
|
||||||
`topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
|
`topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
|
||||||
|
`broker_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'Broker列表, 逗号分割',
|
||||||
|
`partition_num` int(11) NOT NULL DEFAULT 0 COMMENT '新增分区数',
|
||||||
`applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人',
|
`applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人',
|
||||||
`peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量',
|
`peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量',
|
||||||
`description` text COMMENT '备注信息',
|
`description` text COMMENT '备注信息',
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ CREATE TABLE order_partition
|
|||||||
cluster_name varchar(128) NOT NULL DEFAULT '', -- '集群名称',
|
cluster_name varchar(128) NOT NULL DEFAULT '', -- '集群名称',
|
||||||
topic_name varchar(192) NOT NULL DEFAULT '', -- 'Topic名称',
|
topic_name varchar(192) NOT NULL DEFAULT '', -- 'Topic名称',
|
||||||
applicant varchar(128) NOT NULL DEFAULT '', -- '申请人',
|
applicant varchar(128) NOT NULL DEFAULT '', -- '申请人',
|
||||||
|
partition_num int NOT NULL DEFAULT '0', -- '分区数',
|
||||||
|
broker_list varchar(128) NOT NULL DEFAULT '', -- 'Broker列表',
|
||||||
peak_bytes_in bigint NOT NULL DEFAULT '0', -- '峰值流量',
|
peak_bytes_in bigint NOT NULL DEFAULT '0', -- '峰值流量',
|
||||||
description text, -- '备注信息',
|
description text, -- '备注信息',
|
||||||
order_status int NOT NULL DEFAULT '0', -- '工单状态',
|
order_status int NOT NULL DEFAULT '0', -- '工单状态',
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ CREATE TABLE `order_partition` (
|
|||||||
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
|
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID',
|
||||||
`cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称',
|
`cluster_name` varchar(128) NOT NULL DEFAULT '' COMMENT '集群名称',
|
||||||
`topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
|
`topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称',
|
||||||
|
`broker_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'Broker列表, 逗号分割',
|
||||||
|
`partition_num` int(11) NOT NULL DEFAULT 0 COMMENT '新增分区数',
|
||||||
`applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人',
|
`applicant` varchar(128) NOT NULL DEFAULT '' COMMENT '申请人',
|
||||||
`peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量',
|
`peak_bytes_in` bigint(20) NOT NULL DEFAULT '0' COMMENT '峰值流量',
|
||||||
`description` text COMMENT '备注信息',
|
`description` text COMMENT '备注信息',
|
||||||
|
|||||||
@@ -332,7 +332,9 @@ public class OrderController {
|
|||||||
return new Result();
|
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());
|
List<Integer> brokerIdList = regionService.getFullBrokerId(clusterDO.getId(), reqObj.getRegionIdList(), reqObj.getBrokerIdList());
|
||||||
try {
|
try {
|
||||||
TopicMetadata topicMetadata = new TopicMetadata();
|
TopicMetadata topicMetadata = new TopicMetadata();
|
||||||
@@ -343,6 +345,8 @@ public class OrderController {
|
|||||||
if (!AdminTopicStatusEnum.SUCCESS.equals(adminTopicStatusEnum)) {
|
if (!AdminTopicStatusEnum.SUCCESS.equals(adminTopicStatusEnum)) {
|
||||||
return new Result(StatusCode.OPERATION_ERROR, adminTopicStatusEnum.getMessage());
|
return new Result(StatusCode.OPERATION_ERROR, adminTopicStatusEnum.getMessage());
|
||||||
}
|
}
|
||||||
|
orderPartitionDO.setPartitionNum(reqObj.getPartitionNum());
|
||||||
|
orderPartitionDO.setBrokerList(ListUtils.intList2String(brokerIdList));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("expandTopic@OrderController, create failed, req:{}.", reqObj);
|
logger.error("expandTopic@OrderController, create failed, req:{}.", reqObj);
|
||||||
return new Result(StatusCode.OPERATION_ERROR, Constant.KAFKA_MANAGER_INNER_ERROR);
|
return new Result(StatusCode.OPERATION_ERROR, Constant.KAFKA_MANAGER_INNER_ERROR);
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ public class OrderConverter {
|
|||||||
|
|
||||||
public static OrderPartitionVO convert2OrderPartitionVO(OrderPartitionDO orderPartitionDO,
|
public static OrderPartitionVO convert2OrderPartitionVO(OrderPartitionDO orderPartitionDO,
|
||||||
TopicMetadata topicMetadata,
|
TopicMetadata topicMetadata,
|
||||||
Long maxAvgBytes, List<RegionDO> regionDOList) {
|
Long maxAvgBytes,
|
||||||
|
List<RegionDO> regionDOList) {
|
||||||
if (orderPartitionDO == null) {
|
if (orderPartitionDO == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -100,8 +101,12 @@ public class OrderConverter {
|
|||||||
if (topicMetadata == null) {
|
if (topicMetadata == null) {
|
||||||
return orderPartitionVO;
|
return orderPartitionVO;
|
||||||
}
|
}
|
||||||
orderPartitionVO.setPartitionNum(topicMetadata.getPartitionNum());
|
|
||||||
|
orderPartitionVO.setPartitionNum(null);
|
||||||
orderPartitionVO.setBrokerIdList(new ArrayList<>(topicMetadata.getBrokerIdSet()));
|
orderPartitionVO.setBrokerIdList(new ArrayList<>(topicMetadata.getBrokerIdSet()));
|
||||||
|
if (OrderStatusEnum.PASSED.getCode().equals(orderPartitionDO.getOrderStatus())) {
|
||||||
|
orderPartitionVO.setPartitionNum(orderPartitionDO.getPartitionNum());
|
||||||
|
}
|
||||||
|
|
||||||
if (regionDOList == null || regionDOList.isEmpty()) {
|
if (regionDOList == null || regionDOList.isEmpty()) {
|
||||||
orderPartitionVO.setRegionNameList(new ArrayList<>());
|
orderPartitionVO.setRegionNameList(new ArrayList<>());
|
||||||
|
|||||||
Reference in New Issue
Block a user