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/04/13 14:44:28 UTC

[GitHub] [incubator-shardingsphere] TaoZhiMLND opened a new issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

TaoZhiMLND opened a new issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168
 
 
   Hi community,
   
   ShardingKeyGenerator configuration on spring namespace  is like this now,
   ```
   <bean id="incrementAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean">   
      <property name="type" value="INCREMENT" />   
   </bean>   
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   The following configuration will hide KeyGenerateAlgorithmFactoryBean may be more simplified,
   ```
   <sharding:key-generate-algorithm id="incrementAlgorithm" type="INCREMENT"/>
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   But element `<sharding:key-generate-algorithm>` has some strange for keyGenerateAlgorithm itself has nothing to do with Sharding. Besides, the elements `<key-generate-algorithm>` and `<key-generator>` has a duplicate word.
   
   Do we need to make any changes to simplify this configuration? I will really appreciate any help on this. Thanks.

----------------------------------------------------------------
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] cherrylzhao commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613777350
 
 
   the final api have changed to `<spi:key-generate-algorithm id="incrementAlgorithm" type="INCREMENT" props-ref="xxx"/>`, please don't forget revise the example and docs later

----------------------------------------------------------------
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] tristaZero edited a comment on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613183666
 
 
   Hi I prefer the second one @kimmking mentioned, i.e,
   > <sharding:key-generator id="orderKeyGenerator" column="order_id"  type="INCREMENT" />
   
   Firstly, IMO, it is better to hide `org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean` which id internal class of ShardingSphere from user.
   Secondly, like the picture below shows, the beans of `ShardingAlgorithm` and `KeyGenerateAlgorithm` have a similar format but with a different meaning, which is likely to confuse the user.
   
   ```xml
   <bean id="preciseModuloDatabaseShardingAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.algorithm.PreciseModuloDatabaseShardingAlgorithm" />
       <bean id="preciseModuloTableShardingAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.algorithm.PreciseModuloTableShardingAlgorithm" />
       <bean id="rangeModuloTableShardingAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.algorithm.RangeModuloTableShardingAlgorithm" />
       <bean id="defaultComplexKeysShardingAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.algorithm.DefaultComplexKeysShardingAlgorithm" />
       <bean id="defaultHintShardingAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.algorithm.DefaultHintShardingAlgorithm" />
       
   ------------------
   <bean id="incrementAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean">
           <property name="type" value="INCREMENT" />
   </bean>
   ```
   ![image](https://user-images.githubusercontent.com/27757146/79177919-76854280-7e36-11ea-97fe-c6072cb5998c.png)
   

----------------------------------------------------------------
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] TaoZhiMLND commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
TaoZhiMLND commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613220183
 
 
   > @TaoZhiMLND would you please investigate whether the FactoryBean api could simplify to this:
   > 
   > <spi:bean id="incrementAlgorithm" type="INCREMENT"/>
   > <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   
   Thanks for all lot you, and I will do it soon!

----------------------------------------------------------------
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] cherrylzhao commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613212897
 
 
   @TaoZhiMLND would you please investigate whether the FactoryBean api could simplify to this:
   
   <spi:bean id="incrementAlgorithm" type="INCREMENT"/>
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />

----------------------------------------------------------------
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] TaoZhiMLND opened a new issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
TaoZhiMLND opened a new issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168
 
 
   Hi community,
   
   ShardingKeyGenerator configuration on spring namespace  is like this now,
   ```
   <bean id="incrementAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean">   
      <property name="type" value="INCREMENT" />   
   </bean>   
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   The following configuration will hide KeyGenerateAlgorithmFactoryBean may be more simplified,
   ```
   <sharding:key-generate-algorithm id="incrementAlgorithm" type="INCREMENT"/>
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   But element `<sharding:key-generate-algorithm>` has some strange for keyGenerateAlgorithm itself has nothing to do with Sharding. Besides, the elements `<key-generate-algorithm>` and `<key-generator>` has a duplicate word.
   
   Do we need to make any changes to simplify this configuration? I will really appreciate any help on this. Thanks.

----------------------------------------------------------------
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] tristaZero edited a comment on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613183666
 
 
   Hi I prefer the second one @kimmking mentioned, i.e,
   > <sharding:key-generator id="orderKeyGenerator" column="order_id"  type="INCREMENT" />
   
   Firstly, IMO, it is better to hide `org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean` which id internal class of ShardingSphere from user.
   Secondly, like the picture below shows, the beans of `ShardingAlgorithm` and `KeyGenerateAlgorithm` have a similar format but with a different meaning, which is likely to confuse the user.
   
   ![image](https://user-images.githubusercontent.com/27757146/79177919-76854280-7e36-11ea-97fe-c6072cb5998c.png)
   

----------------------------------------------------------------
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] cherrylzhao closed issue #5168: Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao closed issue #5168: Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168
 
 
   

