tristaZero opened a new issue #10678:
URL: https://github.com/apache/shardingsphere/issues/10678


   ### Background
   `OptimizeContextFactory` is created in the constructor of 
`StandardMetaDataContexts` with `metaDataMap`.
   If you dive into the constructor of `OptimizeContextFactory` and 
`MetaDataContextsBuilder`,  you will find both handlings of them need loading 
table metadata. Therefore, this issue is to reduce the unnecessary and 
duplicated table metadata loading.
   
   ### Expected result
   - Create `OptimizeContextFactory` in `MetaDataContextsBuilder`
   - Share the table metadata loading between `OptimizeContextFactory` and 
`Map<String, ShardingSphereMetaData>` of `StandardMetaDataContexts`
   
   ### How
   - The entrance is `buildSchema()` of `MetaDataContextsBuilder`
   - Change the result of `SchemaBuilder.build()` to `Map<ActualTableMetadata, 
LogicTableMetadata>`
   In `SchemaBuilder`,
   `addRuleConfiguredTables` returns `logicTableMetadata`. On the other hand 
`appendRemainTables(materials, result);` returns `actualTableMetadata`. So we 
need to call `load()` and `decorate()` of `TableMetaDataBuilder` respectively 
to get the acutal and logic ones.
   - Assemble `ShardingSphereSchema` using the list of logic table metadata
   - Create `OptimizeContextFactory` by the list of actual table metadata
   - Remove the deprecated constructors of `FederateSchemaMetadata` and 
`FederateTableMetadata`
   
   


-- 
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:
[email protected]


Reply via email to