You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/08/10 13:27:40 UTC

[shardingsphere] branch master updated: Sharding Proxy supports adding new schema (#6767)

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

zhangliang 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 92bd07f  Sharding Proxy supports adding new schema (#6767)
92bd07f is described below

commit 92bd07f13e566a5c00e26509f1bdff8a79132ee8
Author: Juan Pan(Trista) <pa...@apache.org>
AuthorDate: Mon Aug 10 21:27:17 2020 +0800

    Sharding Proxy supports adding new schema (#6767)
---
 .../orchestration/core/config/listener/SchemaChangedListener.java     | 4 ++--
 .../orchestration/core/schema/OrchestrationSchemaContexts.java        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/listener/SchemaChangedListener.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/listener/SchemaChangedListener.java
index 461cc72..2101961 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/listener/SchemaChangedListener.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-config/src/main/java/org/apache/shardingsphere/orchestration/core/config/listener/SchemaChangedListener.java
@@ -42,7 +42,7 @@ import org.apache.shardingsphere.orchestration.repository.api.listener.DataChang
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.LinkedList;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -57,7 +57,7 @@ public final class SchemaChangedListener extends PostOrchestrationRepositoryEven
     
     private final ConfigCenterNode configurationNode;
     
-    private final Collection<String> existedSchemaNames = new LinkedList<>();
+    private final Collection<String> existedSchemaNames = new LinkedHashSet<>();
     
     public SchemaChangedListener(final String name, final ConfigurationRepository configurationRepository, final Collection<String> schemaNames) {
         super(configurationRepository, new ConfigCenterNode(name).getAllSchemaConfigPaths(schemaNames));
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
index 6d173f1..67ef53b 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
@@ -114,8 +114,8 @@ public abstract class OrchestrationSchemaContexts implements SchemaContexts {
     }
     
     private DatabaseType getDatabaseType(final Map<String, Map<String, DataSourceParameter>> dataSourceParametersMap) {
-        if (dataSourceParametersMap.isEmpty() || dataSourceParametersMap.values().iterator().next().values().isEmpty()) {
-            schemaContexts.getDatabaseType();
+        if (dataSourceParametersMap.isEmpty() || dataSourceParametersMap.values().iterator().next().isEmpty()) {
+            return schemaContexts.getDatabaseType();
         }
         return DatabaseTypes.getDatabaseTypeByURL(dataSourceParametersMap.values().iterator().next().values().iterator().next().getUrl());
     }