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/06/28 08:07:58 UTC

[GitHub] [inlong] healchow opened a new pull request, #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

healchow opened a new pull request, #4800:
URL: https://github.com/apache/inlong/pull/4800

   ### Prepare a Pull Request
   
   - Fixes #4796
   
   ### Motivation
   
   Support management of Inlong cluster tag.
   
   ### Modifications
   
   1. Add APIs in InlongClusterController.
   2. Add inlong_cluster_tag table.
   
   ### Verifying this change
   
   - [x] 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)
     - If yes, how is the feature documented? (JavaDocs)
   


-- 
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] kipshi commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterTagEntityMapper.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.ibatis.annotations.Param;
+import org.apache.inlong.manager.common.pojo.cluster.ClusterTagPageRequest;
+import org.apache.inlong.manager.dao.entity.InlongClusterTagEntity;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface InlongClusterTagEntityMapper {

Review Comment:
   make some unit test if possible



-- 
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] gong commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -63,28 +105,28 @@ public Response<Integer> save(@RequestBody InlongClusterRequest request) {
         return Response.success(clusterService.save(request, currentUser));
     }
 
-    @GetMapping(value = "/get/{id}")
+    @GetMapping(value = "/cluster/get/{id}")
     @ApiOperation(value = "Get cluster by id")
     @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = Integer.class, required = true)
     public Response<InlongClusterInfo> get(@PathVariable Integer id) {
         return Response.success(clusterService.get(id));
     }
 
-    @PostMapping(value = "/list")
+    @PostMapping(value = "/cluster/list")
     @ApiOperation(value = "List clusters")
     public Response<PageInfo<InlongClusterInfo>> list(@RequestBody InlongClusterPageRequest request) {
         return Response.success(clusterService.list(request));
     }
 
