apache / apache/shardingsphere

The Mysql Testing Framework tests sql federation engine queries

Open
#28,895 10 comments 0 reactions 0 assignees View on GitHub
feature: SQL federation in: test
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

## Question

**For English only**, other languages will not accept.

Before asking a question, make sure you have:

- Googled your question.
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.

Hi Community, I plan to use the mysql testing framework to test federated queries to find sql that doesn't execute, but I want to make sure that the current testing methods are working.

Here is my test environment:
Mysql version:5.7.43
ShardingSphere-proxy version:master
zookeeper version:3.8.3
Os:Arch Linux

Here are my test steps:

1.Plan to create 10 databases
```
create database test_db_0;
create database test_db_1;
create database test_db_2;
create database test_db_3;
create database test_db_4;
create database test_db_5;
create database test_db_6;
create database test_db_7;
create database test_db_8;
create database test_db_9;
```
2.sharding-proxy global.yaml conf
```
mode:
type: Cluster
repository:
type: ZooKeeper
props:
namespace: poc_sharding
server-lists: 127.0.0.1:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500

sqlFederation:
sqlFederationEnabled: true
allQueryUseSQLFederation: true
executionPlanCache:
initialCapacity: 2000
maximumSize: 65535
```
3.connect to sharding-proxy
```
use mysql;
// Register mysql Data Source
REGISTER STORAGE UNIT mysql (
URL="jdbc:mysql://127.0.0.1:3304/mysql?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);
```
4.Create a test logic library
```
create database test;
```
5.Registered data source
```
use test;

REGISTER STORAGE UNIT ds_0 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_0?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_1 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_1?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_2 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_2?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_3 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_3?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_4 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_4?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_5 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_5?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_6 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_6?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_7 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_7?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_8 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_8?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);

REGISTER STORAGE UNIT ds_9 (
URL="jdbc:mysql://127.0.0.1:3304/test_db_9?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
USER="root",
PASSWORD="root",
PROPERTIES("maximumPoolSize"="10","idleTimeout"="30000")
);
```

Contributor guide

Open the contributing guide

Research direction

The issue does not name repository files, tests, or an entry point. Start by locating the MySQL testing framework and SQL Federation test coverage, then reproduce the reported setup with MySQL 5.7.43 and the supplied ShardingSphere-Proxy configuration. Done means determining whether federated queries are actually exercised and documenting or fixing the confirmed testing problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql, sql
Domain
databases, distributed-systems, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.