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 2021/06/14 07:12:00 UTC

[GitHub] [shardingsphere] No-Silver-J opened a new issue #10761: Custom Sharding Algortihm

No-Silver-J opened a new issue #10761:
URL: https://github.com/apache/shardingsphere/issues/10761


   dear teams:
   
   When I implemented a custom sub-table algorithm, I encountered a problem, as shown in the figure. The error is this exception, indicating that I did not implement the class according to the type I configured.
   However, I have already configured the full package name of the implementation class in the META-INF.SERVICES directory. I don't know how to solve this problem
   ![image](https://user-images.githubusercontent.com/45869667/121654958-d2963600-cad0-11eb-9cbb-e0ef37a6ac29.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



[GitHub] [shardingsphere] terrymanu commented on issue #10761: Custom Sharding Algortihm

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


   No enough information, I just close the 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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] terrymanu closed issue #10761: Custom Sharding Algortihm

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #10761:
URL: https://github.com/apache/shardingsphere/issues/10761


   


-- 
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] RaigorJiang edited a comment on issue #10761: Custom Sharding Algortihm

Posted by GitBox <gi...@apache.org>.
RaigorJiang edited a comment on issue #10761:
URL: https://github.com/apache/shardingsphere/issues/10761#issuecomment-863845902


   Hi @No-Silver-J 
   It is a little complicated to implement SPI, so we provided a way to define custom algorithm called `class based sharding algorithm`,  please ref to 
    - https://github.com/apache/shardingsphere/issues/8330
    - https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/configuration/built-in-algorithm/sharding/#class-based-sharding-algorithm


-- 
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] [shardingsphere] Beyondeclipse commented on issue #10761: Custom Sharding Algortihm

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


   Hi @No-Silver-J 
   It is not that difficult to implement algorithm SPI . Please try to follow this example:
   1. Create your class  implemented org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm.
   2. Create file "org.apache.shardingsphere.sharding.spi.ShardingAlgorithm" in src/main/resources/META-INF/services.
   3. Add your class with package in the file, like: "xxxx.xxx.xxxx.TableAlgorithm".
   4. config setting like this:
   `rules:
   -
     tables:
       TABLE_SHARDING_DEMO:
         actualDataNodes: demo_00${0..1}.TABLE_SHARDING_DEMO
         databaseStrategy: &demo
           standard:
             shardingColumn: demo_name
             shardingAlgorithmName: mod_2
   
     shardingAlgorithms:
       mod_2:
         type: MOD_2  # returned value of method "getType()" in your implemented class
         props:`


-- 
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] [shardingsphere] RaigorJiang commented on issue #10761: Custom Sharding Algortihm

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


   Hi @No-Silver-J 
   It is a little complicated to implement SPI, so we provided a way to define custom algorithm called `class based sharding algorithm`,  please ref to 


-- 
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] [shardingsphere] Beyondeclipse edited a comment on issue #10761: Custom Sharding Algortihm

Posted by GitBox <gi...@apache.org>.
Beyondeclipse edited a comment on issue #10761:
URL: https://github.com/apache/shardingsphere/issues/10761#issuecomment-865859554


   Hi @No-Silver-J 
   It is not that difficult to implement algorithm SPI . Please try to follow this example:
   1. Create your class  implemented org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm.
   2. Create file "org.apache.shardingsphere.sharding.spi.ShardingAlgorithm" in src/main/resources/META-INF/services.
   3. Add your class with package in the file, like: "xxxx.xxx.xxxx.TableAlgorithm".
   4. config setting like this:
   
   `
   rules:
   -
     tables:
       TABLE_SHARDING_DEMO:
         actualDataNodes: demo_00${0..1}.TABLE_SHARDING_DEMO
         databaseStrategy: &demo
           standard:
             shardingColumn: demo_name
             shardingAlgorithmName: mod_2
   
     shardingAlgorithms:
       mod_2:
         type: MOD_2  # returned value of method "getType()" in your implemented class
         props:
   `


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