strongduanmu opened a new issue, #17887: URL: https://github.com/apache/shardingsphere/issues/17887
## Bug Report ### Which version of ShardingSphere did you use? https://github.com/apache/shardingsphere/commit/0162b7ef9fd740f2d371336c487ac471aea20a91 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior Metadata load correctly when execute `refresh table metadata` statement ### Actual behavior Metadata lost. The actual public schema contains more than 80 tables, and when I finish `refresh table metadata`, there are only two tables. <img width="1475" alt="image" src="https://user-images.githubusercontent.com/10829171/169936713-65b28ea3-fe35-44dd-8bd0-6c947ee10b4f.png"> ### Reason analyze (If you can) Wrong schemaName value, causing metadata to be overwritten. ```java /** * Reload meta data. * * @param databaseName database name to be reloaded * @param schemaName schema name to be reloaded */ public void reloadMetaData(final String databaseName, final String schemaName) { try { Map<String, ShardingSphereSchema> schemas = loadActualSchema(databaseName, schemaName); alterSchemas(databaseName, schemas); for (ShardingSphereSchema each : schemas.values()) { metaDataContexts.getPersistService().ifPresent(optional -> optional.getSchemaMetaDataService().persistTables(databaseName, schemaName, each)); } } catch (final SQLException ex) { log.error("Reload database:{} meta data of schema:{} failed", databaseName, schemaName, ex); } } ``` ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. ### Example codes for reproduce this issue (such as a github link). -- 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]
