forked from apache/inlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INLONG-10601][Manager] Optimize the agent task configuration process (…
- Loading branch information
Showing
20 changed files
with
732 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/AgentTaskConfigEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.dao.entity; | ||
|
||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
/** | ||
* Agent task config entity, including agent ip, cluster name, etc. | ||
*/ | ||
@Data | ||
public class AgentTaskConfigEntity implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private Integer id; | ||
private String clusterName; | ||
private String agentIp; | ||
|
||
private String configParams; | ||
|
||
private String taskParams; | ||
|
||
private Integer isDeleted; | ||
private String creator; | ||
private String modifier; | ||
private Date createTime; | ||
private Date modifyTime; | ||
private Integer version; | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...r-dao/src/main/java/org/apache/inlong/manager/dao/mapper/AgentTaskConfigEntityMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.dao.mapper; | ||
|
||
import org.apache.inlong.manager.common.tenant.MultiTenantQuery; | ||
import org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity; | ||
|
||
import org.apache.ibatis.annotations.Options; | ||
import org.apache.ibatis.annotations.Param; | ||
import org.apache.ibatis.cursor.Cursor; | ||
import org.apache.ibatis.mapping.ResultSetType; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AgentTaskConfigEntityMapper { | ||
|
||
int insert(AgentTaskConfigEntity record); | ||
|
||
AgentTaskConfigEntity selectByPrimaryKey(Integer id); | ||
|
||
AgentTaskConfigEntity selectByIdentifier(@Param("agentIp") String agentIp, | ||
@Param("clusterName") String clusterName); | ||
|
||
int updateByIdSelective(AgentTaskConfigEntity record); | ||
|
||
@MultiTenantQuery(with = false) | ||
@Options(resultSetType = ResultSetType.FORWARD_ONLY, fetchSize = Integer.MIN_VALUE) | ||
Cursor<AgentTaskConfigEntity> selectAllAgentTaskConfigs(); | ||
|
||
} |
100 changes: 100 additions & 0 deletions
100
inlong-manager/manager-dao/src/main/resources/mappers/AgentTaskConfigEntityMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="org.apache.inlong.manager.dao.mapper.AgentTaskConfigEntityMapper"> | ||
<resultMap id="BaseResultMap" type="org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity"> | ||
<id column="id" jdbcType="INTEGER" property="id"/> | ||
<result column="agent_ip" jdbcType="VARCHAR" property="agentIp"/> | ||
<result column="cluster_name" jdbcType="VARCHAR" property="clusterName"/> | ||
<result column="config_params" jdbcType="VARCHAR" property="configParams"/> | ||
<result column="task_params" jdbcType="VARCHAR" property="taskParams"/> | ||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/> | ||
<result column="creator" jdbcType="VARCHAR" property="creator"/> | ||
<result column="modifier" jdbcType="VARCHAR" property="modifier"/> | ||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | ||
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/> | ||
<result column="version" jdbcType="INTEGER" property="version"/> | ||
</resultMap> | ||
|
||
<sql id="Base_Column_List"> | ||
id, agent_ip, cluster_name, config_params, task_params, is_deleted, creator, modifier, create_time, modify_time, version | ||
</sql> | ||
<insert id="insert" useGeneratedKeys="true" keyProperty="id" | ||
parameterType="org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity"> | ||
insert into agent_task_config (id, agent_ip, cluster_name, | ||
config_params, task_params, | ||
creator, modifier) | ||
values (#{id, jdbcType=INTEGER}, #{agentIp, jdbcType=VARCHAR}, #{clusterName, jdbcType=VARCHAR}, | ||
#{configParams, jdbcType=VARCHAR}, #{taskParams, jdbcType=VARCHAR}, | ||
#{creator, jdbcType=VARCHAR}, #{modifier, jdbcType=VARCHAR}) | ||
</insert> | ||
|
||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
select | ||
<include refid="Base_Column_List"/> | ||
from agent_task_config | ||
where id = #{id,jdbcType=INTEGER} | ||
and is_deleted = 0 | ||
</select> | ||
<select id="selectByIdentifier" resultType="org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity"> | ||
select | ||
<include refid="Base_Column_List"/> | ||
from agent_task_config | ||
where agent_ip = #{agentIp,jdbcType=VARCHAR} | ||
and cluster_name = #{clusterName, jdbcType=VARCHAR} | ||
and is_deleted = 0 | ||
</select> | ||
<select id="selectAllAgentTaskConfigs" resultType="org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity"> | ||
select | ||
<include refid="Base_Column_List"/> | ||
from agent_task_config | ||
<where> | ||
and is_deleted = 0 | ||
and agent_ip is not null | ||
</where> | ||
</select> | ||
<update id="updateByIdSelective" parameterType="org.apache.inlong.manager.dao.entity.AgentTaskConfigEntity"> | ||
update agent_task_config | ||
<set> | ||
<if test="agentIp != null"> | ||
agent_ip = #{agentIp,jdbcType=VARCHAR}, | ||
</if> | ||
<if test="clusterName != null"> | ||
cluster_name = #{clusterName,jdbcType=VARCHAR}, | ||
</if> | ||
<if test="configParams != null"> | ||
config_params = #{configParams,jdbcType=VARCHAR}, | ||
</if> | ||
<if test="taskParams != null"> | ||
task_params = #{taskParams,jdbcType=VARCHAR}, | ||
</if> | ||
<if test="isDeleted != null"> | ||
is_deleted = #{isDeleted,jdbcType=INTEGER}, | ||
</if> | ||
<if test="modifier != null"> | ||
modifier = #{modifier,jdbcType=VARCHAR}, | ||
</if> | ||
version = #{version,jdbcType=INTEGER} + 1 | ||
</set> | ||
where id = #{id,jdbcType=INTEGER} | ||
and version = #{version,jdbcType=INTEGER} | ||
</update> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.