sandynz commented on code in PR #19455:
URL: https://github.com/apache/shardingsphere/pull/19455#discussion_r928341854
##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobPreparer.java:
##########
@@ -142,10 +141,19 @@ private void prepareTarget(final RuleAlteredJobContext
jobContext) {
log.info("dataSourcePreparer null, ignore prepare target");
return;
}
+ DatabaseType sourceDatabaseType =
DatabaseTypeFactory.getInstance(jobConfig.getSourceDatabaseType());
+ DatabaseType targetDatabaseType =
DatabaseTypeFactory.getInstance(jobConfig.getTargetDatabaseType());
+ if (!sourceDatabaseType.isSchemaAvailable() ||
!targetDatabaseType.isSchemaAvailable()) {
+ log.info("prepareTargetSchemas, one of source or target database
type schema is not available, ignore");
+ return;
+ }
Review Comment:
For example:
```
private boolean isSourceAndTargetSchemaAvailable(... jobConfig) {
...
}
```
Then it could be used in `prepareTarget`:
```
if (isSourceAndTargetSchemaAvailable(...)) {
dataSourcePreparer.get().prepareTargetSchemas(prepareTargetSchemasParameter);
}
```
--
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]