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 2022/05/24 02:36:02 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue, #17887: Metadata lost when execute `refresh table metadata` statement

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] zjcnb commented on issue #17887: Metadata lost when execute `refresh table metadata` statement

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #17887:
URL: https://github.com/apache/shardingsphere/issues/17887#issuecomment-1135350838

   Thx, i will chekc it.


-- 
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 closed issue #17887: Metadata lost when execute `refresh table metadata` statement

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #17887: Metadata lost when execute `refresh table metadata` statement
URL: https://github.com/apache/shardingsphere/issues/17887


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