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 2021/08/24 07:22:50 UTC

[GitHub] [shardingsphere] tuichenchuxin opened a new pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

tuichenchuxin opened a new pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976


   Fixes #11658.
   
   Changes proposed in this pull request:
   - refactor parallel check meta data
   - refactor `TableMetaDataLoaderEngine`
   


-- 
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



[GitHub] [shardingsphere] codecov-commenter commented on pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976#issuecomment-904485996


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#11976](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bc94c7f) into [master](https://codecov.io/gh/apache/shardingsphere/commit/ed71fb20f3fce018a38da050a9a6f68b9df16229?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ed71fb2) will **decrease** coverage by `0.03%`.
   > The diff coverage is `58.97%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11976/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #11976      +/-   ##
   ============================================
   - Coverage     63.13%   63.09%   -0.04%     
   + Complexity     1235     1234       -1     
   ============================================
     Files          2293     2293              
     Lines         34869    34847      -22     
     Branches       6063     6058       -5     
   ============================================
   - Hits          22015    21988      -27     
   - Misses        11074    11080       +6     
   + Partials       1780     1779       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ema/builder/loader/DefaultTableMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9sb2FkZXIvRGVmYXVsdFRhYmxlTWV0YURhdGFMb2FkZXIuamF2YQ==) | `80.00% <ø> (-0.96%)` | :arrow_down: |
   | [...etadata/schema/builder/util/TableMetaDataUtil.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci91dGlsL1RhYmxlTWV0YURhdGFVdGlsLmphdmE=) | `52.38% <0.00%> (-47.62%)` | :arrow_down: |
   | [...data/schema/builder/TableMetaDataLoaderEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9UYWJsZU1ldGFEYXRhTG9hZGVyRW5naW5lLmphdmE=) | `45.94% <50.00%> (+0.78%)` | :arrow_up: |
   | [...harding/metadata/ShardingTableMetaDataBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvbWV0YWRhdGEvU2hhcmRpbmdUYWJsZU1ldGFEYXRhQnVpbGRlci5qYXZh) | `60.60% <88.88%> (-2.62%)` | :arrow_down: |
   | [...esher/type/AlterTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQWx0ZXJUYWJsZVN0YXRlbWVudFNjaGVtYVJlZnJlc2hlci5qYXZh) | `93.75% <100.00%> (-0.99%)` | :arrow_down: |
   | [...sher/type/CreateTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQ3JlYXRlVGFibGVTdGF0ZW1lbnRTY2hlbWFSZWZyZXNoZXIuamF2YQ==) | `87.50% <100.00%> (-3.41%)` | :arrow_down: |
   | [...caling/core/common/datasource/MetaDataManager.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9jb21tb24vZGF0YXNvdXJjZS9NZXRhRGF0YU1hbmFnZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ed71fb2...bc94c7f](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [shardingsphere] tristaZero merged pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976


   


-- 
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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976#discussion_r695325018



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoaderEngine.java
##########
@@ -41,44 +41,47 @@
 import java.util.concurrent.TimeUnit;
 
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
 public final class TableMetaDataLoaderEngine {
 
     private static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2, Runtime.getRuntime().availableProcessors() * 2,
             0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ShardingSphere-TableMetaDataLoaderEngine-%d").build());
-    
+
     /**
      * Load table meta data.
      *
-     * @param dataSourceTable data source and table name collection map
-     * @param databaseType database type
-     * @param dataSourceMap data source map
+     * @param materials TableMetaDataLoadMaterials
      * @return table meta data collection
      * @throws SQLException SQL exception
      */
-    public static Collection<TableMetaData> load(final Map<String, Collection<String>> dataSourceTable, final DatabaseType databaseType,
-                                                 final Map<String, DataSource> dataSourceMap) throws SQLException {
-        Optional<DialectTableMetaDataLoader> dialectTableMetaDataLoader = findDialectTableMetaDataLoader(databaseType);
-        return dialectTableMetaDataLoader.isPresent() ? loadByDialect(dialectTableMetaDataLoader.get(), dataSourceTable, dataSourceMap)
-                : loadByDefault(dataSourceTable, databaseType, dataSourceMap);
+    public static Collection<TableMetaData> load(final TableMetaDataLoadMaterials materials) throws SQLException {
+        Optional<DialectTableMetaDataLoader> dialectTableMetaDataLoader = findDialectTableMetaDataLoader(materials.getDatabaseType());
+        if (dialectTableMetaDataLoader.isPresent()) {
+            try {
+                return loadByDialect(dialectTableMetaDataLoader.get(), materials);
+            } catch (final SQLException | ShardingSphereException ex) {
+                log.warn("dialect load error", ex);

Review comment:
       @tuichenchuxin Please use log.error.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoadMaterials.java
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.metadata.schema.builder;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+
+import javax.sql.DataSource;
+import java.util.Collection;
+
+/**
+ * TableMetaData load materials.
+ */
+@RequiredArgsConstructor
+@Getter
+public class TableMetaDataLoadMaterials {
+    
+    private final Collection<LoadMaterial> loadMaterials;
+    
+    private final DatabaseType databaseType;
+    
+    @RequiredArgsConstructor
+    @Getter
+    public static class LoadMaterial {

Review comment:
       @tuichenchuxin Can we remove this inner class? And extract its filed to TableMetaDataLoadMaterials?

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoaderEngine.java
##########
@@ -41,44 +41,47 @@
 import java.util.concurrent.TimeUnit;
 
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
+@Slf4j
 public final class TableMetaDataLoaderEngine {
 
     private static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2, Runtime.getRuntime().availableProcessors() * 2,
             0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ShardingSphere-TableMetaDataLoaderEngine-%d").build());
-    

Review comment:
       @tuichenchuxin Please keep this space.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoadMaterials.java
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.metadata.schema.builder;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+
+import javax.sql.DataSource;
+import java.util.Collection;
+
+/**
+ * TableMetaData load materials.
+ */
+@RequiredArgsConstructor
+@Getter
+public class TableMetaDataLoadMaterials {

Review comment:
       @tuichenchuxin Please add final for this class and subclass.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/util/TableMetaDataUtil.java
##########
@@ -36,13 +43,42 @@
 public class TableMetaDataUtil {
     
     /**
-     * Get data source actual table groups.
+     * Get table meta data load materials.
      *
      * @param tableNames table name collection
      * @param materials materials
-     * @return datasource and table collection map
+     * @return TableMetaDataLoadMaterials
      */
-    public static Map<String, Collection<String>> getDataSourceActualTableGroups(final Collection<String> tableNames, final SchemaBuilderMaterials materials) {
+    public static Optional<TableMetaDataLoadMaterials> getTableMetaDataLoadMaterials(final Collection<String> tableNames, final SchemaBuilderMaterials materials) {
+        Map<String, Collection<String>> dataSourceTables = getDataSourceTableGroups(tableNames, materials);
+        return buildTableMetaDataLoadMaterials(materials, dataSourceTables);
+    }
+    
+    /**
+     * Get all actual table meta data load materials.
+     *
+     * @param tableNames table name collection
+     * @param materials materials
+     * @return TableMetaDataLoadMaterials
+     */
+    public static Optional<TableMetaDataLoadMaterials> getAllTableMetaDataLoadMaterials(final Collection<String> tableNames, final SchemaBuilderMaterials materials) {
+        Map<String, Collection<String>> dataSourceTables = getAllDataSourceTableGroups(tableNames, materials);
+        return buildTableMetaDataLoadMaterials(materials, dataSourceTables);
+    }
+    
+    /**
+     * get table meta data load materials by one table.
+     *
+     * @param dataSource data source
+     * @param tableName table name
+     * @param databaseType database type
+     * @return TableMetaDataLoadMaterials
+     */
+    public static TableMetaDataLoadMaterials getTableMetaDataLoadMaterialsByOneTable(final DataSource dataSource, final String tableName, final DatabaseType databaseType) {

Review comment:
       @tuichenchuxin Can these similar methods be combined into one 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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976#issuecomment-904485996


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#11976](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (dea8b07) into [master](https://codecov.io/gh/apache/shardingsphere/commit/ed71fb20f3fce018a38da050a9a6f68b9df16229?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ed71fb2) will **decrease** coverage by `0.04%`.
   > The diff coverage is `56.52%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11976/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #11976      +/-   ##
   ============================================
   - Coverage     63.13%   63.08%   -0.05%     
   + Complexity     1235     1226       -9     
   ============================================
     Files          2293     2294       +1     
     Lines         34869    34877       +8     
     Branches       6063     6068       +5     
   ============================================
   - Hits          22015    22003      -12     
   - Misses        11074    11091      +17     
   - Partials       1780     1783       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ema/builder/loader/DefaultTableMetaDataLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9sb2FkZXIvRGVmYXVsdFRhYmxlTWV0YURhdGFMb2FkZXIuamF2YQ==) | `80.00% <ø> (-0.96%)` | :arrow_down: |
   | [...etadata/schema/builder/util/TableMetaDataUtil.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci91dGlsL1RhYmxlTWV0YURhdGFVdGlsLmphdmE=) | `58.06% <35.00%> (-41.94%)` | :arrow_down: |
   | [...data/schema/builder/TableMetaDataLoaderEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9UYWJsZU1ldGFEYXRhTG9hZGVyRW5naW5lLmphdmE=) | `41.66% <46.15%> (-3.50%)` | :arrow_down: |
   | [.../encrypt/metadata/EncryptTableMetaDataBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZW5jcnlwdC9zaGFyZGluZ3NwaGVyZS1lbmNyeXB0LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VuY3J5cHQvbWV0YWRhdGEvRW5jcnlwdFRhYmxlTWV0YURhdGFCdWlsZGVyLmphdmE=) | `88.88% <50.00%> (-7.12%)` | :arrow_down: |
   | [...ata/schema/builder/SingleTableMetaDataBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvYnVpbGRlci9TaW5nbGVUYWJsZU1ldGFEYXRhQnVpbGRlci5qYXZh) | `61.53% <50.00%> (-11.19%)` | :arrow_down: |
   | [...harding/metadata/ShardingTableMetaDataBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvbWV0YWRhdGEvU2hhcmRpbmdUYWJsZU1ldGFEYXRhQnVpbGRlci5qYXZh) | `57.14% <75.00%> (-6.08%)` | :arrow_down: |
   | [...esher/type/AlterTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQWx0ZXJUYWJsZVN0YXRlbWVudFNjaGVtYVJlZnJlc2hlci5qYXZh) | `93.75% <100.00%> (-0.99%)` | :arrow_down: |
   | [...sher/type/CreateTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQ3JlYXRlVGFibGVTdGF0ZW1lbnRTY2hlbWFSZWZyZXNoZXIuamF2YQ==) | `87.50% <100.00%> (-3.41%)` | :arrow_down: |
   | [...caling/core/common/datasource/MetaDataManager.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9jb21tb24vZGF0YXNvdXJjZS9NZXRhRGF0YU1hbmFnZXIuamF2YQ==) | `100.00% <100.00%> (ø)` | |
   | [...nerator/impl/ShadowInsertColumnTokenGenerator.java](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcmV3cml0ZS90b2tlbi9nZW5lcmF0b3IvaW1wbC9TaGFkb3dJbnNlcnRDb2x1bW5Ub2tlbkdlbmVyYXRvci5qYXZh) | `73.91% <0.00%> (-1.09%)` | :arrow_down: |
   | ... and [58 more](https://codecov.io/gh/apache/shardingsphere/pull/11976/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ed71fb2...dea8b07](https://codecov.io/gh/apache/shardingsphere/pull/11976?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11976: refactor parallel check meta data, refactor TableMetaDataLoaderEngine.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #11976:
URL: https://github.com/apache/shardingsphere/pull/11976#discussion_r694590326



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoaderEngine.java
##########
@@ -46,6 +47,21 @@
     private static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2, Runtime.getRuntime().availableProcessors() * 2,
             0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ShardingSphere-TableMetaDataLoaderEngine-%d").build());
     
+    /**
+     * Load table meta data.
+     *
+     * @param dataSource data source
+     * @param tableName table name
+     * @param databaseType database type
+     * @return table meta data
+     * @throws SQLException SQL exception
+     */
+    public static Optional<TableMetaData> load(final DataSource dataSource, final String tableName, final DatabaseType databaseType) throws SQLException {
+        Map<String, Collection<String>> dataSourceTable = Collections.singletonMap("ds", Collections.singleton(tableName));

Review comment:
       @tuichenchuxin Please don't hard code here.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/util/TableMetaDataUtil.java
##########
@@ -55,4 +58,24 @@
         }
         return result;
     }
