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

panjuan 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 cb79b64  Add new dataConsistencyCheck and switchClusterConfiguration 
methods of ScalingAPI for DistSQL (#12565)
cb79b64 is described below

commit cb79b6412b9832f05ea9b4583fba808dd5a302d4
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Sun Sep 19 21:10:26 2021 +0800

    Add new dataConsistencyCheck and switchClusterConfiguration methods of 
ScalingAPI for DistSQL (#12565)
    
    * Extend ScalingDataConsistencyCheckAlgorithm
    
    * Add ScalingFixtureDataConsistencyCheckAlgorithm
    
    * Add new ScalingAPI dataConsistencyCheck method
    
    * Add ScalingAPI listDataConsistencyCheckAlgorithms method
    
    * Add checkDatabaseTypeSupportedOrNot and unit test
    
    * Add ScalingAPI stopClusterWriteDB and switchClusterConfiguration method
---
 ...java => DataConsistencyCheckAlgorithmInfo.java} | 21 ++++++--
 .../scaling/core/api/ScalingAPI.java               | 31 +++++++++++
 .../api/ScalingDataConsistencyCheckAlgorithm.java  | 22 ++++++++
 .../scaling/core/api/impl/ScalingAPIImpl.java      | 55 +++++++++++++++++++
 .../common/exception/DataCheckFailException.java   |  4 ++
 .../scaling/core/api/impl/ScalingAPIImplTest.java  | 56 +++++++++++++++++++
 ...calingFixtureDataConsistencyCheckAlgorithm.java | 62 ++++++++++++++++++++++
 ...g.core.api.ScalingDataConsistencyCheckAlgorithm | 18 +++++++
 8 files changed, 265 insertions(+), 4 deletions(-)

diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataConsistencyCheckAlgorithmInfo.java
similarity index 69%
copy from 
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
copy to 
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataConsistencyCheckAlgorithmInfo.java
index 5cdc834..b021825 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/DataConsistencyCheckAlgorithmInfo.java
@@ -17,12 +17,25 @@
 
 package org.apache.shardingsphere.scaling.core.api;
 
-import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithm;
-import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmPostProcessor;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.Collection;
 
 /**
- * Scaling data consistency check algorithm for SPI.
+ * Data consistency check algorithm info.
  */
-public interface ScalingDataConsistencyCheckAlgorithm extends 
ShardingSphereAlgorithm, ShardingSphereAlgorithmPostProcessor {
+@Getter
+@Setter
+@ToString
+public final class DataConsistencyCheckAlgorithmInfo {
+    
+    private String type;
+    
+    private String description;
+    
+    private Collection<String> supportedDatabaseTypes;
     
+    private String provider;
 }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPI.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPI.java
index fb56f8d..f6a730c 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPI.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPI.java
@@ -22,6 +22,7 @@ import 
org.apache.shardingsphere.scaling.core.job.check.consistency.DataConsiste
 import org.apache.shardingsphere.scaling.core.job.progress.JobProgress;
 
 import java.sql.SQLException;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -76,6 +77,20 @@ public interface ScalingAPI {
     Map<Integer, JobProgress> getProgress(long jobId);
     
     /**
+     * Stop cluster write to job source schema's underlying DB.
+     *
+     * @param jobId job id
+     */
+    void stopClusterWriteDB(long jobId);
+    
+    /**
+     * List all data consistency check algorithms from SPI.
+     *
+     * @return data consistency check algorithms
+     */
+    Collection<DataConsistencyCheckAlgorithmInfo> 
listDataConsistencyCheckAlgorithms();
+    
+    /**
      * Do data consistency check.
      *
      * @param jobId job id
@@ -84,6 +99,22 @@ public interface ScalingAPI {
     Map<String, DataConsistencyCheckResult> dataConsistencyCheck(long jobId);
     
     /**
+     * Do data consistency check.
+     *
+     * @param jobId job id
+     * @param algorithmType algorithm type
+     * @return each logic table check result
+     */
+    Map<String, DataConsistencyCheckResult> dataConsistencyCheck(long jobId, 
String algorithmType);
+    
+    /**
+     * Switch job source schema's configuration to job target configuration.
+     *
+     * @param jobId job id
+     */
+    void switchClusterConfiguration(long jobId);
+    
+    /**
      * Reset scaling job.
      *
      * @param jobId job id
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
index 5cdc834..ff50778 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingDataConsistencyCheckAlgorithm.java
@@ -20,9 +20,31 @@ package org.apache.shardingsphere.scaling.core.api;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithm;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmPostProcessor;
 
+import java.util.Collection;
+
 /**
  * Scaling data consistency check algorithm for SPI.
  */
 public interface ScalingDataConsistencyCheckAlgorithm extends 
ShardingSphereAlgorithm, ShardingSphereAlgorithmPostProcessor {
     
+    /**
+     * Get algorithm description.
+     *
+     * @return algorithm description
+     */
+    String getDescription();
+    
+    /**
+     * Get supported database types.
+     *
+     * @return supported database types
+     */
+    Collection<String> getSupportedDatabaseTypes();
+    
+    /**
+     * Get algorithm provider.
+     *
+     * @return algorithm provider
+     */
+    String getProvider();
 }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
index c7b297d..9cba70c 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImpl.java
@@ -19,13 +19,20 @@ package org.apache.shardingsphere.scaling.core.api.impl;
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO;
+import org.apache.shardingsphere.infra.config.TypedSPIConfiguration;
+import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import 
org.apache.shardingsphere.scaling.core.api.DataConsistencyCheckAlgorithmInfo;
 import org.apache.shardingsphere.scaling.core.api.JobInfo;
 import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
 import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
+import 
org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm;
 import org.apache.shardingsphere.scaling.core.common.constant.ScalingConstant;
+import 
org.apache.shardingsphere.scaling.core.common.exception.DataCheckFailException;
 import 
org.apache.shardingsphere.scaling.core.common.exception.ScalingJobNotFoundException;
 import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
+import org.apache.shardingsphere.scaling.core.config.RuleConfiguration;
 import org.apache.shardingsphere.scaling.core.job.JobContext;
 import org.apache.shardingsphere.scaling.core.job.ScalingJob;
 import 
org.apache.shardingsphere.scaling.core.job.check.EnvironmentCheckerFactory;
@@ -34,14 +41,17 @@ import 
org.apache.shardingsphere.scaling.core.job.check.consistency.DataConsiste
 import 
org.apache.shardingsphere.scaling.core.job.environment.ScalingEnvironmentManager;
 import org.apache.shardingsphere.scaling.core.job.progress.JobProgress;
 import org.apache.shardingsphere.scaling.core.util.JobConfigurationUtil;
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 
 import java.sql.SQLException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Properties;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
@@ -125,6 +135,24 @@ public final class ScalingAPIImpl implements ScalingAPI {
     }
     
     @Override
+    public void stopClusterWriteDB(final long jobId) {
+        //TODO
+    }
+    
+    @Override
+    public Collection<DataConsistencyCheckAlgorithmInfo> 
listDataConsistencyCheckAlgorithms() {
+        return 
ShardingSphereServiceLoader.getSingletonServiceInstances(ScalingDataConsistencyCheckAlgorithm.class)
+                .stream().map(each -> {
+                    DataConsistencyCheckAlgorithmInfo algorithmInfo = new 
DataConsistencyCheckAlgorithmInfo();
+                    algorithmInfo.setType(each.getType());
+                    algorithmInfo.setDescription(each.getDescription());
+                    
algorithmInfo.setSupportedDatabaseTypes(each.getSupportedDatabaseTypes());
+                    algorithmInfo.setProvider(each.getProvider());
+                    return algorithmInfo;
+                }).collect(Collectors.toList());
+    }
+    
+    @Override
     public Map<String, DataConsistencyCheckResult> dataConsistencyCheck(final 
long jobId) {
         DataConsistencyChecker dataConsistencyChecker = 
EnvironmentCheckerFactory.newInstance(new JobContext(getJobConfig(jobId)));
         Map<String, DataConsistencyCheckResult> result = 
dataConsistencyChecker.countCheck();
@@ -137,6 +165,33 @@ public final class ScalingAPIImpl implements ScalingAPI {
     }
     
     @Override
+    public Map<String, DataConsistencyCheckResult> dataConsistencyCheck(final 
long jobId, final String algorithmType) {
+        TypedSPIConfiguration typedSPIConfig = new 
ShardingSphereAlgorithmConfiguration(algorithmType, new Properties());
+        ScalingDataConsistencyCheckAlgorithm checkAlgorithm = 
ShardingSphereAlgorithmFactory.createAlgorithm(typedSPIConfig, 
ScalingDataConsistencyCheckAlgorithm.class);
+        JobConfiguration jobConfig = getJobConfig(jobId);
+        checkDatabaseTypeSupportedOrNot(checkAlgorithm, 
jobConfig.getRuleConfig());
+        //TODO
+        return dataConsistencyCheck(jobId);
+    }
+    
+    private void checkDatabaseTypeSupportedOrNot(final 
ScalingDataConsistencyCheckAlgorithm checkAlgorithm, final RuleConfiguration 
ruleConfig) {
+        Collection<String> supportedDatabaseTypes = 
checkAlgorithm.getSupportedDatabaseTypes();
+        String sourceDatabaseType = 
ruleConfig.getSource().unwrap().getDatabaseType().getName();
+        if (!supportedDatabaseTypes.contains(sourceDatabaseType)) {
+            throw new DataCheckFailException("source database type " + 
sourceDatabaseType + " is not supported in " + supportedDatabaseTypes);
+        }
+        String targetDatabaseType = 
ruleConfig.getTarget().unwrap().getDatabaseType().getName();
+        if (!supportedDatabaseTypes.contains(targetDatabaseType)) {
+            throw new DataCheckFailException("target database type " + 
targetDatabaseType + " is not supported in " + supportedDatabaseTypes);
+        }
+    }
+    
+    @Override
+    public void switchClusterConfiguration(final long jobId) {
+        //TODO
+    }
+    
+    @Override
     public void reset(final long jobId) throws SQLException {
         log.info("Scaling job {} reset target table", jobId);
         
ScalingAPIFactory.getGovernanceRepositoryAPI().deleteJobProgress(jobId);
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/exception/DataCheckFailException.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/exception/DataCheckFailException.java
index 1f24566..03195d3 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/exception/DataCheckFailException.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/exception/DataCheckFailException.java
@@ -24,6 +24,10 @@ public final class DataCheckFailException extends 
RuntimeException {
     
     private static final long serialVersionUID = -4100671584682823997L;
     
+    public DataCheckFailException(final String message) {
+        super(message);
+    }
+    
     public DataCheckFailException(final String message, final Throwable cause) 
{
         super(message, cause);
     }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
index 2af94dc..f473678 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
@@ -20,9 +20,11 @@ package org.apache.shardingsphere.scaling.core.api.impl;
 import lombok.SneakyThrows;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
+import 
org.apache.shardingsphere.scaling.core.api.DataConsistencyCheckAlgorithmInfo;
 import org.apache.shardingsphere.scaling.core.api.JobInfo;
 import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
 import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
+import 
org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm;
 import org.apache.shardingsphere.scaling.core.config.JobConfiguration;
 import org.apache.shardingsphere.scaling.core.config.RuleConfiguration;
 import org.apache.shardingsphere.scaling.core.config.ScalingContext;
@@ -37,9 +39,13 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import javax.sql.DataSource;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
@@ -110,6 +116,18 @@ public final class ScalingAPIImplTest {
     }
     
     @Test
+    public void assertListDataConsistencyCheckAlgorithms() {
+        Collection<DataConsistencyCheckAlgorithmInfo> algorithmInfos = 
scalingAPI.listDataConsistencyCheckAlgorithms();
+        assertThat(algorithmInfos.size(), is(1));
+        DataConsistencyCheckAlgorithmInfo algorithmInfo = 
algorithmInfos.iterator().next();
+        assertThat(algorithmInfo.getType(), 
is(ScalingFixtureDataConsistencyCheckAlgorithm.TYPE));
+        ScalingFixtureDataConsistencyCheckAlgorithm fixtureAlgorithm = new 
ScalingFixtureDataConsistencyCheckAlgorithm();
+        assertThat(algorithmInfo.getDescription(), 
is(fixtureAlgorithm.getDescription()));
+        assertThat(algorithmInfo.getSupportedDatabaseTypes(), 
is(fixtureAlgorithm.getSupportedDatabaseTypes()));
+        assertThat(algorithmInfo.getProvider(), 
is(fixtureAlgorithm.getProvider()));
+    }
+    
+    @Test
     public void assertDataConsistencyCheck() {
         Optional<Long> jobId = scalingAPI.start(ResourceUtil.mockJobConfig());
         assertTrue(jobId.isPresent());
@@ -123,6 +141,44 @@ public final class ScalingAPIImplTest {
     }
     
     @Test
+    public void assertDataConsistencyCheckWithAlgorithm() {
+        Optional<Long> jobId = scalingAPI.start(ResourceUtil.mockJobConfig());
+        assertTrue(jobId.isPresent());
+        JobConfiguration jobConfig = scalingAPI.getJobConfig(jobId.get());
+        initTableData(jobConfig.getRuleConfig());
+        Map<String, DataConsistencyCheckResult> checkResultMap = 
scalingAPI.dataConsistencyCheck(jobId.get(), 
ScalingFixtureDataConsistencyCheckAlgorithm.TYPE);
+        assertThat(checkResultMap.size(), is(1));
+        assertTrue(checkResultMap.get("t_order").isCountValid());
+        assertFalse(checkResultMap.get("t_order").isDataValid());
+        assertThat(checkResultMap.get("t_order").getTargetCount(), is(2L));
+    }
+    
+    @Test
+    @SneakyThrows(ReflectiveOperationException.class)
+    public void assertCheckDatabaseTypeSupported() {
+        Optional<Long> jobId = scalingAPI.start(ResourceUtil.mockJobConfig());
+        assertTrue(jobId.isPresent());
+        JobConfiguration jobConfig = scalingAPI.getJobConfig(jobId.get());
+        Method method = 
scalingAPI.getClass().getDeclaredMethod("checkDatabaseTypeSupportedOrNot", 
ScalingDataConsistencyCheckAlgorithm.class, RuleConfiguration.class);
+        method.setAccessible(true);
+        ScalingFixtureDataConsistencyCheckAlgorithm checkAlgorithm = new 
ScalingFixtureDataConsistencyCheckAlgorithm();
+        method.invoke(scalingAPI, checkAlgorithm, jobConfig.getRuleConfig());
+    }
+    
+    @Test(expected = InvocationTargetException.class)
+    @SneakyThrows(ReflectiveOperationException.class)
+    public void assertCheckDatabaseTypeNotSupported() {
+        Optional<Long> jobId = scalingAPI.start(ResourceUtil.mockJobConfig());
+        assertTrue(jobId.isPresent());
+        JobConfiguration jobConfig = scalingAPI.getJobConfig(jobId.get());
+        Method method = 
scalingAPI.getClass().getDeclaredMethod("checkDatabaseTypeSupportedOrNot", 
ScalingDataConsistencyCheckAlgorithm.class, RuleConfiguration.class);
+        method.setAccessible(true);
+        ScalingFixtureDataConsistencyCheckAlgorithm checkAlgorithm = new 
ScalingFixtureDataConsistencyCheckAlgorithm();
+        checkAlgorithm.setSupportedDatabaseTypes(Collections.emptyList());
+        method.invoke(scalingAPI, checkAlgorithm, jobConfig.getRuleConfig());
+    }
+    
+    @Test
     @SneakyThrows(SQLException.class)
     public void assertResetTargetTable() {
         Optional<Long> jobId = scalingAPI.start(ResourceUtil.mockJobConfig());
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingFixtureDataConsistencyCheckAlgorithm.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingFixtureDataConsistencyCheckAlgorithm.java
new file mode 100644
index 0000000..3455054
--- /dev/null
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingFixtureDataConsistencyCheckAlgorithm.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.scaling.core.api.impl;
+
+import lombok.Setter;
+import org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import 
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
+import 
org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+public final class ScalingFixtureDataConsistencyCheckAlgorithm implements 
ScalingDataConsistencyCheckAlgorithm {
+    
+    public static final String TYPE = "FIXTURE";
+    
+    private static final Collection<String> SUPPORTED_DATABASE_TYPES = 
Arrays.asList(new MySQLDatabaseType().getName(),
+            new PostgreSQLDatabaseType().getName(), new 
H2DatabaseType().getName());
+    
+    @Setter
+    private Collection<String> supportedDatabaseTypes;
+    
+    @Override
+    public void init() {
+    }
+    
+    @Override
+    public String getDescription() {
+        return "Fixture empty implementation";
+    }
+    
+    @Override
+    public Collection<String> getSupportedDatabaseTypes() {
+        return null != supportedDatabaseTypes ? supportedDatabaseTypes : 
SUPPORTED_DATABASE_TYPES;
+    }
+    
+    @Override
+    public String getProvider() {
+        return "ShardingSphere";
+    }
+    
+    @Override
+    public String getType() {
+        return TYPE;
+    }
+}
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/resources/META-INF/services/org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/resources/META-INF/services/org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm
new file mode 100644
index 0000000..1c2e487
--- /dev/null
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/resources/META-INF/services/org.apache.shardingsphere.scaling.core.api.ScalingDataConsistencyCheckAlgorithm
@@ -0,0 +1,18 @@
+#
+# 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.scaling.core.api.impl.ScalingFixtureDataConsistencyCheckAlgorithm

Reply via email to