You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Pace2Car (via GitHub)" <gi...@apache.org> on 2023/11/29 10:36:08 UTC
[I] Enhance create DatabaseRule must have data source check [shardingsphere]
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "HarshSawarkar (via GitHub)" <gi...@apache.org>.
HarshSawarkar commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1920906013
Hi @Pace2Car I created this new branch from **_master_**branch. Also previously I did "git merge origin/master " into my development branch. I got the same conflicts both the times. Can you please tell how to resolve this issues?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1920934712
> Hi @Pace2Car I created this new branch from **_master_**branch. Also previously I did "git merge origin/master " into my development branch. I got the same conflicts both the times. Can you please tell how to resolve this issues?
You need to configure the remote repository "git remote add apache https://github.com/apache/shardingsphere.git", then "git checkout" your development branch, then "git merge apache/master", resolve conflicts and "git push".
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1872312786
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1911879222
> Hey @Pace2Car, I would like to work on this issue if no one is working on it currently. Also I had this doubt in
>
> > 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.
>
> by checks do you mean only the Datasource check or all the listed checks in the method and also some of the statements that create rules like **_CreateMaskRuleExecutor_** dosn't check for **_DataSource_**. So, should this statements be checked for DataSource? Furthermore, the **_RuleDefinitionBackendHandler_** class is from **_Proxy_** package, so to be able to checkDataSource() implemented in the **_RuleDefinitionBackendHandler_**, this module has to be added in the corresponding _create rule class_. Will this implementation be correct?
Welcome, it should check that the DataSource exists before creating any DatabaseRule. In addition, pay attention to the possible occurrence of circular dependencies when implementing.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car closed issue #29233: Enhance create DatabaseRule must have data source check
URL: https://github.com/apache/shardingsphere/issues/29233
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-2003052580
Close as completed.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1974895037
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "HarshSawarkar (via GitHub)" <gi...@apache.org>.
HarshSawarkar commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1916624591
Hi @Pace2Car I implemented the checkDataSource() method inside the RuleDefinationExecuteEngine() to avoid circular dependency.Can you please review?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enhance create DatabaseRule must have data source check [shardingsphere]
Posted by "HarshSawarkar (via GitHub)" <gi...@apache.org>.
HarshSawarkar commented on issue #29233:
URL: https://github.com/apache/shardingsphere/issues/29233#issuecomment-1911747633
Hey @Pace2Car, I would like to work on this issue if no one is working on it currently. Also I had this doubt in
> 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.
by checks do you mean only the Datasource check or all the listed checks in the method and also some of the statements that create rules like **_CreateMaskRuleExecutor_** dosn't check for **_DataSource_**. So, should this statements be checked for DataSource? Furthermore, the **_RuleDefinitionBackendHandler_** class is from **_Proxy_** package, so to be able to checkDataSource() implemented in the **_RuleDefinitionBackendHandler_**, this module has to be added in the corresponding _create rule class_. Will this implementation be correct?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org