sandynz commented on code in PR #28422:
URL: https://github.com/apache/shardingsphere/pull/28422#discussion_r1323849859
##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractPipelineJobAPIImpl.java:
##########
@@ -89,8 +90,8 @@ public Optional<String> start(final PipelineJobConfiguration
jobConfig) {
GovernanceRepositoryAPI repositoryAPI =
PipelineAPIFactory.getGovernanceRepositoryAPI(PipelineJobIdUtils.parseContextKey(jobId));
String jobConfigKey = PipelineMetaDataNode.getJobConfigPath(jobId);
if (repositoryAPI.isExisted(jobConfigKey)) {
- log.warn("jobId already exists in registry center, ignore,
jobConfigKey={}", jobConfigKey);
- return Optional.of(jobId);
+ log.error("jobId already exists in registry center,
jobConfigKey={}", jobConfigKey);
+ throw new PipelineJobAlreadyExistsException(jobId);
Review Comment:
It's better for idempotence if not throw exception
##########
kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/impl/AbstractPipelineJobAPIImpl.java:
##########
@@ -89,8 +90,8 @@ public Optional<String> start(final PipelineJobConfiguration
jobConfig) {
GovernanceRepositoryAPI repositoryAPI =
PipelineAPIFactory.getGovernanceRepositoryAPI(PipelineJobIdUtils.parseContextKey(jobId));
String jobConfigKey = PipelineMetaDataNode.getJobConfigPath(jobId);
if (repositoryAPI.isExisted(jobConfigKey)) {
- log.warn("jobId already exists in registry center, ignore,
jobConfigKey={}", jobConfigKey);
- return Optional.of(jobId);
+ log.error("jobId already exists in registry center,
jobConfigKey={}", jobConfigKey);
+ throw new PipelineJobAlreadyExistsException(jobId);
Review Comment:
`PipelineJobIdAlreadyExistsException` to represent `jobId` existing might be
better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]