You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/01/15 12:16:12 UTC

[GitHub] [incubator-shardingsphere] tristaZero commented on a change in pull request #3988: Using multithreading make loadDefaultTables faster and remove repeat load tableMetaData

tristaZero commented on a change in pull request #3988: Using multithreading make loadDefaultTables faster and remove repeat load tableMetaData
URL: https://github.com/apache/incubator-shardingsphere/pull/3988#discussion_r366844620
 
 

 ##########
 File path: sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/sharding/execute/metadata/loader/ShardingTableMetaDataLoader.java
 ##########
 @@ -206,19 +207,46 @@ public TableMetas loadAll(final ShardingRule shardingRule) throws SQLException {
         return result;
     }
     
-    private Map<String, TableMetaData> loadDefaultTables(final ShardingRule shardingRule) throws SQLException {
+    private Map<String, TableMetaData> loadDefaultTables(final ShardingRule shardingRule, final Map<String, TableMetaData> result) throws SQLException {
         Optional<String> actualDefaultDataSourceName = shardingRule.findActualDefaultDataSourceName();
         if (!actualDefaultDataSourceName.isPresent()) {
             return Collections.emptyMap();
         }
         Collection<String> tableNames = loadAllTableNames(actualDefaultDataSourceName.get());
-        Map<String, TableMetaData> result = new HashMap<>(tableNames.size(), 1);
-        for (String each : tableNames) {
-            result.put(each, load(each, shardingRule));
+        removeRepeatTable(tableNames, result);
 
 Review comment:
   If there are two tables with the same name `t1` and different structures in ds0 and default ds seperately, do you think removeRepeatTable() could return correct result list?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services