+    
+    /**
+     * Get data source all actual table groups.
+     *
+     * @param tableNames table name collection
+     * @param materials materials
+     * @return datasource and table collection map
+     */
+    public static Map<String, Collection<String>> getDataSourceAllActualTableGroups(final Collection<String> tableNames, final SchemaBuilderMaterials materials) {

Review comment:
       @tuichenchuxin You may consider publishing a community task to add test cases for TableMetaDataUtil.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/TableMetaDataLoaderEngine.java
##########
@@ -58,8 +74,14 @@
     public static Collection<TableMetaData> load(final Map<String, Collection<String>> dataSourceTable, final DatabaseType databaseType,
                                                  final Map<String, DataSource> dataSourceMap) throws SQLException {
         Optional<DialectTableMetaDataLoader> dialectTableMetaDataLoader = findDialectTableMetaDataLoader(databaseType);
-        return dialectTableMetaDataLoader.isPresent() ? loadByDialect(dialectTableMetaDataLoader.get(), dataSourceTable, dataSourceMap)
-                : loadByDefault(dataSourceTable, databaseType, dataSourceMap);
+        if (dialectTableMetaDataLoader.isPresent()) {
+            try {
+                return loadByDialect(dialectTableMetaDataLoader.get(), dataSourceTable, dataSourceMap);
+            } catch (SQLException e) {
+                return loadByDefault(dataSourceTable, databaseType, dataSourceMap);

Review comment:
       @tuichenchuxin Please print out the exception information and modify the exception variables.




-- 
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