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/11/26 06:41:15 UTC

[GitHub] [shardingsphere] vikiuvb opened a new issue, #22433: Decoupling of data sources from sharding rule

vikiuvb opened a new issue, #22433:
URL: https://github.com/apache/shardingsphere/issues/22433

   ## Feature Request
   
   ### Is your feature request related to a problem?
   
   When we add a new data source, the user has to update all the sharding rules to include the newly created data source.
   
   **Example:**
   
   ```
   CREATE SHARDING TABLE RULE t_orders (
     DATANODES("ds_${0..1}.t_orders"),
     DATABASE_STRATEGY(TYPE="standard", SHARDING_COLUMN=user_id, SHARDING_ALGORITHM(TYPE(NAME="inline", 
     PROPERTIES("algorithm-expression"="ds_${user_id%2}")))),
     KEY_GENERATE_STRATEGY(COLUMN=record_id, KEY_GENERATOR=snowflake_key_generator)
   );
   
   CREATE SHARDING TABLE RULE t_invoices (
     DATANODES("ds_${0..1}.t_invoices"),
     DATABASE_STRATEGY(TYPE="standard", SHARDING_COLUMN=user_id, SHARDING_ALGORITHM(TYPE(NAME="inline", 
     PROPERTIES("algorithm-expression"="ds_${user_id%2}")))),
     KEY_GENERATE_STRATEGY(COLUMN=record_id, KEY_GENERATOR=snowflake_key_generator)
   );
   ```
   
   When we add a new data source, `ds_2`, we need to update the same in both the `t_orders` and `t_invoices` sharding rules. It may look fine for a few tables, but it feels mundane for databases with hundreds of sharding rules.
   
   ### Describe the feature you would like.
   
   The problem is mainly because of the tight coupling between the sharding rule and data sources. It's ideal to have some sort of indirection between the sharding rule and data sources. 
   
   **Proposal:**
   
   Introduce a layer in the middle that can abstract the data sources.
   
   ![image](https://user-images.githubusercontent.com/13797616/204075844-b6136c08-31f1-43b2-8dea-d3dee680606c.png)
   
   
   ```
   CREATE DATASOURCE GROUP t_orders_group (
      DATANODES("ds_${0..1}")
   );
   ```
   ```
   CREATE SHARDING TABLE RULE t_orders (
     DATASOURCE_GROUP("t_orders_group.t_orders"),
     DATABASE_STRATEGY(TYPE="standard", SHARDING_COLUMN=user_id, SHARDING_ALGORITHM(TYPE(NAME="inline", 
     PROPERTIES("algorithm-expression"="ds_${user_id%2}")))),
     KEY_GENERATE_STRATEGY(COLUMN=record_id, KEY_GENERATOR=snowflake_key_generator)
   );
   ```
    


-- 
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] vikiuvb commented on issue #22433: Decoupling of data sources from sharding rule

Posted by "vikiuvb (via GitHub)" <gi...@apache.org>.
vikiuvb commented on issue #22433:
URL: https://github.com/apache/shardingsphere/issues/22433#issuecomment-1611059114

   @strongduanmu @zhaojinchao95 I noticed that the team has been working on redesigning the metadata structure. Can I start working on this? I want to ensure that we reach a consensus on the approach before I start the work. 


-- 
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] github-actions[bot] commented on issue #22433: Decoupling of data sources from sharding rule

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #22433:
URL: https://github.com/apache/shardingsphere/issues/22433#issuecomment-1656264739

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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] zhaojinchao95 commented on issue #22433: Decoupling of data sources from sharding rule

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

   The idea looks good, let's go on discussion 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