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/08/12 06:20:41 UTC
[GitHub] [shardingsphere] JiekerTime opened a new issue #11781: The governance functions of jdbc are not available locally
JiekerTime opened a new issue #11781:
URL: https://github.com/apache/shardingsphere/issues/11781
### Which version of ShardingSphere did you use?
5.0.0-RC1-SNAPSHOT
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
Two jdbc data sources share a single configuration file, database, and governance center to start normally.
### Actual behavior
![image](https://user-images.githubusercontent.com/76552510/129146819-4a9a1445-3bb9-4a6a-8486-c1f4e3afdd91.png)
### Reason analyze (If you can)
According to debugging, the transaction engines of two local data sources are mutually exclusive:
![0d2d91225ef4f38e45660e2252382f4](https://user-images.githubusercontent.com/76552510/129146918-fad8392b-2042-4a2e-b6c8-f3b15aee1f14.png)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
The first method is that you can reproduce according to the jdbc governance module in the integration test, which is more complicated.
The second way is to reproduce the problem by starting the following procedure:
```
public class JdbcTest1 {
public static void main(String[] args) {
try {
DataSource dataSource = YamlGovernanceShardingSphereDataSourceFactory.createDataSource(new File("sharding-databases-tables.yaml"));
for (int i = 0; i < 5; i++) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.execute("SELECT 1");
Thread.sleep(10000);
}
}
} catch (SQLException | IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
public class JdbcTest2 {
public static void main(String[] args) {
try {
DataSource dataSource = YamlGovernanceShardingSphereDataSourceFactory.createDataSource(new File("sharding-databases-tables.yaml"));
for (int i = 0; i < 5; i++) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.execute("SELECT 1");
Thread.sleep(10000);
}
}
} catch (SQLException | IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
```
Related configuration:
```
governance:
registryCenter:
type: ZooKeeper
namespace: governance_ds
serverLists: localhost:2181
props:
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
overwrite: true
dataSources:
ds_0:
jdbcUrl: jdbc:mysql://localhost:3306/db_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_1:
jdbcUrl: jdbc:mysql://localhost:3306/db_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_2:
jdbcUrl: jdbc:mysql://localhost:3306/db_2?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_3:
jdbcUrl: jdbc:mysql://localhost:3306/db_3?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_4:
jdbcUrl: jdbc:mysql://localhost:3306/db_4?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_5:
jdbcUrl: jdbc:mysql://localhost:3306/db_5?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_6:
jdbcUrl: jdbc:mysql://localhost:3306/db_6?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_7:
jdbcUrl: jdbc:mysql://localhost:3306/db_7?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_8:
jdbcUrl: jdbc:mysql://localhost:3306/db_8?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
ds_9:
jdbcUrl: jdbc:mysql://localhost:3306/db_9?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
username: root
password: 123456
maxPoolSize: 2
rules:
- !SHARDING
tables:
t_order:
actualDataNodes: ds_${0..9}.t_order
t_order_item:
actualDataNodes: ds_${0..9}.t_order_item
t_order_details:
actualDataNodes: ds_${0..9}.t_order_details
broadcastTables:
- t_broadcast_table
shardingAlgorithms:
standard_test:
type: STANDARD_TEST
keyGenerators:
constant:
type: CONSTANT
```
### Example codes for reproduce this issue (such as a github link).
--
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] menghaoranss closed issue #11781: The governance functions of jdbc are not available locally
Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #11781:
URL: https://github.com/apache/shardingsphere/issues/11781
--
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] menghaoranss closed issue #11781: The governance functions of jdbc are not available locally
Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #11781:
URL: https://github.com/apache/shardingsphere/issues/11781
--
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