Pace2Car opened a new issue, #29233:
URL: https://github.com/apache/shardingsphere/issues/29233
DatabaseRules need to be created when the data source exists, otherwise it
will be meaningless, and when the node is restarted, existing rules will not be
reloaded into the context.
The current situation is that some RuleDefinitionCreateUpdater
implementations have already checked the data source in the checkSQLStatement
method. such as:
CreateEncryptRuleStatementUpdater
```java
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final CreateEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration
currentRuleConfig) {
if (!sqlStatement.isIfNotExists()) {
checkDuplicateRuleNames(database.getName(), sqlStatement,
currentRuleConfig);
}
checkColumnNames(sqlStatement);
checkAlgorithmTypes(sqlStatement);
checkToBeCreatedEncryptors(sqlStatement);
checkDataSources(database);
}
private void checkDataSources(final ShardingSphereDatabase database) {
ShardingSpherePreconditions.checkState(!database.getResourceMetaData().getStorageUnits().isEmpty(),
() -> new EmptyStorageUnitException(database.getName()));
}
```
I am going to extract this check into the RuleDefinitionBackendHandler as a
public check for all statements that create rules.
Task List:
- [ ] RuleDefinitionBackendHandler
- [ ] NewRuleDefinitionBackendHandler
- [ ] related unit tests
- [ ] E2E
--
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]