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/04/07 06:11:09 UTC

[GitHub] [shardingsphere] tristaZero opened a new issue #9964: Refactor DistSQL for Resource/DB recovery/Sharding/Read write splitting rules

tristaZero opened a new issue #9964:
URL: https://github.com/apache/shardingsphere/issues/9964


   Hi,
   
   Although we have finished the basic process for these rules, there are more reasonable and expressive distributed-SQL. Here is the new draft for them.
   
   ## RESOURCE
   
   1. Add
   ```sql
   ADD RESOURCE resource0 (
   HOST=127.0.0.1,
   PORT=3306,
   DB=db0,
   USER=root,
   (PASSWORD=root)?
   )
   ```
   
   2. Drop resource
   ```sql
   DROP RESOURCE resource0, resource1
   ```
   
   4. Show resources
   ```sql
   SHOW RESOURCES (FROM schemaName)?
   ```
   
   ## DB_DISCOVERY
   
   1. Create
   ```sql
   CREATE DB_DISCOVERY RULE ha_group_0 (
   RESOURCES(resource0,resource1),
   TYPE(NAME=mgr,PROPERTIES(groupName="92504d5b-6dec",keepAliveCron=""),
   PROPERTIES(connectionTimeout=10)
   )
   ```
   
   2. Alter
   ```sql
   ALTER DB_DISCOVERY RULE ha_group_0 (
   RESOURCES(resource0,resource1),
   TYPE(NAME=mgr,PROPERTIES(groupName="92504d5b-6dec" ,keepAliveCron=""),
   PROPERTIES(connectionTimeout=100)
   )
   ```
   
   3. Drop
   ```sql
   DROP DB_DISCOVERY RULE ha_group_0, ha_group_1
   ```
   
   4. Show
   ```sql
   SHOW DB_DISCOVERY RULES (FROM schemaName)?
   ```
   
   ## READ_WRITE_SPLITTING
   
   1. Create
   ```sql
   // Static
   CREATE READ_WRITE_SPLITTING RULE ms_group_0 (
   WRITE_RESOURCE=primary_ds,
   READ_RESOURCES(replica_ds_0,replica_ds_1),
   TYPE(NAME=random)
   )
   
   // Dynamic, joining with DB_DISCOVERY RULE
   CREATE READ_WRITE_SPLITTING RULE ms_group_1 (
   AUTO_AWARE_RESOURCE=group_0,
   TYPE(NAME=random,PROPERTIES(read_weight=2:1))
   )
   ```
   
   2. Alter 
   ```sql
   ALTER READ_WRITE_SPLITTING RULE ms_group_1 (
   WRITE_RESOURCE=primary_ds,
   READ_RESOURCES(replica_ds_0,replica_ds_1,replica_ds_2),
   TYPE(NAME=random PROPERTIES(read_weight=2:0))
   )
   ```
   
   3. Drop  
   ```sql
   DROP READ_WRITE_SPLITTING RULE ms_group_1
   ```
   
   4. Show  
   ```sql
   SHOW READ_WRITE_SPLITTING RULES (FROM schemaName)?
   ```
   
   ## SHARDING
   
   1. Create
   
   ```sql
   CREATE SHARDING TABLE RULE t_order (
   RESOURCES(ms_group_0,ms_group_1),
   SHARDING_COLUMN=order_id,
   TYPE(NAME=hash_mod,PROPERTIES(sharding-count=4)),
   GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(worker-id=123))
   )
   
   CREATE SHARDING TABLE RULE t_order_item (
   SHARDING_COLUMN=item_id,
   TYPE(NAME=mod,PROPERTIES(sharding-count=10))
   )
   
   CREATE SHARDING BINDING TABLE RULES (
   binding_rule_1(t_order,t_order_item),
   binding_rule_2(t_1,t_2)
   )
   
   CREATE SHARDING BROADCAST TABLE RULES (t_b,t_a)
   ```
   
   2. Alter
   ```sql
   ALTER SHARDING TABLE RULE t_order (
   RESOURCES(ds0,ds1,ds2),
   SHARDING_COLUMN(order_id),
   TYPE(NAME=hash_mod,PROPERTIES(sharding-count=40)),
   GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(worker-id=123))
   )
   
   ALTER SHARDING BINDING TABLE RULES (
   MODIFY binding_rule_1(t_order,t_order_item,t_3),
   DROP binding_rule_2
   )
   
   ALTER SHARDING BROADCAST TABLE RULES (t_b,t_a,t_3)
   ```
   
   3. Drop
   ```sql
   DROP SHARDING TABLE RULE t_order
   
   DROP SHARDING BINDING TABLE RULES
   
   DROP SHARDING BROADCAST TABLE RULES
   
   ```
   
   4. Show
   ```sql
   
   SHOW SHARDING TABLE RULES (FROM schemaName)
   
   SHOW SHARDING TABLE RULE t_order
   
   SHOW SHARDING BINDING TABLE RULES
   
   SHOW SHARDING BROADCAST TABLE RULES
   ```


-- 
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] menghaoranss commented on issue #9964: Refactor DistSQL for Resource/DB recovery/Sharding/Read write splitting rules

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


   In order to make the configuration of RDL and YAML consistent,the rule name of bindig table rules should be removed: 
   ```
   CREATE SHARDING BINDING TABLE RULES (
   (t_order,t_order_item),
   (t_1,t_2)
   )
   
   
   ALTER SHARDING BINDING TABLE RULES (
   (t_order,t_order_item,t_3)
   )
   ```


-- 
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] menghaoranss commented on issue #9964: Refactor DistSQL for Resource/DB recovery/Sharding/Read write splitting rules

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


   Completed


-- 
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] menghaoranss closed issue #9964: Refactor DistSQL for Resource/DB recovery/Sharding/Read write splitting rules

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


   


-- 
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] menghaoranss commented on issue #9964: Refactor DistSQL for Resource/DB recovery/Sharding/Read write splitting rules

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


   Repeatability check of `dataSourceName` for `ADD RESOURCE` should be added


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