----------------------------------------------------------------
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] [shardingsphere] TaoZhiMLND commented on issue #5168: Simplify the configuration API of ShardingKeyGenerator on spring namespace

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


   > hi, @TaoZhiMLND please add a spi.xsd file in our [doc-repository](https://github.com/apache/shardingsphere-doc/tree/asf-site/schema/shardingsphere)
   
   done.


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



[GitHub] [incubator-shardingsphere] TaoZhiMLND commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
TaoZhiMLND commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613353344
 
 
   It works well by leveraging a BeanDefinitionParser,
   ![image](https://user-images.githubusercontent.com/9602831/79213333-968b2500-7e7b-11ea-95e3-a99a43f4f66c.png)
   
   and I will commit a pr soon.

----------------------------------------------------------------
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] cherrylzhao closed issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao closed issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168
 
 
   

----------------------------------------------------------------
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] kimmking commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-612960330
 
 
   IMO, if we need share a singleton bean, the first config style is simple enough:
   ```
   <bean id="incrementAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean">   
      <property name="type" value="INCREMENT" />   
   </bean>   
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   
   And if no need to share it, the simplest config style is:
   ``` 
   <sharding:key-generator id="orderKeyGenerator" column="order_id"  type="INCREMENT" />
   ```

----------------------------------------------------------------
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] [shardingsphere] cherrylzhao commented on issue #5168: Simplify the configuration API of ShardingKeyGenerator on spring namespace

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


   hi, @TaoZhiMLND please add a spi.xsd file in our [doc-repository](https://github.com/apache/shardingsphere-doc/tree/asf-site/schema/shardingsphere)


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



[GitHub] [incubator-shardingsphere] cherrylzhao edited a comment on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao edited a comment on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613190795
 
 
   in fact, `<sharding:key-generator id="orderKeyGenerator" column="order_id" type="INCREMENT" />` is the old api before #1997, in this way keyGenerator was instanced by ServiceLoader which could not been managed by spring-container. TaoZhiMLND and I have made many work in order to keep the old api but it is not possible to create 2 different beans in one spring tag, so we separate the KeyGeneratorAlgorithm from the <sharding:key-generator> using FactoryBean to wrap the serviceLoader as a spring bean

----------------------------------------------------------------
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] cherrylzhao commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
cherrylzhao commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613190795
 
 
   in fact, `<sharding:key-generator id="orderKeyGenerator" column="order_id" type="INCREMENT" />` is the old api before #1997, in this way keyGenerator was instanced by ServiceLoader which could been managed by spring-container. TaoZhiMLND and I have made many work in order to keep the old api but it is not possible to create 2 different beans in one spring tag, so we separate the KeyGeneratorAlgorithm from the <sharding:key-generator> using FactoryBean to wrap the serviceLoader as a spring bean

----------------------------------------------------------------
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] TaoZhiMLND opened a new issue #5168: Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
TaoZhiMLND opened a new issue #5168: Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168
 
 
   Hi community,
   
   ShardingKeyGenerator configuration on spring namespace  is like this now,
   ```
   <bean id="incrementAlgorithm" class="org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean">   
      <property name="type" value="INCREMENT" />   
   </bean>   
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   The following configuration will hide KeyGenerateAlgorithmFactoryBean may be more simplified,
   ```
   <sharding:key-generate-algorithm id="incrementAlgorithm" type="INCREMENT"/>
   
   <sharding:key-generator id="orderKeyGenerator" column="order_id" algorithm-ref="incrementAlgorithm" />
   ```
   But element `<sharding:key-generate-algorithm>` has some strange for keyGenerateAlgorithm itself has nothing to do with Sharding. Besides, the elements `<key-generate-algorithm>` and `<key-generator>` has a duplicate word.
   
   Do we need to make any changes to simplify this configuration? I will really appreciate any help on this. Thanks.

----------------------------------------------------------------
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] tristaZero commented on issue #5168: [DISCUSS] Simplify the configuration API of ShardingKeyGenerator on spring namespace

Posted by GitBox <gi...@apache.org>.
tristaZero commented on issue #5168: [DISCUSS]  Simplify the configuration  API of ShardingKeyGenerator on spring namespace
URL: https://github.com/apache/incubator-shardingsphere/issues/5168#issuecomment-613183666
 
 
   Hi I prefer the second one @kimmking mentioned, i.e,
   > <sharding:key-generator id="orderKeyGenerator" column="order_id"  type="INCREMENT" />
   
   Firstly, IMO, it is better to hide `org.apache.shardingsphere.shardingjdbc.spring.namespace.factorybean.KeyGenerateAlgorithmFactoryBean` which id internal class of ShardingSphere from user.
   Secondly, like the picture below shows, the beans of `ShardingAlgorithm` and `KeyGenerateAlgorithm` have a similar format but with a different meaning, which is likely to confuse the user.
   
   ![image](https://user-images.githubusercontent.com/27757146/79177433-5f922080-7e35-11ea-99f5-dd4d42d63c35.png)
   

----------------------------------------------------------------
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] [shardingsphere] TaoZhiMLND commented on issue #5168: Simplify the configuration API of ShardingKeyGenerator on spring namespace

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


   for everything is done, I will close this issue.


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