This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 624410b14 [INLONG-4052][Manager] Remove zone_tag field of inlong 
cluster table (#4054)
624410b14 is described below

commit 624410b1466c9adfc39fde91b3afef0e3e1058a0
Author: ciscozhou <[email protected]>
AuthorDate: Sun May 1 14:55:23 2022 +0800

    [INLONG-4052][Manager] Remove zone_tag field of inlong cluster table (#4054)
---
 .../pojo/cluster/InlongClusterPageRequest.java     |  3 --
 .../common/pojo/cluster/InlongClusterRequest.java  |  3 --
 .../common/pojo/cluster/InlongClusterResponse.java |  3 --
 .../manager/dao/entity/InlongClusterEntity.java    |  1 -
 .../dao/mapper/InlongClusterEntityMapper.java      |  4 +-
 .../dao/mapper/InlongClusterNodeEntityMapper.java  |  4 +-
 .../mappers/InlongClusterEntityMapper.xml          | 45 ++++++++--------------
 .../core/impl/InlongClusterServiceImpl.java        | 24 ++++++------
 .../core/impl/InlongClusterServiceTest.java        | 17 +++-----
 .../main/resources/sql/apache_inlong_manager.sql   |  1 -
 .../manager-web/sql/apache_inlong_manager.sql      |  1 -
 11 files changed, 38 insertions(+), 68 deletions(-)

diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterPageRequest.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterPageRequest.java
index cc379c78d..4a98bfe8d 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterPageRequest.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterPageRequest.java
@@ -43,9 +43,6 @@ public class InlongClusterPageRequest extends PageRequest {
     @ApiModelProperty(value = "Cluster tag")
     private String clusterTag;
 
-    @ApiModelProperty(value = "Cluster zone tag")
-    private String zoneTag;
-
     @ApiModelProperty(value = "Status")
     private Integer status;
 
diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterRequest.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterRequest.java
index 931df5a9b..f7e75f3fb 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterRequest.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterRequest.java
@@ -48,9 +48,6 @@ public class InlongClusterRequest {
     @ApiModelProperty(value = "Cluster tag")
     private String clusterTag;
 
-    @ApiModelProperty(value = "Cluster zone tag")
-    private String zoneTag;
-
     @ApiModelProperty(value = "Cluster heartbeat info")
     private String heartbeat;
 
diff --git 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterResponse.java
 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterResponse.java
index a136476c6..e4e190f37 100644
--- 
a/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterResponse.java
+++ 
b/inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/cluster/InlongClusterResponse.java
@@ -46,9 +46,6 @@ public class InlongClusterResponse {
     @ApiModelProperty(value = "Cluster type, including TUBE, PULSAR, 
DATA_PROXY, etc.")
     private String clusterTag;
 
-    @ApiModelProperty(value = "Cluster type, including TUBE, PULSAR, 
DATA_PROXY, etc.")
-    private String zoneTag;
-
     @ApiModelProperty(value = "Cluster heartbeat info")
     private String heartbeat;
 
diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/InlongClusterEntity.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/InlongClusterEntity.java
index 1e7b607a6..2671449f8 100644
--- 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/InlongClusterEntity.java
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/InlongClusterEntity.java
@@ -32,7 +32,6 @@ public class InlongClusterEntity implements Serializable {
     private String type;
     private String url;
     private String clusterTag;
-    private String zoneTag;
 
     private String extParams;
     private String heartbeat;
diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterEntityMapper.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterEntityMapper.java
index 9cc8de2de..1b643e393 100644
--- 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterEntityMapper.java
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterEntityMapper.java
@@ -31,11 +31,11 @@ public interface InlongClusterEntityMapper {
 
     int insertSelective(InlongClusterEntity record);
 
-    List<InlongClusterEntity> selectByCondition(InlongClusterPageRequest 
request);
+    InlongClusterEntity selectById(Integer id);
 
     InlongClusterEntity selectByUniqueKey(InlongClusterRequest request);
 
-    InlongClusterEntity selectById(Integer id);
+    List<InlongClusterEntity> selectByCondition(InlongClusterPageRequest 
request);
 
     int updateByIdSelective(InlongClusterEntity record);
 
diff --git 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterNodeEntityMapper.java
 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterNodeEntityMapper.java
index 6e2afddba..88b25731f 100644
--- 
a/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterNodeEntityMapper.java
+++ 
b/inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterNodeEntityMapper.java
@@ -31,12 +31,12 @@ public interface InlongClusterNodeEntityMapper {
 
     int insertSelective(InlongClusterNodeEntity record);
 
-    List<InlongClusterNodeEntity> selectByCondition(InlongClusterPageRequest 
request);
-
     InlongClusterNodeEntity selectById(Integer id);
 
     InlongClusterNodeEntity selectByUniqueKey(ClusterNodeRequest request);
 
+    List<InlongClusterNodeEntity> selectByCondition(InlongClusterPageRequest 
request);
+
     int updateById(InlongClusterNodeEntity record);
 
     int updateByIdSelective(InlongClusterNodeEntity record);
diff --git 
a/inlong-manager/manager-dao/src/main/resources/mappers/InlongClusterEntityMapper.xml
 
b/inlong-manager/manager-dao/src/main/resources/mappers/InlongClusterEntityMapper.xml
index ad351480b..e1710f1a0 100644
--- 
a/inlong-manager/manager-dao/src/main/resources/mappers/InlongClusterEntityMapper.xml
+++ 
b/inlong-manager/manager-dao/src/main/resources/mappers/InlongClusterEntityMapper.xml
@@ -26,7 +26,6 @@
         <result column="type" jdbcType="VARCHAR" property="type"/>
         <result column="url" jdbcType="VARCHAR" property="url"/>
         <result column="cluster_tag" jdbcType="VARCHAR" property="clusterTag"/>
-        <result column="zone_tag" jdbcType="VARCHAR" property="zoneTag"/>
         <result column="ext_params" jdbcType="LONGVARCHAR" 
property="extParams"/>
         <result column="heartbeat" jdbcType="LONGVARCHAR" 
property="heartbeat"/>
         <result column="in_charges" jdbcType="VARCHAR" property="inCharges"/>
@@ -38,24 +37,25 @@
         <result column="modify_time" jdbcType="TIMESTAMP" 
property="modifyTime"/>
     </resultMap>
     <sql id="Base_Column_List">
-        id
-        , name, type, url, cluster_tag, zone_tag, ext_params, heartbeat, 
in_charges,
+        id, name, type, url, cluster_tag, ext_params, heartbeat, in_charges,
         status, is_deleted, creator, modifier, create_time, modify_time
     </sql>
 
-    <insert id="insert" 
parameterType="org.apache.inlong.manager.dao.entity.InlongClusterEntity">
+    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
+            
parameterType="org.apache.inlong.manager.dao.entity.InlongClusterEntity">
         insert into inlong_cluster (id, name, type,
-                                    url, cluster_tag, zone_tag,
-                                    ext_params, heartbeat, in_charges,
-                                    status, is_deleted, creator,
-                                    modifier, create_time, modify_time)
+                                    url, cluster_tag, ext_params,
+                                    heartbeat, in_charges, status,
+                                    is_deleted, creator, modifier,
+                                    create_time, modify_time)
         values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
#{type,jdbcType=VARCHAR},
-                #{url,jdbcType=VARCHAR}, #{clusterTag,jdbcType=VARCHAR}, 
#{zoneTag,jdbcType=VARCHAR},
-                #{extParams,jdbcType=LONGVARCHAR}, 
#{heartbeat,jdbcType=LONGVARCHAR}, #{inCharges,jdbcType=VARCHAR},
-                #{status,jdbcType=INTEGER}, #{isDeleted,jdbcType=INTEGER}, 
#{creator,jdbcType=VARCHAR},
-                #{modifier,jdbcType=VARCHAR}, 
#{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})
+                #{url,jdbcType=VARCHAR}, #{clusterTag,jdbcType=VARCHAR}, 
#{extParams,jdbcType=LONGVARCHAR},
+                #{heartbeat,jdbcType=LONGVARCHAR}, 
#{inCharges,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
+                #{isDeleted,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, 
#{modifier,jdbcType=VARCHAR},
+                #{createTime,jdbcType=TIMESTAMP}, 
#{modifyTime,jdbcType=TIMESTAMP})
     </insert>
-    <insert id="insertSelective" 
parameterType="org.apache.inlong.manager.dao.entity.InlongClusterEntity">
+    <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"
+            
parameterType="org.apache.inlong.manager.dao.entity.InlongClusterEntity">
         insert into inlong_cluster
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">
@@ -73,9 +73,6 @@
             <if test="clusterTag != null">
                 cluster_tag,
             </if>
-            <if test="zoneTag != null">
-                zone_tag,
-            </if>
             <if test="inCharges != null">
                 in_charges,
             </if>
@@ -120,9 +117,6 @@
             <if test="clusterTag != null">
                 #{clusterTag,jdbcType=VARCHAR},
             </if>
-            <if test="zoneTag != null">
-                #{zoneTag,jdbcType=VARCHAR},
-            </if>
             <if test="inCharges != null">
                 #{inCharges,jdbcType=VARCHAR},
             </if>
@@ -166,7 +160,6 @@
             type        = #{type,jdbcType=VARCHAR},
             url         = #{url,jdbcType=VARCHAR},
             cluster_tag = #{clusterTag,jdbcType=VARCHAR},
-            zone_tag    = #{zoneTag,jdbcType=VARCHAR},
             ext_params  = #{extParams,jdbcType=LONGVARCHAR},
             heartbeat   = #{heartbeat,jdbcType=LONGVARCHAR},
             in_charges  = #{inCharges,jdbcType=VARCHAR},
@@ -204,15 +197,15 @@
         from inlong_cluster
         <where>
             is_deleted = 0
-            <if test="clusterTag != null and clusterTag != ''">
-                and cluster_tag = #{clusterTag, jdbcType=VARCHAR}
-            </if>
             <if test="type != null and type != ''">
                 and type = #{type, jdbcType=VARCHAR}
             </if>
             <if test="url != null and url != ''">
                 and url like CONCAT('%', #{url}, '%')
             </if>
+            <if test="clusterTag != null and clusterTag != ''">
+                and cluster_tag = #{clusterTag, jdbcType=VARCHAR}
+            </if>
             <if test="keyword != null and keyword != ''">
                 and (
                 name like CONCAT('%', #{keyword}, '%')
@@ -223,9 +216,6 @@
             <if test="status != null and status != ''">
                 and status = #{status, jdbcType=INTEGER}
             </if>
-            <if test="zoneTag != null and zoneTag != ''">
-                and zone_tag = #{zoneTag, jdbcType=VARCHAR}
-            </if>
         </where>
         order by modify_time desc
     </select>
@@ -244,9 +234,6 @@
             <if test="clusterTag != null">
                 cluster_tag = #{clusterTag,jdbcType=VARCHAR},
             </if>
-            <if test="zoneTag != null">
-                zone_tag = #{zoneTag,jdbcType=VARCHAR},
-            </if>
             <if test="extParams != null">
                 ext_params = #{extParams,jdbcType=LONGVARCHAR},
             </if>
diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceImpl.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceImpl.java
index ca2de2a3e..4fa7c3740 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceImpl.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceImpl.java
@@ -69,10 +69,10 @@ public class InlongClusterServiceImpl implements 
InlongClusterService {
         // check if cluster already exist
         InlongClusterEntity exist = clusterMapper.selectByUniqueKey(request);
         if (exist != null) {
-            String errmsg = String.format("inlong cluster already exist for 
name=%s, cluster tag=%s, type=%s)",
+            String errMsg = String.format("inlong cluster already exist for 
name=%s cluster tag=%s type=%s)",
                     request.getName(), request.getClusterTag(), 
request.getType());
-            LOGGER.error(errmsg);
-            throw new BusinessException(errmsg);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
         }
         InlongClusterEntity entity = CommonBeanUtils.copyProperties(request, 
InlongClusterEntity::new);
         entity.setCreator(operator);
@@ -123,10 +123,10 @@ public class InlongClusterServiceImpl implements 
InlongClusterService {
         Preconditions.checkNotNull(id, "inlong cluster id is empty");
         InlongClusterEntity exist = clusterMapper.selectByUniqueKey(request);
         if (exist != null && !Objects.equals(id, exist.getId())) {
-            String errmsg = String.format("inlong cluster already exist for 
name=%s, cluster tag=%s, type=%s",
+            String errMsg = String.format("inlong cluster already exist for 
name=%s cluster tag=%s type=%s",
                     request.getName(), request.getClusterTag(), 
request.getType());
-            LOGGER.error(errmsg);
-            throw new BusinessException(errmsg);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
         }
 
         InlongClusterEntity entity = clusterMapper.selectById(id);
@@ -170,10 +170,10 @@ public class InlongClusterServiceImpl implements 
InlongClusterService {
         // check cluster node if exist
         InlongClusterNodeEntity exist = 
clusterNodeMapper.selectByUniqueKey(request);
         if (exist != null) {
-            String errmsg = String.format("inlong cluster node already exist 
for type=%s ip=%s port=%s",
+            String errMsg = String.format("inlong cluster node already exist 
for type=%s ip=%s port=%s",
                     request.getType(), request.getIp(), request.getPort());
-            LOGGER.error(errmsg);
-            throw new BusinessException(errmsg);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
         }
 
         InlongClusterNodeEntity entity = 
CommonBeanUtils.copyProperties(request, InlongClusterNodeEntity::new);
@@ -228,10 +228,10 @@ public class InlongClusterServiceImpl implements 
InlongClusterService {
         // check cluster node if exist
         InlongClusterNodeEntity exist = 
clusterNodeMapper.selectByUniqueKey(request);
         if (exist != null && !Objects.equals(id, exist.getId())) {
-            String errmsg = String.format("inlong cluster node already exist 
for type=%s ip=%s port=%s)",
+            String errMsg = String.format("inlong cluster node already exist 
for type=%s ip=%s port=%s)",
                     request.getType(), request.getIp(), request.getPort());
-            LOGGER.error(errmsg);
-            throw new BusinessException(errmsg);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
         }
 
         InlongClusterNodeEntity entity = clusterNodeMapper.selectById(id);
diff --git 
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceTest.java
 
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceTest.java
index 903cbbac8..91bb6fbd3 100644
--- 
a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceTest.java
+++ 
b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/impl/InlongClusterServiceTest.java
@@ -107,12 +107,11 @@ public class InlongClusterServiceTest extends 
ServiceBaseTest {
     /**
      * save cluster info.
      */
-    public Integer saveCluster(String clusterName, String type, String 
clusterTag, String zoneTag) {
+    public Integer saveCluster(String clusterName, String type, String 
clusterTag) {
         InlongClusterRequest request = new InlongClusterRequest();
         request.setName(clusterName);
         request.setType(type);
         request.setClusterTag(clusterTag);
-        request.setZoneTag(zoneTag);
         request.setInCharges(GLOBAL_OPERATOR);
         return inlongClusterService.save(request, GLOBAL_OPERATOR);
     }
@@ -120,23 +119,21 @@ public class InlongClusterServiceTest extends 
ServiceBaseTest {
     /**
      * get cluster list info.
      */
-    public PageInfo<InlongClusterResponse> listCluster(String type, String 
clusterTag, String zoneTag) {
+    public PageInfo<InlongClusterResponse> listCluster(String type, String 
clusterTag) {
         InlongClusterPageRequest request = new InlongClusterPageRequest();
         request.setType(type);
         request.setClusterTag(clusterTag);
-        request.setZoneTag(zoneTag);
         return inlongClusterService.list(request);
     }
 
     /**
      * update cluster info.
      */
-    public Boolean updateCluster(String clusterName, String type, String 
clusterTag, String zoneTag) {
+    public Boolean updateCluster(String clusterName, String type, String 
clusterTag) {
         InlongClusterRequest request = new InlongClusterRequest();
         request.setName(clusterName);
         request.setType(type);
         request.setClusterTag(clusterTag);
-        request.setZoneTag(zoneTag);
         request.setInCharges(GLOBAL_OPERATOR);
         return inlongClusterService.update(request, GLOBAL_OPERATOR);
     }
@@ -196,26 +193,24 @@ public class InlongClusterServiceTest extends 
ServiceBaseTest {
     public void testClusterSaveAndDelete() {
         String type = "PULSAR";
         String clusterTag = "default_cluster";
-        String zoneTag = "china_1";
         String ip = "127.0.0.1";
         Integer port = 8080;
 
         String typeUpdate = "DATA_PROXY";
         String clusterTagUpdate = "default_cluster_2";
-        String zoneTagUpdate = "china_2";
         String ipUpdate = "localhost";
         Integer portUpdate = 8083;
 
         // save cluster
-        Integer id = this.saveCluster(CLUSTER_NAME, type, clusterTag, zoneTag);
+        Integer id = this.saveCluster(CLUSTER_NAME, type, clusterTag);
         Assert.assertNotNull(id);
 
         // list cluster
-        PageInfo<InlongClusterResponse> listCluster = this.listCluster(type, 
clusterTag, zoneTag);
+        PageInfo<InlongClusterResponse> listCluster = this.listCluster(type, 
clusterTag);
         Assert.assertEquals(listCluster.getTotal(), 1);
 
         // update cluster
-        Boolean updateSuccess = this.updateCluster(CLUSTER_NAME, typeUpdate, 
clusterTagUpdate, zoneTagUpdate);
+        Boolean updateSuccess = this.updateCluster(CLUSTER_NAME, typeUpdate, 
clusterTagUpdate);
         Assert.assertTrue(updateSuccess);
 
         // save cluster node
diff --git 
a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql 
b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
index d182ba63e..747eda312 100644
--- 
a/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
+++ 
b/inlong-manager/manager-test/src/main/resources/sql/apache_inlong_manager.sql
@@ -106,7 +106,6 @@ CREATE TABLE `inlong_cluster`
     `type`        varchar(20)       DEFAULT '' COMMENT 'Cluster type, such as: 
TUBE, PULSAR, DATA_PROXY, etc',
     `url`         varchar(512)      DEFAULT NULL COMMENT 'Cluster URL',
     `cluster_tag` varchar(128)      DEFAULT NULL COMMENT 'Cluster tag, the 
same tab indicates that cluster belongs to the same set',
-    `zone_tag`    varchar(128)      DEFAULT NULL COMMENT 'Cluster zone tag',
     `ext_params`  text              DEFAULT NULL COMMENT 'Extended params, 
will saved as JSON string',
     `heartbeat`   text              DEFAULT NULL COMMENT 'Cluster heartbeat 
info',
     `in_charges`  varchar(512) NOT NULL COMMENT 'Name of responsible person, 
separated by commas',
diff --git a/inlong-manager/manager-web/sql/apache_inlong_manager.sql 
b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
index ed9baaa6a..1126eb1cb 100644
--- a/inlong-manager/manager-web/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
@@ -115,7 +115,6 @@ CREATE TABLE `inlong_cluster`
     `type`        varchar(20)       DEFAULT '' COMMENT 'Cluster type, such as: 
TUBE, PULSAR, DATA_PROXY, etc',
     `url`         varchar(512)      DEFAULT NULL COMMENT 'Cluster URL',
     `cluster_tag` varchar(128)      DEFAULT NULL COMMENT 'Cluster tag, the 
same tab indicates that cluster belongs to the same set',
-    `zone_tag`    varchar(128)      DEFAULT NULL COMMENT 'Cluster zone tag',
     `ext_params`  text              DEFAULT NULL COMMENT 'Extended params, 
will saved as JSON string',
     `heartbeat`   text              DEFAULT NULL COMMENT 'Cluster heartbeat 
info',
     `in_charges`  varchar(512) NOT NULL COMMENT 'Name of responsible person, 
separated by commas',

Reply via email to