-    @PostMapping(value = "/update")
+    @PostMapping(value = "/cluster/update")
     @OperationLog(operation = OperationType.UPDATE)
     @ApiOperation(value = "Update cluster")
     public Response<Boolean> update(@RequestBody InlongClusterRequest request) {

Review Comment:
   lost `@Valid`



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java:
##########
@@ -83,19 +88,111 @@ public class InlongClusterServiceImpl implements InlongClusterService {
     @Autowired
     private InlongClusterOperatorFactory clusterOperatorFactory;
     @Autowired
+    private InlongClusterTagEntityMapper clusterTagMapper;
+    @Autowired
     private InlongClusterEntityMapper clusterMapper;
     @Autowired
     private InlongClusterNodeEntityMapper clusterNodeMapper;
     @Autowired
     private DataProxyConfigRepository proxyRepository;
 
+    @Override
+    public Integer saveTag(ClusterTagRequest request, String operator) {
+        LOGGER.debug("begin to save cluster tag {}", request);
+        Preconditions.checkNotNull(request, "cluster tag cannot be empty");
+
+        // check if the cluster tag already exist
+        String clusterTag = request.getClusterTag();
+        InlongClusterTagEntity exist = clusterTagMapper.selectByTag(clusterTag);
+        if (exist != null) {
+            String errMsg = String.format("inlong cluster tag already exist for cluster tag=%s", clusterTag);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
+        }
+
+        InlongClusterTagEntity entity = CommonBeanUtils.copyProperties(request, InlongClusterTagEntity::new);
+        clusterTagMapper.insert(entity);
+        LOGGER.info("success to save cluster tag={} by user={}", request, operator);

Review Comment:
   Nop, the write operation needs more info logs.



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java:
##########
@@ -83,19 +88,111 @@ public class InlongClusterServiceImpl implements InlongClusterService {
     @Autowired
     private InlongClusterOperatorFactory clusterOperatorFactory;
     @Autowired
+    private InlongClusterTagEntityMapper clusterTagMapper;
+    @Autowired
     private InlongClusterEntityMapper clusterMapper;
     @Autowired
     private InlongClusterNodeEntityMapper clusterNodeMapper;
     @Autowired
     private DataProxyConfigRepository proxyRepository;
 
+    @Override
+    public Integer saveTag(ClusterTagRequest request, String operator) {
+        LOGGER.debug("begin to save cluster tag {}", request);
+        Preconditions.checkNotNull(request, "cluster tag cannot be empty");

Review Comment:
   OK.



-- 
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] gong commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -47,14 +50,53 @@
  * Inlong cluster controller
  */
 @RestController
-@RequestMapping("/cluster")
 @Api(tags = "Inlong-Cluster-API")
 public class InlongClusterController {
 
     @Autowired
     private InlongClusterService clusterService;
 
-    @PostMapping(value = "/save")
+    @PostMapping(value = "/cluster/tag/save")
+    @ApiOperation(value = "Save cluster tag")
+    @OperationLog(operation = OperationType.CREATE)
+    @RequiresRoles(value = UserRoleCode.ADMIN)
+    public Response<Integer> saveTag(@RequestBody ClusterTagRequest request) {
+        String currentUser = LoginUserUtils.getLoginUserDetail().getUsername();
+        return Response.success(clusterService.saveTag(request, currentUser));
+    }
+
+    @GetMapping(value = "/cluster/tag/get/{id}")
+    @ApiOperation(value = "Get cluster tag by id")
+    @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = Integer.class, required = true)
+    public Response<ClusterTagResponse> getTag(@PathVariable Integer id) {
+        return Response.success(clusterService.getTag(id));
+    }
+
+    @PostMapping(value = "/cluster/tag/list")
+    @ApiOperation(value = "List cluster tags")
+    public Response<PageInfo<ClusterTagResponse>> listTag(@RequestBody ClusterTagPageRequest request) {
+        request.setCurrentUser(LoginUserUtils.getLoginUserDetail().getUsername());
+        return Response.success(clusterService.listTag(request));
+    }
+
+    @PostMapping(value = "/cluster/tag/update")
+    @OperationLog(operation = OperationType.UPDATE)
+    @ApiOperation(value = "Update cluster tag")
+    public Response<Boolean> updateTag(@RequestBody ClusterTagRequest request) {

Review Comment:
   lost `@Valid`



-- 
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] kipshi commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java:
##########
@@ -83,19 +88,111 @@ public class InlongClusterServiceImpl implements InlongClusterService {
     @Autowired
     private InlongClusterOperatorFactory clusterOperatorFactory;
     @Autowired
+    private InlongClusterTagEntityMapper clusterTagMapper;
+    @Autowired
     private InlongClusterEntityMapper clusterMapper;
     @Autowired
     private InlongClusterNodeEntityMapper clusterNodeMapper;
     @Autowired
     private DataProxyConfigRepository proxyRepository;
 
+    @Override
+    public Integer saveTag(ClusterTagRequest request, String operator) {
+        LOGGER.debug("begin to save cluster tag {}", request);
+        Preconditions.checkNotNull(request, "cluster tag cannot be empty");

Review Comment:
   May be check clusterTag is not empty , or request empty?



-- 
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] kipshi commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/InlongClusterServiceImpl.java:
##########
@@ -83,19 +88,111 @@ public class InlongClusterServiceImpl implements InlongClusterService {
     @Autowired
     private InlongClusterOperatorFactory clusterOperatorFactory;
     @Autowired
+    private InlongClusterTagEntityMapper clusterTagMapper;
+    @Autowired
     private InlongClusterEntityMapper clusterMapper;
     @Autowired
     private InlongClusterNodeEntityMapper clusterNodeMapper;
     @Autowired
     private DataProxyConfigRepository proxyRepository;
 
+    @Override
+    public Integer saveTag(ClusterTagRequest request, String operator) {
+        LOGGER.debug("begin to save cluster tag {}", request);
+        Preconditions.checkNotNull(request, "cluster tag cannot be empty");
+
+        // check if the cluster tag already exist
+        String clusterTag = request.getClusterTag();
+        InlongClusterTagEntity exist = clusterTagMapper.selectByTag(clusterTag);
+        if (exist != null) {
+            String errMsg = String.format("inlong cluster tag already exist for cluster tag=%s", clusterTag);
+            LOGGER.error(errMsg);
+            throw new BusinessException(errMsg);
+        }
+
+        InlongClusterTagEntity entity = CommonBeanUtils.copyProperties(request, InlongClusterTagEntity::new);
+        clusterTagMapper.insert(entity);
+        LOGGER.info("success to save cluster tag={} by user={}", request, operator);

Review Comment:
   some use Logger.debug , other use Logger.info,  should be unity



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-dao/src/main/java/org/apache/inlong/manager/dao/mapper/InlongClusterTagEntityMapper.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.ibatis.annotations.Param;
+import org.apache.inlong.manager.common.pojo.cluster.ClusterTagPageRequest;
+import org.apache.inlong.manager.dao.entity.InlongClusterTagEntity;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface InlongClusterTagEntityMapper {

Review Comment:
   I will add more logic and unit tests later.
   This was used for the inlong-dashboard first. 



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


-- 
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] kipshi commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -47,14 +50,53 @@
  * Inlong cluster controller
  */
 @RestController
-@RequestMapping("/cluster")

Review Comment:
   why remove path identify in controller



-- 
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] gong commented on a diff in pull request #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -47,14 +50,53 @@
  * Inlong cluster controller
  */
 @RestController
-@RequestMapping("/cluster")
 @Api(tags = "Inlong-Cluster-API")
 public class InlongClusterController {
 
     @Autowired
     private InlongClusterService clusterService;
 
-    @PostMapping(value = "/save")
+    @PostMapping(value = "/cluster/tag/save")
+    @ApiOperation(value = "Save cluster tag")
+    @OperationLog(operation = OperationType.CREATE)
+    @RequiresRoles(value = UserRoleCode.ADMIN)
+    public Response<Integer> saveTag(@RequestBody ClusterTagRequest request) {

Review Comment:
   lost `@Valid`



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -47,14 +50,53 @@
  * Inlong cluster controller
  */
 @RestController
-@RequestMapping("/cluster")

Review Comment:
   Put them in the under APIs, which will be searched conveniently.



-- 
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 #4800: [INLONG-4796][Manager] Support management of Inlong cluster tag

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


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/InlongClusterController.java:
##########
@@ -47,14 +50,53 @@
  * Inlong cluster controller
  */
 @RestController
-@RequestMapping("/cluster")
 @Api(tags = "Inlong-Cluster-API")
 public class InlongClusterController {
 
     @Autowired
     private InlongClusterService clusterService;
 
-    @PostMapping(value = "/save")
+    @PostMapping(value = "/cluster/tag/save")
+    @ApiOperation(value = "Save cluster tag")
+    @OperationLog(operation = OperationType.CREATE)
+    @RequiresRoles(value = UserRoleCode.ADMIN)
+    public Response<Integer> saveTag(@RequestBody ClusterTagRequest request) {
+        String currentUser = LoginUserUtils.getLoginUserDetail().getUsername();
+        return Response.success(clusterService.saveTag(request, currentUser));
+    }
+
+    @GetMapping(value = "/cluster/tag/get/{id}")
+    @ApiOperation(value = "Get cluster tag by id")
+    @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = Integer.class, required = true)
+    public Response<ClusterTagResponse> getTag(@PathVariable Integer id) {
+        return Response.success(clusterService.getTag(id));
+    }
+
+    @PostMapping(value = "/cluster/tag/list")
+    @ApiOperation(value = "List cluster tags")
+    public Response<PageInfo<ClusterTagResponse>> listTag(@RequestBody ClusterTagPageRequest request) {
+        request.setCurrentUser(LoginUserUtils.getLoginUserDetail().getUsername());
+        return Response.success(clusterService.listTag(request));
+    }
+
+    @PostMapping(value = "/cluster/tag/update")
+    @OperationLog(operation = OperationType.UPDATE)
+    @ApiOperation(value = "Update cluster tag")
+    public Response<Boolean> updateTag(@RequestBody ClusterTagRequest request) {

Review Comment:
   Good, done.



-- 
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