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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7ef3aa6  [INLONG-2764][manager]Fix duplication key and resolve 
conflicts (#2765)
7ef3aa6 is described below

commit 7ef3aa634e39eba4c44fea8bdeda546443734928
Author: pacino <[email protected]>
AuthorDate: Mon Feb 28 13:33:09 2022 +0800

    [INLONG-2764][manager]Fix duplication key and resolve conflicts (#2765)
---
 .../service/thirdparty/sort/CreateSortConfigListener.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/thirdparty/sort/CreateSortConfigListener.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/thirdparty/sort/CreateSortConfigListener.java
index b1a5a7a..eaced46 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/thirdparty/sort/CreateSortConfigListener.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/thirdparty/sort/CreateSortConfigListener.java
@@ -18,6 +18,7 @@
 package org.apache.inlong.manager.service.thirdparty.sort;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -119,10 +120,21 @@ public class CreateSortConfigListener implements 
SortOperateListener {
         if (groupRequest.getExtList() == null) {
             groupRequest.setExtList(Lists.newArrayList());
         }
-        groupRequest.getExtList().add(extInfo);
+        upsertDataFlow(groupRequest, extInfo);
         return ListenerResult.success();
     }
 
+    private void upsertDataFlow(InlongGroupRequest groupRequest, 
InlongGroupExtInfo extInfo) {
+        Iterator<InlongGroupExtInfo> inlongGroupExtInfoIterator = 
groupRequest.getExtList().iterator();
+        while (inlongGroupExtInfoIterator.hasNext()) {
+            InlongGroupExtInfo inlongGroupExtInfo = 
inlongGroupExtInfoIterator.next();
+            if 
(InlongGroupSettings.DATA_FLOW.equals(inlongGroupExtInfo.getKeyName())) {
+                inlongGroupExtInfoIterator.remove();
+            }
+        }
+        groupRequest.getExtList().add(extInfo);
+    }
+
     private DataFlowInfo createDataFlow(StreamBriefResponse 
streamBriefResponse,
             InlongGroupRequest inlongGroupRequest) {
         //TODO only support one source and one sink

Reply via email to