tristaZero commented on a change in pull request #10068:
URL: https://github.com/apache/shardingsphere/pull/10068#discussion_r612897163



##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AddResourceBackendHandler.java
##########
@@ -67,6 +72,21 @@ public ResponseHeader execute(final String schemaName, final 
AddResourceStatemen
         return new UpdateResponseHeader(sqlStatement);
     }
     
+    private void check(final String schemaName, final AddResourceStatement 
sqlStatement) {
+        List<String> dataSourceNames = new 
ArrayList<>(sqlStatement.getDataSources().size());
+        for (DataSourceSegment dataSourceSegment : 
sqlStatement.getDataSources()) {
+            if (dataSourceNames.contains(dataSourceSegment.getName())) {
+                throw new 
DuplicateResourceException(dataSourceSegment.getName());
+            }
+            dataSourceNames.add(dataSourceSegment.getName());

Review comment:
       Hi this process is different with the one of `validate dataSources`, 
isn't it?
   Here,  the programming will break once there is an exception. On the other 
hand, `validate dataSources` will return a whole list of invalid data sources. 
Could we keep the handling consistent?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to