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 2020/01/20 08:30:06 UTC

[GitHub] [incubator-shardingsphere] KomachiSion opened a new issue #4047: ConfigurationLogger can't log none sharding strategy

KomachiSion opened a new issue #4047: ConfigurationLogger can't log none sharding strategy
URL: https://github.com/apache/incubator-shardingsphere/issues/4047
 
 
   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   4.0.0
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   
   Sharding-JDBC
   
   ### Expected behavior
   
   ConfigurationLogger log none sharding strategy when it be set.
   
   ### Actual behavior
   
   ConfigurationLogger can't log none sharding strategy correctly.
   
   ### Reason analyze (If you can)
   
   There are two reason cause this problem:
   1. `ShardingStrategyConfigurationYamlSwapper` do not handle `NoneShardingStrategyConfiguration`
   2. `DefaultYamlRepresenter` ignore all null, empty collection and empty map.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ```java
       private static void printToYaml() {
           YamlShardingRuleConfiguration yamlShardingRuleConfiguration = getYamlShardingRuleConfiguration();
           ConfigurationLogger.log(yamlShardingRuleConfiguration.getClass().getName(), YamlEngine.marshal(yamlShardingRuleConfiguration));
       }
   
       private static YamlShardingRuleConfiguration getYamlShardingRuleConfiguration() {
           YamlShardingRuleConfiguration result = new YamlShardingRuleConfiguration();
           YamlTableRuleConfiguration yamlTableRuleConfiguration = getYamlTableRuleConfiguration();
           result.getTables().put("t_order", yamlTableRuleConfiguration);
           return result;
       }
   
       private static YamlTableRuleConfiguration getYamlTableRuleConfiguration() {
           YamlTableRuleConfiguration result = new YamlTableRuleConfiguration();
           YamlShardingStrategyConfiguration database = new YamlShardingStrategyConfiguration();
           YamlInlineShardingStrategyConfiguration inline = new YamlInlineShardingStrategyConfiguration();
           inline.setAlgorithmExpression("ds_${user_id % 2}");
           inline.setShardingColumn("user_id");
           database.setInline(inline);
           result.setDatabaseStrategy(database);
           YamlShardingStrategyConfiguration table = new YamlShardingStrategyConfiguration();
           table.setNone(new YamlNoneShardingStrategyConfiguration());
           result.setTableStrategy(table);
           return result;
       }
   ```
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu closed issue #4047: ConfigurationLogger can't log none sharding strategy

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #4047: ConfigurationLogger can't log none sharding strategy
URL: https://github.com/apache/incubator-shardingsphere/issues/4047
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services