feat: 2.5.0

1. 优化代码
This commit is contained in:
byteblogs168 2023-11-24 18:20:12 +08:00
parent 3427401cc9
commit 722be7623d
13 changed files with 85 additions and 48 deletions

View File

@ -39,7 +39,7 @@ CREATE TABLE `group_config`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_name` (`group_name`) UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='组配置' DEFAULT CHARSET = utf8mb4 COMMENT ='组配置'
@ -62,7 +62,7 @@ CREATE TABLE `notify_config`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name` (`group_name`) KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='通知配置' DEFAULT CHARSET = utf8mb4 COMMENT ='通知配置'
@ -83,11 +83,11 @@ CREATE TABLE `retry_dead_letter_0`
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据', `task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name_scene_name` (`group_name`, `scene_name`), KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
KEY `idx_idempotent_id` (`idempotent_id`), KEY `idx_idempotent_id` (`idempotent_id`),
KEY `idx_biz_no` (`biz_no`), KEY `idx_biz_no` (`biz_no`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
UNIQUE KEY `uk_name_unique_id` (`group_name`, `unique_id`) UNIQUE KEY `uk_namespace_id_group_name_unique_id` (`namespace_id`, `group_name`, `unique_id`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='死信队列表' DEFAULT CHARSET = utf8mb4 COMMENT ='死信队列表'
@ -112,12 +112,13 @@ CREATE TABLE `retry_task_0`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name_scene_name` (`group_name`, `scene_name`), KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`, `scene_name`),
KEY `idx_retry_status` (`retry_status`), KEY `idx_namespace_id_group_name_task_type` (`namespace_id`,`group_name`, `task_type`),
KEY `idx_namespace_id_group_name_retry_status` (`namespace_id`,`group_name`, `retry_status`),
KEY `idx_idempotent_id` (`idempotent_id`), KEY `idx_idempotent_id` (`idempotent_id`),
KEY `idx_biz_no` (`biz_no`), KEY `idx_biz_no` (`biz_no`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
UNIQUE KEY `uk_name_unique_id` (`group_name`, `unique_id`) UNIQUE KEY `uk_name_unique_id` (`namespace_id`, `group_name`, `unique_id`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='任务表' DEFAULT CHARSET = utf8mb4 COMMENT ='任务表'
@ -139,7 +140,7 @@ CREATE TABLE `retry_task_log`
`task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据', `task_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '任务类型 1、重试数据 2、回调数据',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name_scene_name` (`group_name`, `scene_name`), KEY `idx_group_name_scene_name` (`namespace_id`,`group_name`, `scene_name`),
KEY `idx_retry_status` (`retry_status`), KEY `idx_retry_status` (`retry_status`),
KEY `idx_idempotent_id` (`idempotent_id`), KEY `idx_idempotent_id` (`idempotent_id`),
KEY `idx_unique_id` (`unique_id`), KEY `idx_unique_id` (`unique_id`),
@ -160,7 +161,7 @@ CREATE TABLE `retry_task_log_message`
`message` text NOT NULL COMMENT '异常信息', `message` text NOT NULL COMMENT '异常信息',
`client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port', `client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name_unique_id` (`group_name`, `unique_id`), KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`,`group_name`, `unique_id`),
KEY `idx_create_dt` (`create_dt`) KEY `idx_create_dt` (`create_dt`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
@ -184,7 +185,7 @@ CREATE TABLE `scene_config`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_group_name_scene_name` (`group_name`, `scene_name`) UNIQUE KEY `uk_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='场景配置' DEFAULT CHARSET = utf8mb4 COMMENT ='场景配置'
@ -205,6 +206,7 @@ CREATE TABLE `server_node`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_namespace_id_group_name` (`namespace_id`,`group_name`),
KEY `idx_expire_at_node_type` (`expire_at`, `node_type`), KEY `idx_expire_at_node_type` (`expire_at`, `node_type`),
UNIQUE KEY `uk_host_id_host_ip` (`host_id`, `host_ip`) UNIQUE KEY `uk_host_id_host_ip` (`host_id`, `host_ip`)
) ENGINE = InnoDB ) ENGINE = InnoDB
@ -254,20 +256,20 @@ CREATE TABLE `system_user_permission`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_group_name_system_user_id` (`group_name`, `system_user_id`) USING BTREE UNIQUE KEY `uk_namespace_id_group_name_system_user_id` (`namespace_id`, `group_name`, `system_user_id`)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户权限表'; DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户权限表';
CREATE TABLE `sequence_alloc` CREATE TABLE `sequence_alloc`
( (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', `namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称', `group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
`max_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '最大id', `max_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '最大id',
`step` int(11) NOT NULL DEFAULT '100' COMMENT '步长', `step` int(11) NOT NULL DEFAULT '100' COMMENT '步长',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uk_group_name` (`group_name`) USING BTREE UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='号段模式序号ID分配表'; DEFAULT CHARSET = utf8mb4 COMMENT ='号段模式序号ID分配表';
@ -301,7 +303,7 @@ CREATE TABLE `job`
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除', `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_group_name` (`group_name`), KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
KEY `idx_job_status_bucket_index` (`job_status`, `bucket_index`), KEY `idx_job_status_bucket_index` (`job_status`, `bucket_index`),
KEY `idx_create_dt` (`create_dt`) KEY `idx_create_dt` (`create_dt`)
) ENGINE = InnoDB ) ENGINE = InnoDB
@ -322,7 +324,7 @@ CREATE TABLE `job_log_message`
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_task_batch_id_task_id` (`task_batch_id`, `task_id`), KEY `idx_task_batch_id_task_id` (`task_batch_id`, `task_id`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
KEY `idx_group_name` (`group_name`) KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='调度日志'; DEFAULT CHARSET = utf8mb4 COMMENT ='调度日志';
@ -347,7 +349,7 @@ CREATE TABLE `job_task`
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_task_batch_id_task_status` (`task_batch_id`, `task_status`), KEY `idx_task_batch_id_task_status` (`task_batch_id`, `task_status`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
KEY `idx_group_name` (`group_name`) KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='任务实例'; DEFAULT CHARSET = utf8mb4 COMMENT ='任务实例';
@ -369,7 +371,7 @@ CREATE TABLE `job_task_batch`
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`), KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
KEY `idx_group_name` (`group_name`) KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次'; DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次';

View File

@ -12,8 +12,6 @@ import java.util.List;
@Mapper @Mapper
public interface ServerNodeMapper extends BaseMapper<ServerNode> { public interface ServerNodeMapper extends BaseMapper<ServerNode> {
int insertOrUpdate(ServerNode record);
int insertOrUpdate(List<ServerNode> records); int insertOrUpdate(List<ServerNode> records);
int deleteByExpireAt(@Param("endTime") LocalDateTime endTime); int deleteByExpireAt(@Param("endTime") LocalDateTime endTime);

View File

@ -3,6 +3,7 @@
<mapper namespace="com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper"> <mapper namespace="com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper">
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode"> <resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="namespace_id" jdbcType="VARCHAR" property="namespaceId" />
<result column="group_name" jdbcType="VARCHAR" property="groupName" /> <result column="group_name" jdbcType="VARCHAR" property="groupName" />
<result column="host_id" jdbcType="VARCHAR" property="hostId" /> <result column="host_id" jdbcType="VARCHAR" property="hostId" />
<result column="host_ip" jdbcType="VARCHAR" property="hostIp" /> <result column="host_ip" jdbcType="VARCHAR" property="hostIp" />
@ -15,16 +16,16 @@
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" /> <result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt id, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
</sql> </sql>
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into server_node (id, group_name, host_id, host_ip, host_port, insert into server_node (namespace_id, group_name, host_id, host_ip, host_port,
expire_at, node_type, ext_attrs, context_path, create_dt) expire_at, node_type, ext_attrs, context_path, create_dt)
values values
<foreach collection="records" item="item" index="index" separator="," open="(" close=")"> <foreach collection="records" item="item" index="index" separator="," open="(" close=")">
#{id,jdbcType=BIGINT}, #{groupName,jdbcType=VARCHAR}, #{hostId,jdbcType=VARCHAR}, #{hostIp,jdbcType=VARCHAR}, #{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR},
#{hostPort,jdbcType=INTEGER}, #{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT},
#{expireAt,jdbcType=TIMESTAMP}, #{nodeType,jdbcType=TINYINT}, #{extAttrs,jdbcType=VARCHAR}, #{contextPath,jdbcType=VARCHAR}, #{createDt,jdbcType=TIMESTAMP} #{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP}
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
expire_at = values(`expire_at`) expire_at = values(`expire_at`)

View File

@ -135,7 +135,7 @@ public class CacheRegisterTable implements Lifecycle {
LogUtils.info(log, "Add cache. groupName:[{}] namespaceId:[{}] hostId:[{}]", serverNode.getGroupName(), serverNode.getNamespaceId(), serverNode.getHostId()); LogUtils.info(log, "Add cache. groupName:[{}] namespaceId:[{}] hostId:[{}]", serverNode.getGroupName(), serverNode.getNamespaceId(), serverNode.getHostId());
concurrentMap = new ConcurrentHashMap<>(); concurrentMap = new ConcurrentHashMap<>();
registerNodeInfo = RegisterNodeInfoConverter.INSTANCE.toRegisterNodeInfo(serverNode); registerNodeInfo = RegisterNodeInfoConverter.INSTANCE.toRegisterNodeInfo(serverNode);
CACHE.put(serverNode.getGroupName(), concurrentMap); CACHE.put(getKey(serverNode.getGroupName(), serverNode.getNamespaceId()), concurrentMap);
} else { } else {
// 复用缓存中的对象 // 复用缓存中的对象
registerNodeInfo = concurrentMap.getOrDefault(serverNode.getHostId(), RegisterNodeInfoConverter.INSTANCE.toRegisterNodeInfo(serverNode)); registerNodeInfo = concurrentMap.getOrDefault(serverNode.getHostId(), RegisterNodeInfoConverter.INSTANCE.toRegisterNodeInfo(serverNode));

View File

@ -1,6 +1,7 @@
package com.aizuda.easy.retry.server.common.handler; package com.aizuda.easy.retry.server.common.handler;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.aizuda.easy.retry.common.core.constant.SystemConstants;
import com.aizuda.easy.retry.common.core.enums.NodeTypeEnum; import com.aizuda.easy.retry.common.core.enums.NodeTypeEnum;
import com.aizuda.easy.retry.common.core.log.LogUtils; import com.aizuda.easy.retry.common.core.log.LogUtils;
import com.aizuda.easy.retry.server.common.Lifecycle; import com.aizuda.easy.retry.server.common.Lifecycle;
@ -64,7 +65,7 @@ public class ServerNodeBalance implements Lifecycle, Runnable {
try { try {
// 为了保证客户端分配算法的一致性,serverNodes 从数据库从数据获取 // 为了保证客户端分配算法的一致性,serverNodes 从数据库从数据获取
Set<String> podIpSet = CacheRegisterTable.getPodIdSet(ServerRegister.GROUP_NAME, StrUtil.EMPTY); Set<String> podIpSet = CacheRegisterTable.getPodIdSet(ServerRegister.GROUP_NAME, ServerRegister.NAMESPACE_ID);
if (CollectionUtils.isEmpty(podIpSet)) { if (CollectionUtils.isEmpty(podIpSet)) {
LogUtils.error(log, "server node is empty"); LogUtils.error(log, "server node is empty");
@ -168,7 +169,7 @@ public class ServerNodeBalance implements Lifecycle, Runnable {
// 获取缓存中的节点 // 获取缓存中的节点
ConcurrentMap<String/*hostId*/, RegisterNodeInfo> concurrentMap = Optional.ofNullable(CacheRegisterTable ConcurrentMap<String/*hostId*/, RegisterNodeInfo> concurrentMap = Optional.ofNullable(CacheRegisterTable
.get(ServerRegister.GROUP_NAME, StrUtil.EMPTY)).orElse(new ConcurrentHashMap<>()); .get(ServerRegister.GROUP_NAME, ServerRegister.NAMESPACE_ID)).orElse(new ConcurrentHashMap<>());
Set<String> remoteHostIds = remotePods.stream().map(ServerNode::getHostId).collect(Collectors.toSet()); Set<String> remoteHostIds = remotePods.stream().map(ServerNode::getHostId).collect(Collectors.toSet());
@ -201,7 +202,7 @@ public class ServerNodeBalance implements Lifecycle, Runnable {
// 再次获取最新的节点信息 // 再次获取最新的节点信息
concurrentMap = CacheRegisterTable concurrentMap = CacheRegisterTable
.get(ServerRegister.GROUP_NAME, StrUtil.EMPTY); .get(ServerRegister.GROUP_NAME, ServerRegister.NAMESPACE_ID);
// 找出过期的节点 // 找出过期的节点
Set<RegisterNodeInfo> expireNodeSet = concurrentMap.values().stream() Set<RegisterNodeInfo> expireNodeSet = concurrentMap.values().stream()

View File

@ -60,6 +60,7 @@ public abstract class AbstractRegister implements Register, Lifecycle {
ServerNode serverNode = new ServerNode(); ServerNode serverNode = new ServerNode();
serverNode.setHostId(context.getHostId()); serverNode.setHostId(context.getHostId());
serverNode.setHostIp(context.getHostIp()); serverNode.setHostIp(context.getHostIp());
serverNode.setNamespaceId(context.getNamespaceId());
serverNode.setGroupName(context.getGroupName()); serverNode.setGroupName(context.getGroupName());
serverNode.setHostPort(context.getHostPort()); serverNode.setHostPort(context.getHostPort());
serverNode.setNodeType(getNodeType()); serverNode.setNodeType(getNodeType());

View File

@ -12,6 +12,8 @@ import java.time.LocalDateTime;
@Data @Data
public class RegisterContext { public class RegisterContext {
private String namespaceId;
private String groupName; private String groupName;
private String hostId; private String hostId;

View File

@ -38,6 +38,7 @@ public class ServerRegister extends AbstractRegister {
public static final int DELAY_TIME = 30; public static final int DELAY_TIME = 30;
public static final String CURRENT_CID; public static final String CURRENT_CID;
public static final String GROUP_NAME = "DEFAULT_SERVER"; public static final String GROUP_NAME = "DEFAULT_SERVER";
public static final String NAMESPACE_ID = "DEFAULT_SERVER_NAMESPACE_ID";
@Autowired @Autowired
public ServerNodeBalance serverNodeBalance; public ServerNodeBalance serverNodeBalance;
@ -67,6 +68,7 @@ public class ServerRegister extends AbstractRegister {
context.setHostIp(HostUtils.getIp()); context.setHostIp(HostUtils.getIp());
context.setHostPort(systemProperties.getNettyPort()); context.setHostPort(systemProperties.getNettyPort());
context.setContextPath(StrUtil.EMPTY); context.setContextPath(StrUtil.EMPTY);
context.setNamespaceId(NAMESPACE_ID);
context.setExtAttrs(JsonUtil.toJsonString(serverNodeExtAttrs)); context.setExtAttrs(JsonUtil.toJsonString(serverNodeExtAttrs));
} }

View File

@ -87,6 +87,7 @@ public class RequestHandlerActor extends AbstractActor {
Integer hostPort = headers.getInt(HeadersEnum.HOST_PORT.getKey()); Integer hostPort = headers.getInt(HeadersEnum.HOST_PORT.getKey());
String groupName = headers.get(HeadersEnum.GROUP_NAME.getKey()); String groupName = headers.get(HeadersEnum.GROUP_NAME.getKey());
String contextPath = headers.get(HeadersEnum.CONTEXT_PATH.getKey()); String contextPath = headers.get(HeadersEnum.CONTEXT_PATH.getKey());
String namespace = headers.get(HeadersEnum.NAMESPACE.getKey());
// 注册版本 // 注册版本
RegisterContext registerContext = new RegisterContext(); RegisterContext registerContext = new RegisterContext();
@ -96,6 +97,7 @@ public class RequestHandlerActor extends AbstractActor {
registerContext.setHostIp(hostIp); registerContext.setHostIp(hostIp);
registerContext.setHostId(hostId); registerContext.setHostId(hostId);
registerContext.setUri(uri); registerContext.setUri(uri);
registerContext.setNamespaceId(namespace);
boolean result = register.register(registerContext); boolean result = register.register(registerContext);
if (!result) { if (!result) {
LogUtils.warn(log, "client register error. groupName:[{}]", groupName); LogUtils.warn(log, "client register error. groupName:[{}]", groupName);

View File

@ -295,7 +295,8 @@ public class GroupConfigServiceImpl implements GroupConfigService {
List<GroupConfig> groupConfigs = groupConfigAccess.list(new LambdaQueryWrapper<GroupConfig>() List<GroupConfig> groupConfigs = groupConfigAccess.list(new LambdaQueryWrapper<GroupConfig>()
.in(GroupConfig::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId()) .in(GroupConfig::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId())
.select(GroupConfig::getGroupName)).stream() .select(GroupConfig::getGroupName))
.stream()
.collect(Collectors.toList()); .collect(Collectors.toList());
return groupConfigs.stream().map(GroupConfig::getGroupName).collect(Collectors.toList()); return groupConfigs.stream().map(GroupConfig::getGroupName).collect(Collectors.toList());

View File

@ -188,13 +188,6 @@ export function getPartitionTableList () {
}) })
} }
export function getTotalPartition () {
return request({
url: api.totalPartition,
method: 'get'
})
}
export function getLineDispatchQuantity (parameter) { export function getLineDispatchQuantity (parameter) {
return request({ return request({
url: api.lineDispatchQuantity, url: api.lineDispatchQuantity,
@ -240,11 +233,10 @@ export function getGroupConfigForPage (parameter) {
}) })
} }
export function getAllGroupNameList (data) { export function getAllGroupNameList () {
return request({ return request({
url: api.allGroupNameList, url: api.allGroupNameList,
method: 'post', method: 'get'
data
}) })
} }

View File

@ -57,7 +57,6 @@ export default {
methods: { methods: {
isShow (record) { isShow (record) {
this.formType = record ? 'edit' : 'create' this.formType = record ? 'edit' : 'create'
console.log(this.formType)
this.loadEditInfo(record) this.loadEditInfo(record)
this.visible = true this.visible = true
this.form.resetFields() this.form.resetFields()
@ -79,6 +78,8 @@ export default {
this.visible = false this.visible = false
}) })
} }
this.$store.dispatch('GetInfo')
} }
}) })
}, },

View File

@ -43,7 +43,7 @@
:rowSelection="options.rowSelection" :rowSelection="options.rowSelection"
> >
<span slot="serial" slot-scope="text, record"> <span slot="serial" slot-scope="text, record">
{{ record.id }} <a href="#" @click="handlerDetail">{{ record.id }}</a>
</span> </span>
<span slot="groupNameList" slot-scope="text, record"> <span slot="groupNameList" slot-scope="text, record">
{{ record.role === 2 ? '所有组' : text.toString() }} {{ record.role === 2 ? '所有组' : text.toString() }}
@ -66,6 +66,33 @@
</template> </template>
</span> </span>
</s-table> </s-table>
<a-drawer
title="Basic Drawer"
placement="right"
:visible="openDrawer"
@close="onClose"
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<div
:style="{
position: 'absolute',
top: 0,
right: 0,
marginRight: '5px',
width: '100%',
borderTop: '1px solid #e9e9e9',
padding: '10px 16px',
background: '#fff',
// textAlign: 'right',
zIndex: 1,
}"
>
<a-button style='background: none'><a-icon type="arrows-alt" style='size: 16px;'/></a-button>
</div></a-drawer>
</a-card> </a-card>
</template> </template>
@ -150,7 +177,8 @@ export default {
onChange: this.onSelectChange onChange: this.onSelectChange
} }
}, },
optionAlertShow: false optionAlertShow: false,
openDrawer: false
} }
}, },
filters: { filters: {
@ -175,6 +203,12 @@ export default {
handleGoBack () { handleGoBack () {
this.record = '' this.record = ''
this.currentComponet = 'List' this.currentComponet = 'List'
},
handlerDetail () {
this.openDrawer = true
},
onClose () {
this.openDrawer = false
} }
}, },
watch: { watch: {