You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/09/30 11:20:55 UTC
[shardingsphere] branch master updated: Refactor UncompletedConsistencyCheckJobExistsException (#21287)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9356ce1fb95 Refactor UncompletedConsistencyCheckJobExistsException (#21287)
9356ce1fb95 is described below
commit 9356ce1fb9504ffef366a21af387e40b55a97fac
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Sep 30 19:20:47 2022 +0800
Refactor UncompletedConsistencyCheckJobExistsException (#21287)
---
docs/document/content/user-manual/error-code/sql-error-code.cn.md | 1 +
docs/document/content/user-manual/error-code/sql-error-code.en.md | 1 +
.../exception/job/UncompletedConsistencyCheckJobExistsException.java | 2 +-
.../scenario/consistencycheck/ConsistencyCheckJobAPIImpl.java | 5 ++---
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index 6d31aca6b29..0b5e857f41f 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -116,6 +116,7 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY000 | 18093 | Can not poll event because of binlog sync channel already closed. |
| HY000 | 18094 | Task \`%s\` execute failed. |
| HY000 | 18095 | Job has already finished, please run \`CHECK MIGRATION %s\` to start a new data consistency check job. |
+| HY000 | 18096 | Uncompleted consistency check job \`%s\` exists. |
### DistSQL
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index b184294e867..e8900ee86ba 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -116,6 +116,7 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| HY000 | 18093 | Can not poll event because of binlog sync channel already closed. |
| HY000 | 18094 | Task \`%s\` execute failed. |
| HY000 | 18095 | Job has already finished, please run \`CHECK MIGRATION %s\` to start a new data consistency check job. |
+| HY000 | 18096 | Uncompleted consistency check job \`%s\` exists. |
### DistSQL
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/UncompletedConsistencyCheckJobExistsException.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/UncompletedConsistencyCheckJobExistsException.java
index cbd52e4fce7..127655303a8 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/UncompletedConsistencyCheckJobExistsException.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/UncompletedConsistencyCheckJobExistsException.java
@@ -28,6 +28,6 @@ public final class UncompletedConsistencyCheckJobExistsException extends Pipelin
private static final long serialVersionUID = 2854259384634892428L;
public UncompletedConsistencyCheckJobExistsException(final String jobId) {
- super(XOpenSQLState.GENERAL_ERROR, 86, "Uncompelted consistency check job `%s` exists.", jobId);
+ super(XOpenSQLState.GENERAL_ERROR, 96, "Uncompleted consistency check job `%s` exists.", jobId);
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/ConsistencyCheckJobAPIImpl.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/ConsistencyCheckJobAPIImpl.java
index c2e88634d30..0d45d4acc84 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/ConsistencyCheckJobAPIImpl.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/ConsistencyCheckJobAPIImpl.java
@@ -78,7 +78,7 @@ public final class ConsistencyCheckJobAPIImpl extends AbstractPipelineJobAPIImpl
throw new UncompletedConsistencyCheckJobExistsException(checkLatestJobId.get());
}
}
- int sequence = checkLatestJobId.map(s -> ConsistencyCheckJobId.parseSequence(s) + 1).orElse(ConsistencyCheckJobId.MIN_SEQUENCE);
+ int sequence = checkLatestJobId.map(optional -> ConsistencyCheckJobId.parseSequence(optional) + 1).orElse(ConsistencyCheckJobId.MIN_SEQUENCE);
String result = marshalJobId(new ConsistencyCheckJobId(parentJobId, sequence));
repositoryAPI.persistCheckLatestJobId(parentJobId, result);
repositoryAPI.deleteCheckJobResult(parentJobId, result);
@@ -88,8 +88,7 @@ public final class ConsistencyCheckJobAPIImpl extends AbstractPipelineJobAPIImpl
yamlConfig.setParentJobId(parentJobId);
yamlConfig.setAlgorithmTypeName(parameter.getAlgorithmTypeName());
yamlConfig.setAlgorithmProps(parameter.getAlgorithmProps());
- ConsistencyCheckJobConfiguration jobConfig = new YamlConsistencyCheckJobConfigurationSwapper().swapToObject(yamlConfig);
- start(jobConfig);
+ start(new YamlConsistencyCheckJobConfigurationSwapper().swapToObject(yamlConfig));
return result;
}