You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/24 09:03:45 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #23066: Add `IF NOT EXISTS` to `register storage unit` statement

RaigorJiang commented on code in PR #23066:
URL: https://github.com/apache/shardingsphere/pull/23066#discussion_r1056774599


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/resource/RegisterStorageUnitBackendHandler.java:
##########
@@ -66,6 +68,18 @@ public RegisterStorageUnitBackendHandler(final RegisterStorageUnitStatement sqlS
     public ResponseHeader execute(final String databaseName, final RegisterStorageUnitStatement sqlStatement) {
         checkSQLStatement(databaseName, sqlStatement);
         Map<String, DataSourceProperties> dataSourcePropsMap = ResourceSegmentsConverter.convert(databaseType, sqlStatement.getStorageUnits());
+        if (sqlStatement.isIfNotExists()) {
+            Set<String> currentStorageUnits = ProxyContext.getInstance().getContextManager().getDataSourceMap(databaseName).keySet();
+            Iterator<String> storageUnitName = dataSourcePropsMap.keySet().iterator();

Review Comment:
   The variable name storageUnitName can be replaced with `iterator`



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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