Loading RELEASE-NOTES.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ ### 缺陷修正 1. [ISSUE #520](https://github.com/shardingjdbc/sharding-jdbc/issues/520) 引入分表后,唯一键冲突时异常类型不再是DuplicateKeyException 1. [ISSUE #521](https://github.com/shardingjdbc/sharding-jdbc/issues/521) YAML文件中ShardingProperties设置无效 1. [ISSUE #522](https://github.com/shardingjdbc/sharding-jdbc/issues/522) 读写分离Slave库不需要执行DDL语句 ## 2.0.1 Loading sharding-jdbc-core/src/main/java/io/shardingjdbc/core/jdbc/core/connection/MasterSlaveConnection.java +2 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public final class MasterSlaveConnection extends AbstractConnectionAdapter { /** * Get database connections via SQL type. * * <p>DDL will return all connections; DQL will return slave connection; DML or updated before in same thread will return master connection.</p> * <p>DDL will return master connection; DQL will return slave connection; DML or updated before in same thread will return master connection.</p> * * @param sqlType SQL type * @return database connections via SQL type Loading @@ -59,7 +59,7 @@ public final class MasterSlaveConnection extends AbstractConnectionAdapter { */ public Collection<Connection> getConnections(final SQLType sqlType) throws SQLException { cachedSQLType = sqlType; Map<String, DataSource> dataSources = SQLType.DDL == sqlType ? masterSlaveDataSource.getAllDataSources() : masterSlaveDataSource.getDataSource(sqlType).toMap(); Map<String, DataSource> dataSources = SQLType.DDL == sqlType ? masterSlaveDataSource.getMasterDataSource() : masterSlaveDataSource.getDataSource(sqlType).toMap(); Collection<Connection> result = new LinkedList<>(); for (Entry<String, DataSource> each : dataSources.entrySet()) { String dataSourceName = each.getKey(); Loading sharding-jdbc-core/src/main/java/io/shardingjdbc/core/jdbc/core/datasource/MasterSlaveDataSource.java +11 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,17 @@ public class MasterSlaveDataSource extends AbstractDataSourceAdapter { return result; } /** * Get all master data sources. * * @return map of actual master data source name and actual master data sources */ public Map<String, DataSource> getMasterDataSource() { Map<String, DataSource> result = new HashMap<>(1); result.put(masterSlaveRule.getMasterDataSourceName(), masterSlaveRule.getMasterDataSource()); return result; } /** * reset DML flag. */ Loading Loading
RELEASE-NOTES.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ ### 缺陷修正 1. [ISSUE #520](https://github.com/shardingjdbc/sharding-jdbc/issues/520) 引入分表后,唯一键冲突时异常类型不再是DuplicateKeyException 1. [ISSUE #521](https://github.com/shardingjdbc/sharding-jdbc/issues/521) YAML文件中ShardingProperties设置无效 1. [ISSUE #522](https://github.com/shardingjdbc/sharding-jdbc/issues/522) 读写分离Slave库不需要执行DDL语句 ## 2.0.1 Loading
sharding-jdbc-core/src/main/java/io/shardingjdbc/core/jdbc/core/connection/MasterSlaveConnection.java +2 −2 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public final class MasterSlaveConnection extends AbstractConnectionAdapter { /** * Get database connections via SQL type. * * <p>DDL will return all connections; DQL will return slave connection; DML or updated before in same thread will return master connection.</p> * <p>DDL will return master connection; DQL will return slave connection; DML or updated before in same thread will return master connection.</p> * * @param sqlType SQL type * @return database connections via SQL type Loading @@ -59,7 +59,7 @@ public final class MasterSlaveConnection extends AbstractConnectionAdapter { */ public Collection<Connection> getConnections(final SQLType sqlType) throws SQLException { cachedSQLType = sqlType; Map<String, DataSource> dataSources = SQLType.DDL == sqlType ? masterSlaveDataSource.getAllDataSources() : masterSlaveDataSource.getDataSource(sqlType).toMap(); Map<String, DataSource> dataSources = SQLType.DDL == sqlType ? masterSlaveDataSource.getMasterDataSource() : masterSlaveDataSource.getDataSource(sqlType).toMap(); Collection<Connection> result = new LinkedList<>(); for (Entry<String, DataSource> each : dataSources.entrySet()) { String dataSourceName = each.getKey(); Loading
sharding-jdbc-core/src/main/java/io/shardingjdbc/core/jdbc/core/datasource/MasterSlaveDataSource.java +11 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,17 @@ public class MasterSlaveDataSource extends AbstractDataSourceAdapter { return result; } /** * Get all master data sources. * * @return map of actual master data source name and actual master data sources */ public Map<String, DataSource> getMasterDataSource() { Map<String, DataSource> result = new HashMap<>(1); result.put(masterSlaveRule.getMasterDataSourceName(), masterSlaveRule.getMasterDataSource()); return result; } /** * reset DML flag. */ Loading