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 2022/11/13 10:34:45 UTC

[shardingsphere] branch master updated: Remove DatabaseDiscoveryDynamicDataSourceStrategy SPI (#22142)

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 81c5c8c0152 Remove DatabaseDiscoveryDynamicDataSourceStrategy SPI (#22142)
81c5c8c0152 is described below

commit 81c5c8c015275627914e443ac0e1b1a7a4437da6
Author: zhaojinchao <zh...@apache.org>
AuthorDate: Sun Nov 13 18:34:35 2022 +0800

    Remove DatabaseDiscoveryDynamicDataSourceStrategy SPI (#22142)
---
 .../dbdiscovery/algorithm/DatabaseDiscoveryEngine.java |  4 ++--
 ...infra.datasource.strategy.DynamicDataSourceStrategy | 18 ------------------
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/features/db-discovery/core/src/main/java/org/apache/shardingsphere/dbdiscovery/algorithm/DatabaseDiscoveryEngine.java b/features/db-discovery/core/src/main/java/org/apache/shardingsphere/dbdiscovery/algorithm/DatabaseDiscoveryEngine.java
index 02c18a4e2a2..bc53a76569f 100644
--- a/features/db-discovery/core/src/main/java/org/apache/shardingsphere/dbdiscovery/algorithm/DatabaseDiscoveryEngine.java
+++ b/features/db-discovery/core/src/main/java/org/apache/shardingsphere/dbdiscovery/algorithm/DatabaseDiscoveryEngine.java
@@ -70,7 +70,7 @@ public final class DatabaseDiscoveryEngine {
      */
     public String changePrimaryDataSource(final String databaseName, final String groupName, final String originalPrimaryDataSourceName,
                                           final Map<String, DataSource> dataSourceMap, final Collection<String> disabledDataSourceNames) {
-        Optional<String> newPrimaryDataSourceName = findPrimaryDataSourceName(dataSourceMap, disabledDataSourceNames);
+        Optional<String> newPrimaryDataSourceName = findPrimaryDataSourceName(dataSourceMap);
         if (newPrimaryDataSourceName.isPresent() && !newPrimaryDataSourceName.get().equals(originalPrimaryDataSourceName)) {
             eventBusContext.post(new PrimaryDataSourceChangedEvent(new QualifiedDatabase(databaseName, groupName, newPrimaryDataSourceName.get())));
         }
@@ -79,7 +79,7 @@ public final class DatabaseDiscoveryEngine {
         return result;
     }
     
-    private Optional<String> findPrimaryDataSourceName(final Map<String, DataSource> dataSourceMap, final Collection<String> disabledDataSourceNames) {
+    private Optional<String> findPrimaryDataSourceName(final Map<String, DataSource> dataSourceMap) {
         for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
             try {
                 if (databaseDiscoveryProviderAlgorithm.isPrimaryInstance(entry.getValue())) {
diff --git a/features/db-discovery/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.strategy.DynamicDataSourceStrategy b/features/db-discovery/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.strategy.DynamicDataSourceStrategy
deleted file mode 100644
index ba114fef898..00000000000
--- a/features/db-discovery/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.strategy.DynamicDataSourceStrategy
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.dbdiscovery.aware.DatabaseDiscoveryDynamicDataSourceStrategy