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  ### Reason analyze (If you can) According to debugging, the transaction engines of two local data sources are mutually exclusive:  ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
