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/07/08 04:42:01 UTC

[GitHub] [inlong] luchunliang commented on a diff in pull request #4938: [INLONG-4937][Manager] One inlong group id can transform data across two cluster tags

luchunliang commented on code in PR #4938:
URL: https://github.com/apache/inlong/pull/4938#discussion_r916457603


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/DataProxyController.java:
##########
@@ -80,4 +82,73 @@ public String getAllConfig(@RequestParam String clusterName, @RequestParam(requi
         return clusterService.getAllConfig(clusterName, md5);
     }
 
+    /**
+     * changeClusterTag
+     */
+    @RequestMapping(value = "/changeClusterTag", method = RequestMethod.POST)
+    @ApiOperation(value = "Change cluster tag and topic of a inlong group id.")
+    public Response<String> changeClusterTag(@RequestBody InlongGroupEntity groupInfo) {
+        String inlongGroupId = groupInfo.getInlongGroupId();
+        String clusterTag = groupInfo.getInlongClusterTag();
+        String topic = groupInfo.getMqResource();
+        if (StringUtils.isEmpty(inlongGroupId) || StringUtils.isEmpty(clusterTag) || StringUtils.isEmpty(topic)) {
+            throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
+        }
+        // select
+        InlongGroupEntity oldGroup = inlongGroupMapper.selectByGroupId(inlongGroupId);
+        if (oldGroup == null) {
+            throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
+        }
+        // parse ext_params
+        String extParams = oldGroup.getExtParams();
+        if (StringUtils.isEmpty(extParams)) {
+            extParams = "{}";
+        }
+        // parse json
+        Gson gson = new Gson();

Review Comment:
   It is not a promise that Gson is a thread safe class.
   DataProxyController have synchronized operation.



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