You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/07/17 01:37:16 UTC
[shardingsphere] branch master updated: Remove useless DataConsistencyCalculateParameter.peerDatabaseType (#27241)
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 fdcc18f9424 Remove useless DataConsistencyCalculateParameter.peerDatabaseType (#27241)
fdcc18f9424 is described below
commit fdcc18f94249676d73a83bc7168a7abad0c49bd4
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Jul 17 09:37:09 2023 +0800
Remove useless DataConsistencyCalculateParameter.peerDatabaseType (#27241)
---
.../core/consistencycheck/DataConsistencyCalculateParameter.java | 2 --
.../SingleTableInventoryDataConsistencyChecker.java | 9 +++------
.../CRC32MatchDataConsistencyCalculateAlgorithmTest.java | 3 +--
.../DataMatchDataConsistencyCalculateAlgorithmTest.java | 2 +-
4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/DataConsistencyCalculateParameter.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/DataConsistencyCalculateParameter.java
index 3461e01b2ec..3e58661af02 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/DataConsistencyCalculateParameter.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/DataConsistencyCalculateParameter.java
@@ -47,8 +47,6 @@ public final class DataConsistencyCalculateParameter {
private final DatabaseType databaseType;
- private final DatabaseType peerDatabaseType;
-
/**
* It could be primary key.
* It could be used in order by clause.
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/SingleTableInventoryDataConsistencyChecker.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/SingleTableInventoryDataConsistencyChecker.java
index 7e12267d9a7..64d58cd655b 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/SingleTableInventoryDataConsistencyChecker.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/SingleTableInventoryDataConsistencyChecker.java
@@ -24,8 +24,6 @@ import org.apache.shardingsphere.data.pipeline.api.metadata.SchemaTableName;
import org.apache.shardingsphere.data.pipeline.api.metadata.model.PipelineColumnMetaData;
import org.apache.shardingsphere.data.pipeline.common.datasource.PipelineDataSourceWrapper;
import org.apache.shardingsphere.data.pipeline.common.job.progress.listener.PipelineJobProgressUpdatedParameter;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.util.close.QuietlyCloser;
import org.apache.shardingsphere.data.pipeline.core.consistencycheck.algorithm.DataConsistencyCalculateAlgorithm;
import org.apache.shardingsphere.data.pipeline.core.consistencycheck.result.DataConsistencyCalculatedResult;
import org.apache.shardingsphere.data.pipeline.core.consistencycheck.result.DataConsistencyCheckResult;
@@ -34,6 +32,7 @@ import org.apache.shardingsphere.data.pipeline.core.consistencycheck.result.Data
import org.apache.shardingsphere.data.pipeline.core.exception.PipelineSQLException;
import org.apache.shardingsphere.data.pipeline.spi.ratelimit.JobRateLimitAlgorithm;
import org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorThreadFactoryBuilder;
+import org.apache.shardingsphere.infra.util.close.QuietlyCloser;
import org.apache.shardingsphere.infra.util.exception.external.sql.type.wrapper.SQLWrapperException;
import java.sql.SQLException;
@@ -91,16 +90,14 @@ public final class SingleTableInventoryDataConsistencyChecker {
}
private DataConsistencyCheckResult check(final DataConsistencyCalculateAlgorithm calculateAlgorithm, final ThreadPoolExecutor executor) {
- DatabaseType sourceDatabaseType = sourceDataSource.getDatabaseType();
- DatabaseType targetDatabaseType = targetDataSource.getDatabaseType();
String schemaName = sourceTable.getSchemaName().getOriginal();
String sourceTableName = sourceTable.getTableName().getOriginal();
Map<String, Object> tableCheckPositions = progressContext.getTableCheckPositions();
DataConsistencyCalculateParameter sourceParam = new DataConsistencyCalculateParameter(sourceDataSource,
- schemaName, sourceTableName, columnNames, sourceDatabaseType, targetDatabaseType, uniqueKey, tableCheckPositions.get(sourceTableName));
+ schemaName, sourceTableName, columnNames, sourceDataSource.getDatabaseType(), uniqueKey, tableCheckPositions.get(sourceTableName));
String targetTableName = targetTable.getTableName().getOriginal();
DataConsistencyCalculateParameter targetParam = new DataConsistencyCalculateParameter(targetDataSource,
- targetTable.getSchemaName().getOriginal(), targetTableName, columnNames, targetDatabaseType, sourceDatabaseType, uniqueKey, tableCheckPositions.get(targetTableName));
+ targetTable.getSchemaName().getOriginal(), targetTableName, columnNames, targetDataSource.getDatabaseType(), uniqueKey, tableCheckPositions.get(targetTableName));
Iterator<DataConsistencyCalculatedResult> sourceCalculatedResults = waitFuture(executor.submit(() -> calculateAlgorithm.calculate(sourceParam))).iterator();
Iterator<DataConsistencyCalculatedResult> targetCalculatedResults = waitFuture(executor.submit(() -> calculateAlgorithm.calculate(targetParam))).iterator();
try {
diff --git a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/algorithm/CRC32MatchDataConsistencyCalculateAlgorithmTest.java b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/algorithm/CRC32MatchDataConsistencyCalculateAlgorithmTest.java
index 27736064062..ad30bff70de 100644
--- a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/algorithm/CRC32MatchDataConsistencyCalculateAlgorithmTest.java
+++ b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/algorithm/CRC32MatchDataConsistencyCalculateAlgorithmTest.java
@@ -64,8 +64,7 @@ class CRC32MatchDataConsistencyCalculateAlgorithmTest {
void setUp() throws SQLException {
DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
PipelineColumnMetaData uniqueKey = new PipelineColumnMetaData(1, "id", Types.INTEGER, "integer", false, true, true);
- parameter = new DataConsistencyCalculateParameter(pipelineDataSource, null,
- "foo_tbl", Arrays.asList("foo_col", "bar_col"), databaseType, databaseType, uniqueKey, Collections.emptyMap());
+ parameter = new DataConsistencyCalculateParameter(pipelineDataSource, null, "foo_tbl", Arrays.asList("foo_col", "bar_col"), databaseType, uniqueKey, Collections.emptyMap());
when(pipelineDataSource.getConnection()).thenReturn(connection);
}
diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/algorithm/DataMatchDataConsistencyCalculateAlgorithmTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/algorithm/DataMatchDataConsistencyCalculateAlgorithmTest.java
index 122862440c5..8d41addd4e4 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/algorithm/DataMatchDataConsistencyCalculateAlgorithmTest.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/consistencycheck/algorithm/DataMatchDataConsistencyCalculateAlgorithmTest.java
@@ -144,6 +144,6 @@ class DataMatchDataConsistencyCalculateAlgorithmTest {
private DataConsistencyCalculateParameter generateParameter(final PipelineDataSourceWrapper dataSource, final String logicTableName, final Object dataCheckPosition) {
DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "H2");
PipelineColumnMetaData uniqueKey = new PipelineColumnMetaData(1, "order_id", Types.INTEGER, "integer", false, true, true);
- return new DataConsistencyCalculateParameter(dataSource, null, logicTableName, Collections.emptyList(), databaseType, databaseType, uniqueKey, dataCheckPosition);
+ return new DataConsistencyCalculateParameter(dataSource, null, logicTableName, Collections.emptyList(), databaseType, uniqueKey, dataCheckPosition);
}
}