zjcnb opened a new issue, #19013:
URL: https://github.com/apache/shardingsphere/issues/19013
Hi community,
The governance center sent `SchemaChangedEvent` many times when i have
many single tables to persist governance center.
```
/**
* Renew meta data of the schema.
*
* @param event meta data changed event
*/
@Subscribe
public synchronized void renew(final SchemaChangedEvent event) {
contextManager.alterSchema(event.getDatabaseName(),
event.getSchemaName(), event.getChangedTableMetaData(),
event.getDeletedTable());
}
```
Send many `SchemaChangedEvent` event resut in build all rules used by the
user.
```
private synchronized void alterTable(final ShardingSphereDatabase
database, final String schemaName, final ShardingSphereTable beBoChangedTable) {
if (containsMutableDataNodeRule(database, schemaName,
beBoChangedTable.getName())) {
database.reloadRules(instanceContext);
}
database.getSchemas().get(schemaName).put(beBoChangedTable.getName(),
beBoChangedTable);
}
```
```
public synchronized void reloadRules(final InstanceContext
instanceContext) {
Collection<ShardingSphereRule> databaseRules =
DatabaseRulesBuilder.build(
name, new
DataSourceProvidedDatabaseConfiguration(resource.getDataSources(),
ruleMetaData.getConfigurations()), instanceContext);
ruleMetaData.getRules().clear();
ruleMetaData.getRules().addAll(databaseRules);
}
```
I don't think it's necessary. So, we need to provide a way to refresh a
single Rule method.
--
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]