strongduanmu commented on a change in pull request #15234:
URL: https://github.com/apache/shardingsphere/pull/15234#discussion_r797459591
##########
File path:
shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
##########
@@ -251,9 +251,7 @@ public void alterSchema(final String schemaName, final
ShardingSphereSchema sche
*/
public void alterSchema(final String schemaName, final TableMetaData
changedTableMetaData, final String deletedTable) {
ShardingSphereMetaData metaData =
metaDataContexts.getMetaData(schemaName);
- if (!containsInDataNodeContainedRule(changedTableMetaData.getName(),
metaData)) {
-
metaData.getRuleMetaData().findRules(MutableDataNodeRule.class).forEach(each ->
each.put(changedTableMetaData.getName(),
each.getDataSourceNames().iterator().next()));
- }
+ singleTableDataSourceMappingRelation(metaData, changedTableMetaData);
Review comment:
Can we use another meaningful method name? Just like
'alterSingleTableDataNodes'?
##########
File path:
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/identifier/type/MutableDataNodeRule.java
##########
@@ -42,9 +43,10 @@
void remove(String tableName);
/**
- * Get data source names.
+ * Find single data node by table name.
*
- * @return Get data source names
+ * @param tableName table name
+ * @return single table data node
*/
- Collection<String> getDataSourceNames();
+ Optional<DataNode> findSingleTableDataNodeByTableName(String tableName);
Review comment:
@zjcnb Why not change this method to findSingleTableDataNode directly?
--
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]