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

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new ef43076  Add checking (#10268)
ef43076 is described below

commit ef43076049305f2815df51777ad34d36c5583e28
Author: Juan Pan(Trista) <panj...@apache.org>
AuthorDate: Sat May 8 09:12:35 2021 +0800

    Add checking (#10268)
---
 .../authority/provider/natived/builder/StoragePrivilegeBuilder.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
index 7854874..91d2c7f 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/main/java/org/apache/shardingsphere/authority/provider/natived/builder/StoragePrivilegeBuilder.java
@@ -117,8 +117,10 @@ public final class StoragePrivilegeBuilder {
     private static void save(final DataSource dataSource, final 
Collection<ShardingSphereUser> users, final StoragePrivilegeHandler handler) {
         try {
             Collection<ShardingSphereUser> noneExisted = handler.diff(users, 
dataSource);
-            handler.create(noneExisted, dataSource);
-            handler.grantAll(noneExisted, dataSource);
+            if (!noneExisted.isEmpty()) {
+                handler.create(noneExisted, dataSource);
+                handler.grantAll(noneExisted, dataSource);
+            }
         } catch (final SQLException ex) {
             throw new ShardingSphereException(ex);
         }

Reply via email to