Use the source command to load SQL files and create sharding rules. Some of them will be ignored
See original GitHub issueWhich 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:
source [file path]
5.View the created sharding rules
show sharding table rules;
You will find that some rules are not created successfully.
6.Add code between rules creation
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
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))))
);
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Using Oracle Data Pump to Migrate to a Sharded Database
You can use the Oracle Data Pump utility to load the data across database shards in subsets. Data from the source database can...
Read more >Migrate and Merge MySQL Shards of Small Datasets to TiDB
Step 1. Load data sources. Create a new data source file called source1.yaml , which configures an upstream data source into DM, and...
Read more >LOAD DATA - SingleStore Documentation
If a CSV file appears to have the incorrect number of fields in any line, you can use the SKIP PARSER ERRORS option...
Read more >How do you use MySQL's source command to import large ...
Any suggestions of how to import this .sql file into MySQL either from the MySQL command line or by any other means would...
Read more >2 Server Error Message Reference - MySQL :: Developer Zone
Occurs for failure to create or copy a file needed for some operation. ... Message: The used command is not allowed with this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
@Peterosh Thanks for the feedback, after investigation, I thnink this is a concurrency issue.