You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/05/13 15:53:32 UTC

[GitHub] [incubator-inlong] vernedeng opened a new pull request, #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

vernedeng opened a new pull request, #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200

   ### Title Name:[INLONG-4177][Manager] Refactor getClusterConfig interface
   
   Fixes #4177
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r875533229


##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortIdParamsDTO.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+@Data
+public class SortIdParamsDTO {

Review Comment:
   All fields in SortIdParamsDTO are used to generate **IdParams** in **SortClusterconfig**, 
   And there is  another params called **SinkParams**,  use **SortSinkDTO** will cause ambiguity



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r913461988


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortClusterServiceImpl.java:
##########
@@ -0,0 +1,316 @@
+/**
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsInfo;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsInfo;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskInfo;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.apache.inlong.manager.service.core.SortClusterService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository

Review Comment:
   fixed, thx



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] healchow commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r875517977


##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,71 @@
+<?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.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.manager.dao.entity.SortTaskDTO">
+        <result column="inlong_cluster_name" jdbcType="VARCHAR" property="sortClusterName"/>
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.manager.dao.entity.SortSinkParamsDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.manager.dao.entity.SortIdParamsDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectAllTasks" resultMap="SortTaskDTO">
+        select
+            inlong_cluster_name, sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+        </where>
+        group by
+            inlong_cluster_name, sort_task_name, sort_consumer_group, sink_type, data_node_name
+    </select>
+
+    <select id="selectAllSinkParams" resultMap="SortSinkParamsDTO">
+        select

Review Comment:
   Why not combine the `selectAllSinkParams` and `selectAllIdParams` into one query through the associated query?



##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortIdParamsDTO.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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;

Review Comment:
   Please move those `DTO` into `common/pojo` package, because the `entity` package should only be used for table entities.



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortConfigRepository.java:
##########
@@ -0,0 +1,311 @@
+/*
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.dataproxy.IRepository;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.dao.entity.SortIdParamsDTO;
+import org.apache.inlong.manager.dao.entity.SortSinkParamsDTO;
+import org.apache.inlong.manager.dao.entity.SortTaskDTO;
+import org.apache.inlong.manager.dao.mapper.SortClusterMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository
+public class SortConfigRepository implements IRepository {

Review Comment:
   Do we really need to implements the `org.apache.inlong.common.pojo.dataproxy.IRepository` in inlong-common module?
   
   Just operate in the inlong-manager module, does it enough?



##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/entity/SortIdParamsDTO.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+@Data
+public class SortIdParamsDTO {

Review Comment:
   From the context, maybe the `SortSinkDTO` is a better name?



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,71 @@
+<?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.SortClusterMapper">

Review Comment:
   It is suggested to operate tables in their related mappers, so it seems that no need to add an additional `SortClusterMapper` to handle?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r913430959


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortConfigRepository.java:
##########
@@ -0,0 +1,324 @@
+/*
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.dataproxy.IRepository;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskDTO;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository
+public class SortConfigRepository implements IRepository {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SortConfigRepository.class);

Review Comment:
   fixed, thx



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r873510363


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/SortServiceImpl.java:
##########
@@ -72,16 +72,17 @@ public SortClusterResponse getClusterConfig(String clusterName, String md5) {
         }
 
         // check if there is any task.
-        List<SortClusterConfigEntity> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);
+        List<SortTaskDTO> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);

Review Comment:
   fixed



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?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.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>

Review Comment:
   fixed



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?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.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
+    
+    <select id="selectIdParamsByTaskName" resultMap="SortIdParamsDTO">
+        select
+            inlong_group_id, inlong_stream_id, ext_params
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="taskName != null and taskName != ''">
+                and sort_task_name = #{taskName, jdbcType=VARCHAR}
+            </if>

Review Comment:
   fixed



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortTaskDTO.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortTaskDTO {
+    private static final long serialVersionUID = 1L;
+    String sortTaskName;

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r912938058


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdParamsDTO.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one

Review Comment:
   Please change the header to:
   ```
   /*
    * 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.
    */
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r912939949


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortConfigRepository.java:
##########
@@ -0,0 +1,324 @@
+/*
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.dataproxy.IRepository;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskDTO;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository
+public class SortConfigRepository implements IRepository {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SortConfigRepository.class);

Review Comment:
   The processing logic of this repository is not much different from that of Service. It is recommended to merge it into Service.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r913445954


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortClusterServiceImpl.java:
##########
@@ -0,0 +1,316 @@
+/**
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsInfo;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsInfo;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskInfo;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.apache.inlong.manager.service.core.SortClusterService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository

Review Comment:
   The annotation should be `@Service`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r912989646


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdParamsDTO.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r913343673


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortConfigRepository.java:
##########
@@ -0,0 +1,324 @@
+/*
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.dataproxy.IRepository;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskDTO;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository
+public class SortConfigRepository implements IRepository {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SortConfigRepository.class);

Review Comment:
   So, could the XxxRepository be merged into XxxServiceImpl?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] luchunliang commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
luchunliang commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r914535327


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdInfo.java:
##########
@@ -1,10 +1,10 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements.  See the NOTICE file distributed with

Review Comment:
   error space.



##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdInfo.java:
##########
@@ -1,10 +1,10 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * 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
+ * the License.  You may obtain a copy of the License at

Review Comment:
   error space.



##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdInfo.java:
##########
@@ -15,21 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.inlong.manager.service.core;
+package org.apache.inlong.manager.common.pojo.sortstandalone;
 
-import java.util.List;
-import java.util.Map;
+import lombok.Data;
 
-/**
- * Sort id params service.
- */
-public interface SortTaskIdParamService {
+@Data
+public class SortIdInfo {
+    private static final long serialVersionUID = 1L;
+    String sortTaskName;
+    String inlongGroupId;
+    String inlongStreamId;
+    String extParams;
 
-    /**
-     * Select all id params by task name.
-     *
-     * @param taskName WorkflowTask name.
-     * @return List of all id params.
-     */
-    List<Map<String, String>> selectByTaskName(String taskName);
+    public String getUid() {
+        return inlongGroupId.concat(inlongStreamId);

Review Comment:
   absent separator.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r914556254


##########
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/sortstandalone/SortIdInfo.java:
##########
@@ -15,21 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.inlong.manager.service.core;
+package org.apache.inlong.manager.common.pojo.sortstandalone;
 
-import java.util.List;
-import java.util.Map;
+import lombok.Data;
 
-/**
- * Sort id params service.
- */
-public interface SortTaskIdParamService {
+@Data
+public class SortIdInfo {
+    private static final long serialVersionUID = 1L;
+    String sortTaskName;
+    String inlongGroupId;
+    String inlongStreamId;
+    String extParams;
 
-    /**
-     * Select all id params by task name.
-     *
-     * @param taskName WorkflowTask name.
-     * @return List of all id params.
-     */
-    List<Map<String, String>> selectByTaskName(String taskName);
+    public String getUid() {
+        return inlongGroupId.concat(inlongStreamId);

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] luchunliang commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
luchunliang commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r872907816


##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortIdParamsDTO.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortIdParamsDTO {

Review Comment:
   It is same with class "InlongId"



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?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.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
+    
+    <select id="selectIdParamsByTaskName" resultMap="SortIdParamsDTO">
+        select
+            inlong_group_id, inlong_stream_id, ext_params
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="taskName != null and taskName != ''">
+                and sort_task_name = #{taskName, jdbcType=VARCHAR}
+            </if>

Review Comment:
   Why not select all stream_sink data?
   It is too many times to execute SQL with sort_task_name.



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortSinkParamsDTO.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortSinkParamsDTO {

Review Comment:
   It is the class in the package "org.apache.inlong.manager.dao.entity".
   Please move it.



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortTaskDTO.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortTaskDTO {

Review Comment:
   It is the class in the package "org.apache.inlong.manager.dao.entity".
   Please move it.



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/SortServiceImpl.java:
##########
@@ -72,16 +72,17 @@ public SortClusterResponse getClusterConfig(String clusterName, String md5) {
         }
 
         // check if there is any task.
-        List<SortClusterConfigEntity> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);
+        List<SortTaskDTO> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);

Review Comment:
   Miss config repository.
   Execute multiple SQL every URL invoking.



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortTaskDTO.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortTaskDTO {
+    private static final long serialVersionUID = 1L;
+    String sortTaskName;

Review Comment:
   miss the field "inlong_cluster_name".



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?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.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>

Review Comment:
   Why not select all data_node data?
   It is too many times to execute SQL with data_node_name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r873510643


##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortTaskDTO.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortTaskDTO {

Review Comment:
   fixed



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortSinkParamsDTO.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortSinkParamsDTO {

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

Posted by GitBox <gi...@apache.org>.
vernedeng commented on code in PR #4200:
URL: https://github.com/apache/inlong/pull/4200#discussion_r912980164


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/SortConfigRepository.java:
##########
@@ -0,0 +1,324 @@
+/*
+ * 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.service.repository;
+
+import com.google.gson.Gson;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.inlong.common.pojo.dataproxy.IRepository;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterConfig;
+import org.apache.inlong.common.pojo.sortstandalone.SortClusterResponse;
+import org.apache.inlong.common.pojo.sortstandalone.SortTaskConfig;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortIdParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortSinkParamsDTO;
+import org.apache.inlong.manager.common.pojo.sortstandalone.SortTaskDTO;
+import org.apache.inlong.manager.dao.mapper.DataNodeEntityMapper;
+import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.PostConstruct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * Use to cache the sort cluster config and reduce the number of query to database.
+ */
+@Repository
+public class SortConfigRepository implements IRepository {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SortConfigRepository.class);

Review Comment:
   SortConfigRepository needs to  cache all cluster config and update them each 10 seconds. The processing logic is familiar with DataProxyConfigRepository



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] healchow merged pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig API for Sort Standalone

Posted by GitBox <gi...@apache.org>.
healchow merged PR #4200:
URL: https://github.com/apache/inlong/pull/4200


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org