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/06/10 06:58:24 UTC

[GitHub] [shardingsphere] Peterosh opened a new issue, #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   ### Which version of ShardingSphere did you use?
    - ShardingSphere-Proxy 5.1.1.       
    - mysql 8.0.25
   
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy 
   ### Expected behavior
   Execute all sql code
   ### Actual behavior
   Some of them will be ignored
   ### Reason analyze (If you can)
   Asynchronous problem
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1.write sharding rules (distsql) and save a file.
   2. login mysql.
   3. create database and use it.
   4. input command:
   ```sql
   source [file path]
   ``` 
   5.View the created sharding rules
   ```sql
    show sharding table rules;
   ```
   You will find that some rules are not created successfully.
   
   6.Add code between rules creation
   ```sql
   The select sleep (0.1);
   ```
   Repeating the above process solves the problem
   ### Example codes for reproduce this issue (such as a github link).
   The files that need to be executed are as follows
   ```sql
   ADD RESOURCE test_0 (
       HOST=127.0.0.1,
       PORT=3306,
       DB=test_0,
       USER=root,
       PASSWORD=root
   ),test_1 (
       HOST=127.0.0.1,
       PORT=3306,
       DB=test_1,
       USER=root,
       PASSWORD=root
   );
   
   CREATE DEFAULT SINGLE TABLE RULE RESOURCE = test_0;
   
   CREATE SHARDING TABLE RULE test1 (
   DATANODES("test_${0..1}.test1"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   CREATE SHARDING TABLE RULE test2 (
   DATANODES("test_${0..1}.test2"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   CREATE SHARDING TABLE RULE test3(
   DATANODES("test_${0..1}.test3"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   CREATE SHARDING TABLE RULE test4 (
   DATANODES("test_${0..1}.test4"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   CREATE SHARDING TABLE RULE test5 (
   DATANODES("test_${0..1}.test5"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   CREATE SHARDING TABLE RULE test6 (
   DATANODES("test_${0..1}.test6"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   CREATE SHARDING TABLE RULE test7 (
   DATANODES("test_${0..1}.test7"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   CREATE SHARDING TABLE RULE test8 (
   DATANODES("test_${0..1}.test8"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   CREATE SHARDING TABLE RULE test9 (
   DATANODES("test_${0..1}.test9"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   CREATE SHARDING TABLE RULE test10 (
   DATANODES("test_${0..1}.test10"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   ```


-- 
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] github-actions[bot] closed issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored
URL: https://github.com/apache/shardingsphere/issues/18279


-- 
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] Peterosh commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   I gave it a try and it didn't work out.I defined 27 rules, but only 21 were created.
   ![image](https://user-images.githubusercontent.com/18716577/175851823-57b7fda3-9c26-450d-ba68-4713c34d761e.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.

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

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


[GitHub] [shardingsphere] Peterosh commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   there is not find any exception thrown.SHARDING TABLE RULE is not fully implemented。
   Here's my solution right now
   ```
   ADD RESOURCE test_0 (
       HOST=127.0.0.1,
       PORT=3306,
       DB=test_0,
       USER=root,
       PASSWORD=root
   ),test_1 (
       HOST=127.0.0.1,
       PORT=3306,
       DB=test_1,
       USER=root,
       PASSWORD=root
   );
   
   CREATE DEFAULT SINGLE TABLE RULE RESOURCE = test_0;
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test1 (
   DATANODES("test_${0..1}.test1"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test2 (
   DATANODES("test_${0..1}.test2"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test3(
   DATANODES("test_${0..1}.test3"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test4 (
   DATANODES("test_${0..1}.test4"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test5 (
   DATANODES("test_${0..1}.test5"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test6 (
   DATANODES("test_${0..1}.test6"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test7 (
   DATANODES("test_${0..1}.test7"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test8 (
   DATANODES("test_${0..1}.test8"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test9 (
   DATANODES("test_${0..1}.test9"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   
   The select sleep (1);
   CREATE SHARDING TABLE RULE test10 (
   DATANODES("test_${0..1}.test10"),
   DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=PlayerID,SHARDING_ALGORITHM(TYPE(NAME=BOUNDARY_RANGE,PROPERTIES("sharding-ranges"=20001))))
   );
   ```
   


-- 
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 commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   Any exception thrown?


-- 
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 commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   Hi @Peterosh 
   This may be caused by frequent metadata modification. 
   ShardingSphere 5.1.2 adds a lock to protect this scenario, you can try the latest version.


-- 
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 closed issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

Posted by GitBox <gi...@apache.org>.
RaigorJiang closed issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored
URL: https://github.com/apache/shardingsphere/issues/18279


-- 
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 #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #18279:
URL: https://github.com/apache/shardingsphere/issues/18279#issuecomment-1272349642

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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 commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   Duplicate with #17704.


-- 
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 commented on issue #18279: Use the source command to load SQL files and create sharding rules. Some of them will be ignored

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

   @Peterosh 
   Thanks for the feedback, after investigation, I thnink this is a concurrency 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