This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 db28db20a81 Remove unused restore/stop source writing and apply
scaling DistSQL (#20480)
db28db20a81 is described below
commit db28db20a8173952974dfeb21c5b8002250c2152
Author: Xinze Guo <[email protected]>
AuthorDate: Wed Aug 24 14:31:26 2022 +0800
Remove unused restore/stop source writing and apply scaling DistSQL (#20480)
* Remove unused restore/stop source writing and apply DistSQL scaling
* Remove more unused
---
.../distsql/syntax/rql/rule-query/sharding.cn.md | 13 ---
.../distsql/syntax/rql/rule-query/sharding.en.md | 13 ---
.../handler/update/ApplyMigrationUpdater.java | 41 -------
.../RestoreMigrationSourceWritingUpdater.java | 41 -------
.../update/StopMigrationSourceWritingUpdater.java | 41 -------
....shardingsphere.infra.distsql.update.RALUpdater | 3 -
.../parser/autogen/MigrationDistSQLStatement.g4 | 3 -
.../core/MigrationDistSQLStatementVisitor.java | 21 ----
.../distsql/statement/ApplyMigrationStatement.java | 32 ------
.../RestoreMigrationSourceWritingStatement.java | 32 ------
.../StopMigrationSourceWritingStatement.java | 32 ------
.../statement/segment/InputOrOutputSegment.java | 46 --------
.../ShardingScalingRuleConfigurationSegment.java | 41 -------
.../data/pipeline/api/MigrationJobPublicAPI.java | 21 ----
.../core/execute/FinishedCheckJobExecutor.java | 50 ---------
.../pipeline/core/execute/PipelineJobWorker.java | 1 -
.../data/pipeline/core/job/FinishedCheckJob.java | 121 ---------------------
.../scenario/migration/MigrationJobAPI.java | 21 ----
.../scenario/migration/MigrationJobAPIImpl.java | 77 -------------
.../core/fixture/MigrationJobAPIFixture.java | 24 ----
.../distsql/DistSQLBackendHandlerFactoryTest.java | 37 -------
.../cases/rdl/rdl-integration-test-cases.xml | 2 +-
.../UpdatableScalingRALStatementAssert.java | 15 ---
.../update/ApplyMigrationStatementAssert.java | 60 ----------
...storeMigrationSourceWritingStatementAssert.java | 60 ----------
.../StopMigrationSourceWritingStatementAssert.java | 60 ----------
.../jaxb/cases/domain/SQLParserTestCases.java | 12 --
.../migration/ApplyMigrationStatementTestCase.java | 35 ------
...oreMigrationSourceWritingStatementTestCase.java | 35 ------
...topMigrationSourceWritingStatementTestCase.java | 35 ------
.../src/main/resources/case/ral/migration.xml | 12 --
.../main/resources/sql/supported/ral/migration.xml | 3 -
.../core/api/impl/MigrationJobAPIImplTest.java | 18 ---
.../pipeline/core/job/FinishedCheckJobTest.java | 85 ---------------
34 files changed, 1 insertion(+), 1142 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
index d8021897197..db784c4df50 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
@@ -136,19 +136,6 @@ SHOW SHARDING BROADCAST TABLE RULES [FROM databaseName]
| ------------------------- | -------- |
| sharding_broadcast_tables | 广播表名称 |
-### Sharding Scaling Rule
-
-| 列 | 说明 |
-|--------------------------|-------------------|
-| name | 弹性伸缩配置名称 |
-| input | 数据读取配置 |
-| output | 数据写入配置 |
-| stream_channel | 数据通道配置 |
-| completion_detector | 作业完成检测算法配置 |
-| data_consistency_checker | 数据一致性校验算法配置 |
-
-## 示例
-
### Sharding Table Rule
*SHOW SHARDING TABLE RULES*
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
index a636f38eab1..e8a36622354 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
@@ -136,19 +136,6 @@ SHOW SHARDING BROADCAST TABLE RULES [FROM databaseName]
| ------------------------- | ----------------------------- |
| sharding_broadcast_tables | sharding Broadcast Table list |
-### Sharding Scaling Rule
-
-| Column | Description |
-|--------------------------|----------------------------------------|
-| name | name of sharding scaling rule |
-| input | data read configuration |
-| output | data write configuration |
-| stream_channel | algorithm of stream channel |
-| completion_detector | algorithm of completion detecting |
-| data_consistency_checker | algorithm of data consistency checking |
-
-## Example
-
### Sharding Table Rule
*SHOW SHARDING TABLE RULES*
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/ApplyMigrationUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/ApplyMigrationUpdater.java
deleted file mode 100644
index 4602935a7b3..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/ApplyMigrationUpdater.java
+++ /dev/null
@@ -1,41 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.handler.update;
-
-import org.apache.shardingsphere.data.pipeline.api.MigrationJobPublicAPI;
-import org.apache.shardingsphere.data.pipeline.api.PipelineJobPublicAPIFactory;
-import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
-
-/**
- * Apply migration updater.
- */
-public final class ApplyMigrationUpdater implements
RALUpdater<ApplyMigrationStatement> {
-
- private static final MigrationJobPublicAPI JOB_API =
PipelineJobPublicAPIFactory.getMigrationJobPublicAPI();
-
- @Override
- public void executeUpdate(final String databaseName, final
ApplyMigrationStatement sqlStatement) {
- JOB_API.switchClusterConfiguration(sqlStatement.getJobId());
- }
-
- @Override
- public String getType() {
- return ApplyMigrationStatement.class.getName();
- }
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/RestoreMigrationSourceWritingUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/RestoreMigrationSourceWritingUpdater.java
deleted file mode 100644
index b6f49fbbe31..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/RestoreMigrationSourceWritingUpdater.java
+++ /dev/null
@@ -1,41 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.handler.update;
-
-import org.apache.shardingsphere.data.pipeline.api.MigrationJobPublicAPI;
-import org.apache.shardingsphere.data.pipeline.api.PipelineJobPublicAPIFactory;
-import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import
org.apache.shardingsphere.migration.distsql.statement.RestoreMigrationSourceWritingStatement;
-
-/**
- * Restore migration source writing updater.
- */
-public final class RestoreMigrationSourceWritingUpdater implements
RALUpdater<RestoreMigrationSourceWritingStatement> {
-
- private static final MigrationJobPublicAPI JOB_API =
PipelineJobPublicAPIFactory.getMigrationJobPublicAPI();
-
- @Override
- public void executeUpdate(final String databaseName, final
RestoreMigrationSourceWritingStatement sqlStatement) {
- JOB_API.restoreClusterWriteDB(sqlStatement.getJobId());
- }
-
- @Override
- public String getType() {
- return RestoreMigrationSourceWritingStatement.class.getName();
- }
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/StopMigrationSourceWritingUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/StopMigrationSourceWritingUpdater.java
deleted file mode 100644
index ca4bdae4b4e..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/update/StopMigrationSourceWritingUpdater.java
+++ /dev/null
@@ -1,41 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.handler.update;
-
-import org.apache.shardingsphere.data.pipeline.api.MigrationJobPublicAPI;
-import org.apache.shardingsphere.data.pipeline.api.PipelineJobPublicAPIFactory;
-import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationSourceWritingStatement;
-
-/**
- * Stop migration source writing updater.
- */
-public final class StopMigrationSourceWritingUpdater implements
RALUpdater<StopMigrationSourceWritingStatement> {
-
- private static final MigrationJobPublicAPI JOB_API =
PipelineJobPublicAPIFactory.getMigrationJobPublicAPI();
-
- @Override
- public void executeUpdate(final String databaseName, final
StopMigrationSourceWritingStatement sqlStatement) {
- JOB_API.stopClusterWriteDB(sqlStatement.getJobId());
- }
-
- @Override
- public String getType() {
- return StopMigrationSourceWritingStatement.class.getName();
- }
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
index 67290b1ac15..3e240127f4c 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RALUpdater
@@ -20,8 +20,5 @@
org.apache.shardingsphere.migration.distsql.handler.update.StartMigrationUpdater
org.apache.shardingsphere.migration.distsql.handler.update.StopMigrationUpdater
org.apache.shardingsphere.migration.distsql.handler.update.ResetMigrationUpdater
org.apache.shardingsphere.migration.distsql.handler.update.CleanMigrationUpdater
-org.apache.shardingsphere.migration.distsql.handler.update.StopMigrationSourceWritingUpdater
-org.apache.shardingsphere.migration.distsql.handler.update.RestoreMigrationSourceWritingUpdater
-org.apache.shardingsphere.migration.distsql.handler.update.ApplyMigrationUpdater
org.apache.shardingsphere.migration.distsql.handler.update.AddMigrationSourceResourceUpdater
org.apache.shardingsphere.migration.distsql.handler.update.DropMigrationSourceResourceUpdater
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
index 33e8f73b302..9cb38b19c35 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/migration/org/apache/shardingsphere/distsql/parser/autogen/MigrationDistSQLStatement.g4
@@ -29,9 +29,6 @@ execute
| resetMigration
| checkMigration
| showMigrationCheckAlgorithms
- | stopMigrationSourceWriting
- | restoreMigrationSourceWriting
- | applyMigration
| addMigrationSourceResource
| dropMigrationSourceResource
| showMigrationSourceResources
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
index e46d2a4959a..76ae2c004f7 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
@@ -23,7 +23,6 @@ import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatemen
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.AddMigrationSourceResourceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.AlgorithmDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ApplyMigrationContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CheckMigrationContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.CleanMigrationContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.DropMigrationSourceResourceContext;
@@ -33,32 +32,27 @@ import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatemen
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.PropertyContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ResetMigrationContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ResourceDefinitionContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.RestoreMigrationSourceWritingContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ShowMigrationCheckAlgorithmsContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ShowMigrationListContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ShowMigrationSourceResourcesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.ShowMigrationStatusContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.StartMigrationContext;
import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.StopMigrationContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.StopMigrationSourceWritingContext;
import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
import
org.apache.shardingsphere.distsql.parser.segment.HostnameAndPortBasedDataSourceSegment;
import
org.apache.shardingsphere.distsql.parser.segment.URLBasedDataSourceSegment;
import
org.apache.shardingsphere.migration.distsql.statement.AddMigrationSourceResourceStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
import
org.apache.shardingsphere.migration.distsql.statement.CheckMigrationStatement;
import
org.apache.shardingsphere.migration.distsql.statement.CleanMigrationStatement;
import
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
import
org.apache.shardingsphere.migration.distsql.statement.MigrateTableStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ResetMigrationStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.RestoreMigrationSourceWritingStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ShowMigrationListStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ShowMigrationSourceResourcesStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ShowMigrationStatusStatement;
import
org.apache.shardingsphere.migration.distsql.statement.StartMigrationStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationSourceWritingStatement;
import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationStatement;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
@@ -127,21 +121,6 @@ public final class MigrationDistSQLStatementVisitor
extends MigrationDistSQLStat
return new ShowMigrationCheckAlgorithmsStatement();
}
- @Override
- public ASTNode visitStopMigrationSourceWriting(final
StopMigrationSourceWritingContext ctx) {
- return new
StopMigrationSourceWritingStatement(getIdentifierValue(ctx.jobId()));
- }
-
- @Override
- public ASTNode visitRestoreMigrationSourceWriting(final
RestoreMigrationSourceWritingContext ctx) {
- return new
RestoreMigrationSourceWritingStatement(getIdentifierValue(ctx.jobId()));
- }
-
- @Override
- public ASTNode visitApplyMigration(final ApplyMigrationContext ctx) {
- return new ApplyMigrationStatement(getIdentifierValue(ctx.jobId()));
- }
-
@Override
public ASTNode visitAlgorithmDefinition(final AlgorithmDefinitionContext
ctx) {
return new
AlgorithmSegment(getIdentifierValue(ctx.algorithmTypeName()),
getAlgorithmProperties(ctx));
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/ApplyMigrationStatement.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/ApplyMigrationStatement.java
deleted file mode 100644
index 9554935e732..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/ApplyMigrationStatement.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
-
-/**
- * Apply migration statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ApplyMigrationStatement extends
UpdatableScalingRALStatement {
-
- private final String jobId;
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/RestoreMigrationSourceWritingStatement.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/RestoreMigrationSourceWritingStatement.java
deleted file mode 100644
index 49fef9b3260..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/RestoreMigrationSourceWritingStatement.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
-
-/**
- * Restore migration source writing statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class RestoreMigrationSourceWritingStatement extends
UpdatableScalingRALStatement {
-
- private final String jobId;
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/StopMigrationSourceWritingStatement.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/StopMigrationSourceWritingStatement.java
deleted file mode 100644
index c77ab5abaad..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/StopMigrationSourceWritingStatement.java
+++ /dev/null
@@ -1,32 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
-
-/**
- * Stop migration source writing statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class StopMigrationSourceWritingStatement extends
UpdatableScalingRALStatement {
-
- private final String jobId;
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/InputOrOutputSegment.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/InputOrOutputSegment.java
deleted file mode 100644
index 660fe320dd8..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/InputOrOutputSegment.java
+++ /dev/null
@@ -1,46 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.statement.segment;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
-
-/**
- * Input or output configuration segment.
- */
-@RequiredArgsConstructor
-@Getter
-public final class InputOrOutputSegment implements ASTNode {
-
- private final Integer workerThread;
-
- private final Integer batchSize;
-
- private final Integer shardingSize;
-
- private final AlgorithmSegment rateLimiter;
-
- public InputOrOutputSegment(final Integer workerThread, final Integer
batchSize, final AlgorithmSegment rateLimiter) {
- this.workerThread = workerThread;
- this.batchSize = batchSize;
- this.shardingSize = 1000_0000;
- this.rateLimiter = rateLimiter;
- }
-}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/ShardingScalingRuleConfigurationSegment.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/ShardingScalingRuleConfigurationSegment.java
deleted file mode 100644
index d38ce68b112..00000000000
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/migration/distsql/statement/segment/ShardingScalingRuleConfigurationSegment.java
+++ /dev/null
@@ -1,41 +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.
- */
-
-package org.apache.shardingsphere.migration.distsql.statement.segment;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
-
-/**
- * Sharding scaling rule configuration segment.
- */
-@Getter
-@Setter
-public final class ShardingScalingRuleConfigurationSegment implements ASTNode {
-
- private InputOrOutputSegment inputSegment;
-
- private InputOrOutputSegment outputSegment;
-
- private AlgorithmSegment streamChannel;
-
- private AlgorithmSegment completionDetector;
-
- private AlgorithmSegment dataConsistencyCalculator;
-}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
index 590f5ec5dc6..e89d7643dd7 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/MigrationJobPublicAPI.java
@@ -53,20 +53,6 @@ public interface MigrationJobPublicAPI extends
PipelineJobPublicAPI, RequiredSPI
// TODO add JobProgress
Map<Integer, InventoryIncrementalJobItemProgress> getJobProgress(String
jobId);
- /**
- * Stop cluster writing.
- *
- * @param jobId job id
- */
- void stopClusterWriteDB(String jobId);
-
- /**
- * Restore cluster writing.
- *
- * @param jobId job id
- */
- void restoreClusterWriteDB(String jobId);
-
/**
* List all data consistency check algorithms from SPI.
*
@@ -100,13 +86,6 @@ public interface MigrationJobPublicAPI extends
PipelineJobPublicAPI, RequiredSPI
*/
Map<String, DataConsistencyCheckResult> dataConsistencyCheck(String jobId,
String algorithmType, Properties algorithmProps);
- /**
- * Switch cluster configuration.
- *
- * @param jobId job id
- */
- void switchClusterConfiguration(String jobId);
-
/**
* Reset scaling job.
*
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/FinishedCheckJobExecutor.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/FinishedCheckJobExecutor.java
deleted file mode 100644
index 5d5f6c3c788..00000000000
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/FinishedCheckJobExecutor.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-package org.apache.shardingsphere.data.pipeline.core.execute;
-
-import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor;
-import org.apache.shardingsphere.data.pipeline.core.api.PipelineAPIFactory;
-import org.apache.shardingsphere.data.pipeline.core.job.FinishedCheckJob;
-import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import
org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
-
-/**
- * Finished check job executor.
- */
-@Slf4j
-public final class FinishedCheckJobExecutor extends AbstractLifecycleExecutor {
-
- private static final String JOB_NAME = "_finished_check";
-
- private static final String CRON_EXPRESSION = "*/10 * * * * ?";
-
- @Override
- protected void doStart() {
- // TODO refactor it and FinishedCheck after ejob support non-cron job
- new ScheduleJobBootstrap(PipelineAPIFactory.getRegistryCenter(), new
FinishedCheckJob(), createJobConfig()).schedule();
- }
-
- private JobConfiguration createJobConfig() {
- return JobConfiguration.newBuilder(JOB_NAME,
1).cron(CRON_EXPRESSION).build();
- }
-
- @Override
- protected void doStop() {
- }
-}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/PipelineJobWorker.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/PipelineJobWorker.java
index 8ddbbadd35a..767ad759881 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/PipelineJobWorker.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/PipelineJobWorker.java
@@ -41,7 +41,6 @@ public final class PipelineJobWorker {
return;
}
log.info("start worker initialization");
- new FinishedCheckJobExecutor().start();
new PipelineJobExecutor().start();
WORKER_INITIALIZED.set(true);
log.info("worker initialization done");
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJob.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJob.java
deleted file mode 100644
index 76ecceabbf5..00000000000
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJob.java
+++ /dev/null
@@ -1,121 +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.
- */
-
-package org.apache.shardingsphere.data.pipeline.core.job;
-
-import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.data.pipeline.api.config.job.MigrationJobConfiguration;
-import
org.apache.shardingsphere.data.pipeline.api.config.job.yaml.YamlMigrationJobConfigurationSwapper;
-import
org.apache.shardingsphere.data.pipeline.api.detect.RuleAlteredJobAlmostCompletedParameter;
-import org.apache.shardingsphere.data.pipeline.api.job.JobStatus;
-import
org.apache.shardingsphere.data.pipeline.api.job.progress.InventoryIncrementalJobItemProgress;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPI;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPIFactory;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationProcessContext;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentSkipListSet;
-
-@Slf4j
-public final class FinishedCheckJob implements SimpleJob {
-
- private final MigrationJobAPI jobAPI =
MigrationJobAPIFactory.getInstance();
-
- private final Set<String> onCheckJobIds = new ConcurrentSkipListSet<>();
-
- // TODO only one proxy node could do data consistency check in proxy
cluster
- @Override
- public void execute(final ShardingContext shardingContext) {
- List<PipelineJobInfo> jobInfos = jobAPI.list();
- for (PipelineJobInfo jobInfo : jobInfos) {
- if (!jobInfo.isActive()) {
- continue;
- }
- String jobId = jobInfo.getJobId();
- if (onCheckJobIds.contains(jobId)) {
- log.info("check not completed for job {}, ignore", jobId);
- continue;
- }
- // TODO merge to CompletionDetectAlgorithm
- if (isNotAllowDataCheck(jobId)) {
- continue;
- }
- onCheckJobIds.add(jobId);
- try {
- // TODO refactor: dispatch to different job types
- MigrationJobConfiguration jobConfig =
YamlMigrationJobConfigurationSwapper.swapToObject(jobInfo.getJobParameter());
- MigrationProcessContext processContext =
jobAPI.buildPipelineProcessContext(jobConfig);
- if (null == processContext.getCompletionDetectAlgorithm()) {
- log.info("completionDetector not configured, auto switch
will not be enabled. You could query job progress and switch config manually
with DistSQL.");
- continue;
- }
- RuleAlteredJobAlmostCompletedParameter parameter = new
RuleAlteredJobAlmostCompletedParameter(jobInfo.getShardingTotalCount(),
jobAPI.getJobProgress(jobConfig).values());
- if
(!processContext.getCompletionDetectAlgorithm().isAlmostCompleted(parameter)) {
- continue;
- }
- log.info("scaling job {} almost finished.", jobId);
- try {
- jobAPI.stopClusterWriteDB(jobConfig);
- if (!jobAPI.isDataConsistencyCheckNeeded(jobConfig)) {
- log.info("DataConsistencyCalculatorAlgorithm is not
configured, data consistency check is ignored.");
- jobAPI.switchClusterConfiguration(jobConfig);
- continue;
- }
- if (!dataConsistencyCheck(jobConfig)) {
- log.error("data consistency check failed, job {}",
jobId);
- continue;
- }
- switchClusterConfiguration(jobConfig);
- } finally {
- jobAPI.restoreClusterWriteDB(jobConfig);
- }
- log.info("job {} finished", jobId);
- // CHECKSTYLE:OFF
- } catch (final Exception ex) {
- // CHECKSTYLE:ON
- log.error("scaling job {} finish check failed!", jobId, ex);
- } finally {
- onCheckJobIds.remove(jobId);
- }
- }
- }
-
- private boolean isNotAllowDataCheck(final String jobId) {
- Map<Integer, InventoryIncrementalJobItemProgress> jobItemProgressMap =
jobAPI.getJobProgress(jobId);
- for (InventoryIncrementalJobItemProgress each :
jobItemProgressMap.values()) {
- if (null == each ||
!JobStatus.EXECUTE_INCREMENTAL_TASK.equals(each.getStatus())) {
- return true;
- }
- }
- return false;
- }
-
- private boolean dataConsistencyCheck(final MigrationJobConfiguration
jobConfig) {
- String jobId = jobConfig.getJobId();
- log.info("dataConsistencyCheck for job {}", jobId);
- return jobAPI.aggregateDataConsistencyCheckResults(jobId,
jobAPI.dataConsistencyCheck(jobConfig));
- }
-
- private void switchClusterConfiguration(final MigrationJobConfiguration
jobConfig) {
- jobAPI.switchClusterConfiguration(jobConfig);
- }
-}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPI.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPI.java
index 72d3a03a5b8..95cea7fe14f 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPI.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPI.java
@@ -63,20 +63,6 @@ public interface MigrationJobAPI extends PipelineJobAPI,
MigrationJobPublicAPI,
@Override
InventoryIncrementalJobItemProgress getJobItemProgress(String jobId, int
shardingItem);
- /**
- * Stop cluster writing.
- *
- * @param jobConfig job configuration
- */
- void stopClusterWriteDB(MigrationJobConfiguration jobConfig);
-
- /**
- * Restore cluster writing.
- *
- * @param jobConfig job configuration
- */
- void restoreClusterWriteDB(MigrationJobConfiguration jobConfig);
-
/**
* Is data consistency check needed.
*
@@ -101,11 +87,4 @@ public interface MigrationJobAPI extends PipelineJobAPI,
MigrationJobPublicAPI,
* @return check success or not
*/
boolean aggregateDataConsistencyCheckResults(String jobId, Map<String,
DataConsistencyCheckResult> checkResults);
-
- /**
- * Switch cluster configuration.
- *
- * @param jobConfig job configuration
- */
- void switchClusterConfiguration(MigrationJobConfiguration jobConfig);
}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
index 6ea4f689ed6..e2ad42ba6b3 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/MigrationJobAPIImpl.java
@@ -60,7 +60,6 @@ import
org.apache.shardingsphere.data.pipeline.core.context.PipelineContext;
import
org.apache.shardingsphere.data.pipeline.core.exception.AddMigrationSourceResourceException;
import
org.apache.shardingsphere.data.pipeline.core.exception.DropMigrationSourceResourceException;
import
org.apache.shardingsphere.data.pipeline.core.exception.PipelineVerifyFailedException;
-import
org.apache.shardingsphere.data.pipeline.core.job.progress.PipelineJobProgressDetector;
import
org.apache.shardingsphere.data.pipeline.core.util.PipelineSchemaTableUtil;
import
org.apache.shardingsphere.data.pipeline.spi.check.consistency.DataConsistencyCalculateAlgorithm;
import
org.apache.shardingsphere.data.pipeline.spi.ratelimit.JobRateLimitAlgorithm;
@@ -73,15 +72,12 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
-import org.apache.shardingsphere.infra.lock.LockContext;
-import org.apache.shardingsphere.infra.lock.LockDefinition;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
import
org.apache.shardingsphere.infra.yaml.config.swapper.resource.YamlDataSourceConfigurationSwapper;
import
org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine;
-import org.apache.shardingsphere.mode.lock.ExclusiveLockDefinition;
import javax.sql.DataSource;
import java.nio.charset.StandardCharsets;
@@ -273,63 +269,6 @@ public final class MigrationJobAPIImpl extends
AbstractPipelineJobAPIImpl implem
}
}
- private void verifyJobNotCompleted(final MigrationJobConfiguration
jobConfig) {
- if
(PipelineJobProgressDetector.isJobCompleted(jobConfig.getJobShardingCount(),
getJobProgress(jobConfig).values())) {
- throw new PipelineVerifyFailedException("Job is completed, it's
not necessary to do it.");
- }
- }
-
- @Override
- public void stopClusterWriteDB(final String jobId) {
- checkModeConfig();
- log.info("stopClusterWriteDB for job {}", jobId);
- JobConfigurationPOJO jobConfigPOJO = getElasticJobConfigPOJO(jobId);
- MigrationJobConfiguration jobConfig =
getJobConfiguration(jobConfigPOJO);
- verifyManualMode(jobConfig);
- verifyJobNotStopped(jobConfigPOJO);
- verifyJobNotCompleted(jobConfig);
- stopClusterWriteDB(jobConfig);
- }
-
- @Override
- public void stopClusterWriteDB(final MigrationJobConfiguration jobConfig) {
- String databaseName = jobConfig.getTargetDatabaseName();
- LockContext lockContext =
PipelineContext.getContextManager().getInstanceContext().getLockContext();
- LockDefinition lockDefinition = new
ExclusiveLockDefinition(databaseName);
- if (lockContext.isLocked(lockDefinition)) {
- log.info("stopClusterWriteDB, already stopped");
- return;
- }
- if (lockContext.tryLock(lockDefinition)) {
- log.info("stopClusterWriteDB, tryLockSuccess=true");
- return;
- }
- throw new RuntimeException("Stop source writing failed");
- }
-
- @Override
- public void restoreClusterWriteDB(final String jobId) {
- checkModeConfig();
- log.info("restoreClusterWriteDB for job {}", jobId);
- JobConfigurationPOJO jobConfigPOJO = getElasticJobConfigPOJO(jobId);
- MigrationJobConfiguration jobConfig =
getJobConfiguration(jobConfigPOJO);
- verifyManualMode(jobConfig);
- restoreClusterWriteDB(jobConfig);
- }
-
- @Override
- public void restoreClusterWriteDB(final MigrationJobConfiguration
jobConfig) {
- String databaseName = jobConfig.getTargetDatabaseName();
- LockContext lockContext =
PipelineContext.getContextManager().getInstanceContext().getLockContext();
- LockDefinition lockDefinition = new
ExclusiveLockDefinition(databaseName);
- if (lockContext.isLocked(lockDefinition)) {
- log.info("restoreClusterWriteDB, before unlock, databaseName={},
jobId={}", databaseName, jobConfig.getJobId());
- lockContext.unlock(lockDefinition);
- return;
- }
- log.info("restoreClusterWriteDB, isLocked false, databaseName={}",
databaseName);
- }
-
@Override
public Collection<DataConsistencyCheckAlgorithmInfo>
listDataConsistencyCheckAlgorithms() {
checkModeConfig();
@@ -417,22 +356,6 @@ public final class MigrationJobAPIImpl extends
AbstractPipelineJobAPIImpl implem
return true;
}
- @Override
- public void switchClusterConfiguration(final String jobId) {
- checkModeConfig();
- log.info("Switch cluster configuration for job {}", jobId);
- JobConfigurationPOJO jobConfigPOJO = getElasticJobConfigPOJO(jobId);
- MigrationJobConfiguration jobConfig =
getJobConfiguration(jobConfigPOJO);
- verifyManualMode(jobConfig);
- verifyJobNotStopped(jobConfigPOJO);
- verifyJobNotCompleted(jobConfig);
- switchClusterConfiguration(jobConfig);
- }
-
- @Override
- public void switchClusterConfiguration(final MigrationJobConfiguration
jobConfig) {
- }
-
@Override
public void reset(final String jobId) {
checkModeConfig();
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
index ebf7053f65f..11d5b9f69bf 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/fixture/MigrationJobAPIFixture.java
@@ -96,22 +96,6 @@ public final class MigrationJobAPIFixture implements
MigrationJobAPI {
return null;
}
- @Override
- public void stopClusterWriteDB(final String jobId) {
- }
-
- @Override
- public void stopClusterWriteDB(final MigrationJobConfiguration jobConfig) {
- }
-
- @Override
- public void restoreClusterWriteDB(final String jobId) {
- }
-
- @Override
- public void restoreClusterWriteDB(final MigrationJobConfiguration
jobConfig) {
- }
-
@Override
public Collection<DataConsistencyCheckAlgorithmInfo>
listDataConsistencyCheckAlgorithms() {
return null;
@@ -147,14 +131,6 @@ public final class MigrationJobAPIFixture implements
MigrationJobAPI {
return false;
}
- @Override
- public void switchClusterConfiguration(final String jobId) {
- }
-
- @Override
- public void switchClusterConfiguration(final MigrationJobConfiguration
jobConfig) {
- }
-
@Override
public void reset(final String jobId) {
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
index b97a9364a62..cbc04fe4bc5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
@@ -17,13 +17,11 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql;
-import org.apache.shardingsphere.data.pipeline.core.context.PipelineContext;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterResourceStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowUnusedResourcesStatement;
-import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.distsql.exception.rule.RequiredRuleMissedException;
@@ -35,7 +33,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.RALBackendHandlerFactory;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.RDLBackendHandlerFactory;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.RQLBackendHandlerFactory;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
@@ -46,9 +43,6 @@ import
org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.AlterReadwriteSplittingRuleStatement;
import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.CreateReadwriteSplittingRuleStatement;
import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.DropReadwriteSplittingRuleStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationSourceWritingStatement;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import
org.apache.shardingsphere.shadow.distsql.parser.statement.AlterShadowAlgorithmStatement;
import
org.apache.shardingsphere.shadow.distsql.parser.statement.AlterShadowRuleStatement;
@@ -61,7 +55,6 @@ import
org.apache.shardingsphere.shadow.distsql.parser.statement.ShowShadowTable
import
org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -240,30 +233,6 @@ public final class DistSQLBackendHandlerFactoryTest
extends ProxyContextRestorer
assertThat(response, instanceOf(QueryResponseHeader.class));
}
- @Test
- public void assertExecuteShowScalingCheckAlgorithmsContext() throws
SQLException {
- mockScalingContext();
- ResponseHeader response =
RALBackendHandlerFactory.newInstance(mock(ShowMigrationCheckAlgorithmsStatement.class),
connectionSession).execute();
- assertThat(response, instanceOf(QueryResponseHeader.class));
- }
-
- // TODO assertExecuteStopScalingSourceWritingContext,
assertExecuteCheckoutScalingContext throw exception
- @Ignore
- @Test
- public void assertExecuteStopScalingSourceWritingContext() throws
SQLException {
- mockScalingContext();
- ResponseHeader response =
RALBackendHandlerFactory.newInstance(mock(StopMigrationSourceWritingStatement.class),
connectionSession).execute();
- assertThat(response, instanceOf(UpdateResponseHeader.class));
- }
-
- @Ignore
- @Test
- public void assertExecuteCheckoutScalingContext() throws SQLException {
- mockScalingContext();
- ResponseHeader response =
RALBackendHandlerFactory.newInstance(mock(ApplyMigrationStatement.class),
connectionSession).execute();
- assertThat(response, instanceOf(UpdateResponseHeader.class));
- }
-
private void setContextManager(final boolean isGovernance) {
ContextManager contextManager = mock(ContextManager.class,
RETURNS_DEEP_STUBS);
MetaDataContexts metaDataContexts = isGovernance
@@ -296,12 +265,6 @@ public final class DistSQLBackendHandlerFactoryTest
extends ProxyContextRestorer
when(metaDataContexts.getMetaData().getDatabase("db")).thenReturn(database);
}
- private void mockScalingContext() {
- ModeConfiguration modeConfig = mock(ModeConfiguration.class);
- when(modeConfig.getType()).thenReturn("Cluster");
- PipelineContext.initModeConfig(modeConfig);
- }
-
@After
public void setDown() {
setContextManager(false);
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
index 472cc896066..c67bf06afd3 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/rdl/rdl-integration-test-cases.xml
@@ -95,7 +95,7 @@
<!-- RESOURCES("encrypt_write_ds_${0..9}"),-->
<!-- SHARDING_COLUMN=user_id, TYPE(NAME=MOD,
PROPERTIES("sharding-count"=40)))));-->
<!-- ALTER SHARDING BINDING TABLE RULES
(t_user,t_user_item);"/>-->
-<!-- <destroy-sql sql="DROP SHARDING BINDING TABLE RULES;DROP
SHARDING TABLE RULE t_user;DROP SHARDING SCALING RULE default_scaling" />-->
+<!-- <destroy-sql sql="DROP SHARDING BINDING TABLE RULES;DROP
SHARDING TABLE RULE t_user" />-->
<!-- </assertion>-->
<!-- </test-case>-->
<!-- -->
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
index a0a1f3483d8..4e43ff54e74 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/UpdatableScalingRALStatementAssert.java
@@ -21,36 +21,27 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
import
org.apache.shardingsphere.migration.distsql.statement.AddMigrationSourceResourceStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
import
org.apache.shardingsphere.migration.distsql.statement.CleanMigrationStatement;
import
org.apache.shardingsphere.migration.distsql.statement.DropMigrationSourceResourceStatement;
import
org.apache.shardingsphere.migration.distsql.statement.MigrateTableStatement;
import
org.apache.shardingsphere.migration.distsql.statement.ResetMigrationStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.RestoreMigrationSourceWritingStatement;
import
org.apache.shardingsphere.migration.distsql.statement.StartMigrationStatement;
-import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationSourceWritingStatement;
import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationStatement;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.AddMigrationSourceResourceStatementAssert;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.ApplyMigrationStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.CleanMigrationStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.DropMigrationSourceResourceStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.MigrateTableStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.ResetMigrationStatementAssert;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.RestoreMigrationSourceWritingStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.StartMigrationStatementAssert;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.StopMigrationSourceWritingStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update.StopMigrationStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ApplyMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CleanMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.DropMigrationSourceResourceStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.MigrateTableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ResetMigrationStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.RestoreMigrationSourceWritingStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StartMigrationStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationSourceWritingStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationStatementTestCase;
/**
@@ -70,12 +61,6 @@ public final class UpdatableScalingRALStatementAssert {
// TODO add more test case
if (actual instanceof MigrateTableStatement) {
MigrateTableStatementAssert.assertIs(assertContext,
(MigrateTableStatement) actual, (MigrateTableStatementTestCase) expected);
- } else if (actual instanceof StopMigrationSourceWritingStatement) {
- StopMigrationSourceWritingStatementAssert.assertIs(assertContext,
(StopMigrationSourceWritingStatement) actual,
(StopMigrationSourceWritingStatementTestCase) expected);
- } else if (actual instanceof RestoreMigrationSourceWritingStatement) {
-
RestoreMigrationSourceWritingStatementAssert.assertIs(assertContext,
(RestoreMigrationSourceWritingStatement) actual,
(RestoreMigrationSourceWritingStatementTestCase) expected);
- } else if (actual instanceof ApplyMigrationStatement) {
- ApplyMigrationStatementAssert.assertIs(assertContext,
(ApplyMigrationStatement) actual, (ApplyMigrationStatementTestCase) expected);
} else if (actual instanceof StopMigrationStatement) {
StopMigrationStatementAssert.assertIs(assertContext,
(StopMigrationStatement) actual, (StopMigrationStatementTestCase) expected);
} else if (actual instanceof ResetMigrationStatement) {
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/ApplyMigrationStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/ApplyMigrationStatementAssert.java
deleted file mode 100644
index e0962e2d31e..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/ApplyMigrationStatementAssert.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update;
-
-import
org.apache.shardingsphere.migration.distsql.statement.ApplyMigrationStatement;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ApplyMigrationStatementTestCase;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * Apply migration statement assert.
- */
-public final class ApplyMigrationStatementAssert {
-
- /**
- * Assert apply migration statement is correct with expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual apply migration statement
- * @param expected expected apply migration statement test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext,
final ApplyMigrationStatement actual, final ApplyMigrationStatementTestCase
expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual statement should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual statement should
exist."), actual);
- assertJobIds(assertContext, actual.getJobId(),
expected.getJobIds());
- }
- }
-
- private static void assertJobIds(final SQLCaseAssertContext assertContext,
final String actual, final List<String> expected) {
- if (expected.isEmpty()) {
- assertNull(assertContext.getText("Actual job id should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual job id should
exist."), actual);
- assertThat(assertContext.getText("Job id assertion error"),
actual, is(expected.iterator().next()));
- }
- }
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/RestoreMigrationSourceWritingStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/RestoreMigrationSourceWritingStatementAssert.java
deleted file mode 100644
index 90e40f15d9f..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/RestoreMigrationSourceWritingStatementAssert.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update;
-
-import
org.apache.shardingsphere.migration.distsql.statement.RestoreMigrationSourceWritingStatement;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.RestoreMigrationSourceWritingStatementTestCase;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * Restore migration source writing statement assert.
- */
-public final class RestoreMigrationSourceWritingStatementAssert {
-
- /**
- * Assert restore migration source writing statement is correct with
expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual restore migration source writing statement
- * @param expected expected restore migration source writing statement
test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext,
final RestoreMigrationSourceWritingStatement actual, final
RestoreMigrationSourceWritingStatementTestCase expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual statement should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual statement should
exist."), actual);
- assertJobIds(assertContext, actual.getJobId(),
expected.getJobIds());
- }
- }
-
- private static void assertJobIds(final SQLCaseAssertContext assertContext,
final String actual, final List<String> expected) {
- if (expected.isEmpty()) {
- assertNull(assertContext.getText("Actual job id should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual job id should
exist."), actual);
- assertThat(assertContext.getText("Job id assertion error"),
actual, is(expected.iterator().next()));
- }
- }
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/StopMigrationSourceWritingStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/StopMigrationSourceWritingStatementAssert.java
deleted file mode 100644
index 1328c2a57e6..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/migration/update/StopMigrationSourceWritingStatementAssert.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.migration.update;
-
-import
org.apache.shardingsphere.migration.distsql.statement.StopMigrationSourceWritingStatement;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationSourceWritingStatementTestCase;
-
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * Stop migration source writing statement assert.
- */
-public final class StopMigrationSourceWritingStatementAssert {
-
- /**
- * Assert stop migration source writing statement is correct with expected
parser result.
- *
- * @param assertContext assert context
- * @param actual actual stop migration source writing statement
- * @param expected expected stop migration source writing statement test
case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext,
final StopMigrationSourceWritingStatement actual, final
StopMigrationSourceWritingStatementTestCase expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual statement should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual statement should
exist."), actual);
- assertJobIds(assertContext, actual.getJobId(),
expected.getJobIds());
- }
- }
-
- private static void assertJobIds(final SQLCaseAssertContext assertContext,
final String actual, final List<String> expected) {
- if (expected.isEmpty()) {
- assertNull(assertContext.getText("Actual job id should not
exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual job id should
exist."), actual);
- assertThat(assertContext.getText("Job id assertion error"),
actual, is(expected.iterator().next()));
- }
- }
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index 8d96b206f9e..a3a59bd4082 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -307,18 +307,15 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowVariableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.UnlabelInstanceStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.AddMigrationSourceResourceStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ApplyMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CheckMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.CleanMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.DropMigrationSourceResourceStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.MigrateTableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ResetMigrationStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.RestoreMigrationSourceWritingStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ShowMigrationCheckAlgorithmsStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ShowMigrationSourceResourcesStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.ShowMigrationStatusStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StartMigrationStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationSourceWritingStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration.StopMigrationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterDatabaseDiscoveryConstructionRuleStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterDatabaseDiscoveryDefinitionRuleStatementTestCase;
@@ -1010,15 +1007,6 @@ public final class SQLParserTestCases {
@XmlElement(name = "show-migration-check-algorithms")
private final List<ShowMigrationCheckAlgorithmsStatementTestCase>
showMigrationCheckAlgorithmsStatementTestCases = new LinkedList<>();
- @XmlElement(name = "stop-migration-source-writing")
- private final List<StopMigrationSourceWritingStatementTestCase>
stopMigrationSourceWritingTestCases = new LinkedList<>();
-
- @XmlElement(name = "restore-migration-source-writing")
- private final List<RestoreMigrationSourceWritingStatementTestCase>
restoreMigrationSourceWritingTestCases = new LinkedList<>();
-
- @XmlElement(name = "apply-migration")
- private final List<ApplyMigrationStatementTestCase> applyScalingTestCases
= new LinkedList<>();
-
@XmlElement(name = "reset-migration")
private final List<ResetMigrationStatementTestCase>
resetMigrationTestCases = new LinkedList<>();
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/ApplyMigrationStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/ApplyMigrationStatementTestCase.java
deleted file mode 100644
index bed26cc50d1..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/ApplyMigrationStatementTestCase.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration;
-
-import lombok.Getter;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Apply migration statement test case.
- */
-@Getter
-public final class ApplyMigrationStatementTestCase extends SQLParserTestCase {
-
- @XmlElement(name = "job-id")
- private final List<String> jobIds = new LinkedList<>();
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/RestoreMigrationSourceWritingStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/RestoreMigrationSourceWritingStatementTestCase.java
deleted file mode 100644
index fb564caf44a..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/RestoreMigrationSourceWritingStatementTestCase.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration;
-
-import lombok.Getter;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Restore migration source writing statement test case.
- */
-@Getter
-public final class RestoreMigrationSourceWritingStatementTestCase extends
SQLParserTestCase {
-
- @XmlElement(name = "job-id")
- private final List<String> jobIds = new LinkedList<>();
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/StopMigrationSourceWritingStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/StopMigrationSourceWritingStatementTestCase.java
deleted file mode 100644
index c8a3cc06f8b..00000000000
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/migration/StopMigrationSourceWritingStatementTestCase.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.migration;
-
-import lombok.Getter;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Stop migration source writing statement test case.
- */
-@Getter
-public final class StopMigrationSourceWritingStatementTestCase extends
SQLParserTestCase {
-
- @XmlElement(name = "job-id")
- private final List<String> jobIds = new LinkedList<>();
-}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
index 4e64a317504..e367b286b17 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/migration.xml
@@ -66,18 +66,6 @@
<target-table-name>t_order</target-table-name>
</migrate-table>
- <stop-migration-source-writing sql-case-id="stop-migration-source-writing">
- <job-id>123</job-id>
- </stop-migration-source-writing>
-
- <restore-migration-source-writing
sql-case-id="restore-migration-source-writing">
- <job-id>123</job-id>
- </restore-migration-source-writing>
-
- <apply-migration sql-case-id="apply-migration">
- <job-id>123</job-id>
- </apply-migration>
-
<clean-migration sql-case-id="clean-migration">
<job-id>123</job-id>
</clean-migration>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
index f8058247293..d830b78ef82 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/migration.xml
@@ -28,9 +28,6 @@
<distsql-case id="migrate-table-with-schema" value="MIGRATE TABLE
ds_0.public.t_order INTO t_order;" />
<distsql-case id="migrate-table-with-target-db" value="MIGRATE TABLE
ds_0.t_order INTO sharding_db.t_order;" />
<distsql-case id="migrate-table-with-schema-target-db" value="MIGRATE
TABLE ds_0.public.t_order INTO sharding_db.t_order;" />
- <distsql-case id="stop-migration-source-writing" value="STOP MIGRATION
SOURCE WRITING 123;" />
- <distsql-case id="restore-migration-source-writing" value="RESTORE
MIGRATION SOURCE WRITING 123;" />
- <distsql-case id="apply-migration" value="APPLY MIGRATION 123;" />
<distsql-case id="clean-migration" value="CLEAN MIGRATION 123;" />
<distsql-case id="reset-migration" value="RESET MIGRATION 123;" />
<distsql-case id="stop-migration" value="STOP MIGRATION 123;" />
diff --git
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
index 8b9453b7ae0..a217614de46 100644
---
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
+++
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/api/impl/MigrationJobAPIImplTest.java
@@ -33,7 +33,6 @@ import
org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
import
org.apache.shardingsphere.data.pipeline.core.api.GovernanceRepositoryAPI;
import org.apache.shardingsphere.data.pipeline.core.api.PipelineAPIFactory;
import
org.apache.shardingsphere.data.pipeline.core.datasource.creator.PipelineDataSourceCreatorFactory;
-import
org.apache.shardingsphere.data.pipeline.core.exception.PipelineVerifyFailedException;
import
org.apache.shardingsphere.data.pipeline.core.util.JobConfigurationBuilder;
import org.apache.shardingsphere.data.pipeline.core.util.PipelineContextUtil;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPI;
@@ -156,9 +155,7 @@ public final class MigrationJobAPIImplTest {
log.error("source is null, jobConfig={}",
YamlEngine.marshal(jobConfig));
}
initTableData(jobConfig);
- jobAPI.stopClusterWriteDB(jobConfig);
Map<String, DataConsistencyCheckResult> checkResultMap =
jobAPI.dataConsistencyCheck(jobId.get());
- jobAPI.restoreClusterWriteDB(jobConfig);
assertThat(checkResultMap.size(), is(1));
}
@@ -168,9 +165,7 @@ public final class MigrationJobAPIImplTest {
assertTrue(jobId.isPresent());
MigrationJobConfiguration jobConfig =
jobAPI.getJobConfiguration(jobId.get());
initTableData(jobConfig);
- jobAPI.stopClusterWriteDB(jobConfig);
Map<String, DataConsistencyCheckResult> checkResultMap =
jobAPI.dataConsistencyCheck(jobId.get(), "FIXTURE", null);
- jobAPI.restoreClusterWriteDB(jobConfig);
assertThat(checkResultMap.size(), is(1));
assertTrue(checkResultMap.get("t_order").getCountCheckResult().isMatched());
assertThat(checkResultMap.get("t_order").getCountCheckResult().getTargetRecordsCount(),
is(2L));
@@ -214,19 +209,6 @@ public final class MigrationJobAPIImplTest {
assertTrue(jobAPI.aggregateDataConsistencyCheckResults("foo_job",
checkResults));
}
- @Test(expected = PipelineVerifyFailedException.class)
- public void assertSwitchClusterConfigurationAlreadyFinished() {
- final MigrationJobConfiguration jobConfig =
JobConfigurationBuilder.createJobConfiguration();
- Optional<String> jobId = jobAPI.start(jobConfig);
- assertTrue(jobId.isPresent());
- final GovernanceRepositoryAPI repositoryAPI =
PipelineAPIFactory.getGovernanceRepositoryAPI();
- MigrationJobItemContext jobItemContext =
PipelineContextUtil.mockMigrationJobItemContext(jobConfig);
- jobAPI.persistJobItemProgress(jobItemContext);
- repositoryAPI.persistJobCheckResult(jobId.get(), true);
- jobAPI.updateJobItemStatus(jobId.get(), 0, JobStatus.FINISHED);
- jobAPI.switchClusterConfiguration(jobId.get());
- }
-
@Test
public void assertSwitchClusterConfigurationSucceed() {
final MigrationJobConfiguration jobConfig =
JobConfigurationBuilder.createJobConfiguration();
diff --git
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJobTest.java
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJobTest.java
deleted file mode 100644
index 400cc87014c..00000000000
---
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/job/FinishedCheckJobTest.java
+++ /dev/null
@@ -1,85 +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.
- */
-
-package org.apache.shardingsphere.data.pipeline.core.job;
-
-import lombok.SneakyThrows;
-import org.apache.shardingsphere.data.pipeline.api.pojo.PipelineJobInfo;
-import
org.apache.shardingsphere.data.pipeline.core.util.JobConfigurationBuilder;
-import org.apache.shardingsphere.data.pipeline.core.util.PipelineContextUtil;
-import org.apache.shardingsphere.data.pipeline.core.util.ReflectionUtil;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPI;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobAPIFactory;
-import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationProcessContext;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.List;
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class FinishedCheckJobTest {
-
- private static FinishedCheckJob finishedCheckJob;
-
- @Mock
- private MigrationJobAPI jobAPI;
-
- @Mock
- private MigrationProcessContext processContext;
-
- @BeforeClass
- public static void beforeClass() {
- PipelineContextUtil.mockModeConfigAndContextManager();
- finishedCheckJob = new FinishedCheckJob();
- }
-
- @Before
- @SneakyThrows(ReflectiveOperationException.class)
- public void setUp() {
-
when(jobAPI.buildPipelineProcessContext(any())).thenReturn(processContext);
- ReflectionUtil.setFieldValue(finishedCheckJob, "jobAPI", jobAPI);
- }
-
- @Test
- public void assertExecuteAllDisabledJob() {
- Optional<String> jobId =
MigrationJobAPIFactory.getInstance().start(JobConfigurationBuilder.createJobConfiguration());
- assertTrue(jobId.isPresent());
- List<PipelineJobInfo> jobInfos =
MigrationJobAPIFactory.getInstance().list();
- jobInfos.forEach(each -> each.setActive(false));
- when(jobAPI.list()).thenReturn(jobInfos);
- finishedCheckJob.execute(null);
- }
-
- @Test
- public void assertExecuteActiveJob() {
- Optional<String> jobId =
MigrationJobAPIFactory.getInstance().start(JobConfigurationBuilder.createJobConfiguration());
- assertTrue(jobId.isPresent());
- List<PipelineJobInfo> jobInfos =
MigrationJobAPIFactory.getInstance().list();
- jobInfos.forEach(each -> each.setActive(true));
- when(jobAPI.list()).thenReturn(jobInfos);
- finishedCheckJob.execute(null);
- }
-}