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 2021/06/24 07:29:56 UTC

[GitHub] [shardingsphere] lwclover commented on a change in pull request #10899: custom authority,schema can be assigned to proxy users

lwclover commented on a change in pull request #10899:
URL: https://github.com/apache/shardingsphere/pull/10899#discussion_r657695849



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutor.java
##########
@@ -54,18 +54,18 @@ public void execute(final BackendConnection backendConnection) {
     private Collection<Object> getSchemaNames(final BackendConnection backendConnection) {
         try {
             MetaDataContexts contexts = ProxyContext.getInstance().getMetaDataContexts();
-            SQLCheckEngine.check(new MySQLShowDatabasesStatement(), Collections.emptyList(), 
-                    contexts.getGlobalRuleMetaData().getRules(), backendConnection.getSchemaName(), contexts.getMetaDataMap(), backendConnection.getGrantee());
-            return new ArrayList<>(ProxyContext.getInstance().getAllSchemaNames());
+            SQLCheckEngine.check(new MySQLShowDatabasesStatement(), Collections.emptyList(), contexts.getGlobalRuleMetaData().getRules(), backendConnection.getSchemaName(), contexts.getMetaDataMap(),
+                    backendConnection.getGrantee());
         } catch (final SQLCheckException ex) {
-            Collection<Object> result = new LinkedList<>();
-            for (String each : ProxyContext.getInstance().getAllSchemaNames()) {
-                if (SQLCheckEngine.check(each, getRules(each), backendConnection.getGrantee())) {
-                    result.add(each);
-                }
+            // ignore
+        }

Review comment:
       I think codes below are redundant lines. 
   ```
   MetaDataContexts contexts = ProxyContext.getInstance().getMetaDataContexts();
               SQLCheckEngine.check(new MySQLShowDatabasesStatement(), Collections.emptyList(), contexts.getGlobalRuleMetaData().getRules(), backendConnection.getSchemaName(), contexts.getMetaDataMap(),
                       backendConnection.getGrantee());
   ```




-- 
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:
users@infra.apache.org