Skip to content

Refactor single table meta data load#11895

Merged
tristaZero merged 19 commits intoapache:masterfrom
tuichenchuxin:refactor_meta_data_load
Aug 20, 2021
Merged

Refactor single table meta data load#11895
tristaZero merged 19 commits intoapache:masterfrom
tuichenchuxin:refactor_meta_data_load

Conversation

@tuichenchuxin
Copy link
Contributor

Fixes #11718.

Changes proposed in this pull request:

  • refactor single table load meta data.
  • refactor TableMetaDataBuilder TableMetaDataLoader
  • add test case

…load

# Conflicts:
#	shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/loader/dialect/OracleTableMetaDataLoader.java
@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2021

Codecov Report

Merging #11895 (0c24c7f) into master (dcc1d36) will increase coverage by 0.07%.
The diff coverage is 78.63%.

❗ Current head 0c24c7f differs from pull request most recent head 6b2689a. Consider uploading reports for the commit 6b2689a to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11895      +/-   ##
============================================
+ Coverage     62.94%   63.01%   +0.07%     
- Complexity     1216     1228      +12     
============================================
  Files          2296     2302       +6     
  Lines         34891    34870      -21     
  Branches       6071     6059      -12     
============================================
+ Hits          21961    21974      +13     
+ Misses        11148    11114      -34     
  Partials       1782     1782              
Impacted Files Coverage Δ
...ema/builder/loader/DefaultTableMetaDataLoader.java 80.95% <ø> (ø)
...data/schema/builder/TableMetaDataLoaderEngine.java 45.16% <45.16%> (ø)
...ata/schema/builder/SingleTableMetaDataBuilder.java 72.72% <72.72%> (ø)
...ilder/loader/dialect/MySQLTableMetaDataLoader.java 86.53% <80.00%> (+6.18%) ⬆️
...harding/metadata/ShardingTableMetaDataBuilder.java 62.79% <83.33%> (+3.33%) ⬆️
...lder/loader/dialect/OracleTableMetaDataLoader.java 85.91% <87.50%> (+7.24%) ⬆️
.../metadata/schema/builder/TableMetaDataBuilder.java 86.36% <88.88%> (-2.53%) ⬇️
.../builder/loader/dialect/H2TableMetaDataLoader.java 86.90% <90.90%> (+8.25%) ⬆️
.../encrypt/metadata/EncryptTableMetaDataBuilder.java 96.00% <100.00%> (+3.89%) ⬆️
...e/infra/metadata/schema/builder/SchemaBuilder.java 90.90% <100.00%> (+19.28%) ⬆️
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 268301e...6b2689a. Read the comment docs.

@strongduanmu strongduanmu added this to the 5.0.0-RC1 milestone Aug 19, 2021
@tuichenchuxin tuichenchuxin changed the title Refactor meta data load Refactor single table meta data load Aug 19, 2021
private Optional<TableMetaData> loadTableByDataNode(final DataNode dataNode, final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
try {
return TableMetaDataLoader.load(dataSourceMap.get(dataNode.getDataSourceName()), dataNode.getTableName(), databaseType);
return DefaultTableMetaDataLoader.load(dataSourceMap.get(dataNode.getDataSourceName()), dataNode.getTableName(), databaseType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuichenchuxin Is it possible to use TableMetaDataLoaderEngine to load?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuichenchuxin Is it possible to use TableMetaDataLoaderEngine to load?

At present, there are still some scenarios where DefaultTableMetaDataLoader.load is called separately, which has a lot of impact and has not been modified for the time being. In the future, the logic needs to be unified into the TableMetaDataLoaderEngine.

@tristaZero tristaZero merged commit 632b7c7 into apache:master Aug 20, 2021
@tuichenchuxin tuichenchuxin deleted the refactor_meta_data_load branch August 20, 2021 07:55
@menghaoranss menghaoranss modified the milestones: 5.0.0-RC1, 5.0.0 Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SchemaBuilder#build performance improvement

5 participants