Skip to content

Commit

Permalink
Merge pull request #39 from sharding-sphere/dev
Browse files Browse the repository at this point in the history
update from origin
  • Loading branch information
beckhampu authored Oct 16, 2018
2 parents cc1e2ad + 3086266 commit f452752
Show file tree
Hide file tree
Showing 44 changed files with 1,003 additions and 156 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
1. [ISSUE #1289](https://github.com/sharding-sphere/sharding-sphere/issues/1289) Adjust Hint API
1. [ISSUE #1302](https://github.com/sharding-sphere/sharding-sphere/issues/1302) Refine package structure
1. [ISSUE #1305](https://github.com/sharding-sphere/sharding-sphere/issues/1305) Deprecated and remove sharding-jdbc-transaction-parent module
1. [ISSUE #1382](https://github.com/sharding-sphere/sharding-sphere/issues/1328) Remove type configuration in Orchestration module

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion RELEASE-NOTES_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
1. [ISSUE #1289](https://github.com/sharding-sphere/sharding-sphere/issues/1289) 调整Hint API
1. [ISSUE #1302](https://github.com/sharding-sphere/sharding-sphere/issues/1302) 调整包结构
1. [ISSUE #1305](https://github.com/sharding-sphere/sharding-sphere/issues/1305) 废弃并删除sharding-jdbc-transaction-parent模块

1. [ISSUE #1382](https://github.com/sharding-sphere/sharding-sphere/issues/1328) 去除Orchestration模块中type的配置

### 缺陷修正

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Table rule configuration.
*
* @author zhangiang
* @author zhangliang
*/
@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class H2DataSourceMetaData implements DataSourceMetaData {

private final String schemeName;

private final Pattern pattern = Pattern.compile("jdbc:h2:(mem|~)[:/]([\\w\\-]+);?\\w*", Pattern.CASE_INSENSITIVE);
private final Pattern pattern = Pattern.compile("jdbc:h2:(mem|~)[:/]([\\w\\-]+);?\\S*", Pattern.CASE_INSENSITIVE);

public H2DataSourceMetaData(final String url) {
Matcher matcher = pattern.matcher(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class MySQLDataSourceMetaData implements DataSourceMetaData {

private final String schemeName;

private final Pattern pattern = Pattern.compile("jdbc:mysql://([\\w\\-\\.]+):?([0-9]*)/([\\w\\-]+);?\\w*", Pattern.CASE_INSENSITIVE);
private final Pattern pattern = Pattern.compile("jdbc:mysql://([\\w\\-\\.]+):?([0-9]*)/([\\w\\-]+);?\\S*", Pattern.CASE_INSENSITIVE);

public MySQLDataSourceMetaData(final String url) {
Matcher matcher = pattern.matcher(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class SQLServerDataSourceMetaData implements DataSourceMetaData {

private final String schemeName;

private final Pattern pattern = Pattern.compile("jdbc:(microsoft:)?sqlserver://([\\w\\-\\.]+):?([0-9]*);(DatabaseName|database)=([\\w\\-]+)", Pattern.CASE_INSENSITIVE);
private final Pattern pattern = Pattern.compile("jdbc:(microsoft:)?sqlserver://([\\w\\-\\.]+):?([0-9]*);\\S*(DatabaseName|database)=([\\w\\-]+);?", Pattern.CASE_INSENSITIVE);

public SQLServerDataSourceMetaData(final String url) {
Matcher matcher = pattern.matcher(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package io.shardingsphere.core.routing;

import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.metadata.datasource.ShardingDataSourceMetaData;
import io.shardingsphere.core.metadata.table.ShardingTableMetaData;
import io.shardingsphere.core.parsing.parser.sql.SQLStatement;
import io.shardingsphere.core.metadata.datasource.ShardingDataSourceMetaData;
import io.shardingsphere.core.routing.router.masterslave.ShardingMasterSlaveRouter;
import io.shardingsphere.core.routing.router.sharding.ShardingRouter;
import io.shardingsphere.core.routing.router.sharding.ShardingRouterFactory;
Expand All @@ -31,7 +31,7 @@
/**
* Statement routing engine.
*
* @author zhangiang
* @author zhangliang
* @author panjuan
*/
public final class StatementRoutingEngine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Master slave router interface.
*
* @author zhangiang
* @author zhangliang
* @author panjuan
*/
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* <p>Trace master data source visited or not in current thread.</p>
*
* @author zhangiang
* @author zhangliang
*/
public final class MasterVisitedManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Sharding with master-slave router interface.
*
* @author zhangiang
* @author zhangliang
*/
@RequiredArgsConstructor
public final class ShardingMasterSlaveRouter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/**
* Sharding router for hint database only.
*
* @author zhangiang
* @author zhangliang
* @author maxiaoguang
*/
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
import io.shardingsphere.core.routing.type.unicast.UnicastRoutingEngine;
import io.shardingsphere.core.rule.ShardingRule;
import io.shardingsphere.core.rule.TableRule;
import io.shardingsphere.core.util.SQLLogger;
import io.shardingsphere.spi.parsing.ParsingHook;
import io.shardingsphere.spi.parsing.SPIParsingHook;
import io.shardingsphere.core.util.SQLLogger;
import lombok.RequiredArgsConstructor;

import java.util.Collection;
Expand All @@ -63,7 +63,7 @@
/**
* Sharding router with parse.
*
* @author zhangiang
* @author zhangliang
* @author maxiaoguang
* @author panjuan
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Sharding router.
*
* @author zhangiang
* @author zhangliang
*/
public interface ShardingRouter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.hint.HintManagerHolder;
import io.shardingsphere.core.metadata.table.ShardingTableMetaData;
import io.shardingsphere.core.metadata.datasource.ShardingDataSourceMetaData;
import io.shardingsphere.core.metadata.table.ShardingTableMetaData;
import io.shardingsphere.core.rule.ShardingRule;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
* Sharding router factory.
*
* @author zhangiang
* @author zhangliang
* @author panjuan
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author panjuan
*/
@Getter
public final class MasterSlaveRule {
public class MasterSlaveRule {

private final String name;

Expand All @@ -42,6 +42,8 @@ public final class MasterSlaveRule {

private final MasterSlaveLoadBalanceAlgorithm loadBalanceAlgorithm;

private final MasterSlaveRuleConfiguration masterSlaveRuleConfiguration;

public MasterSlaveRule(final MasterSlaveRuleConfiguration config) {
Preconditions.checkNotNull(config.getName(), "Master-slave rule name cannot be null.");
Preconditions.checkNotNull(config.getMasterDataSourceName(), "Master data source name cannot be null.");
Expand All @@ -51,6 +53,7 @@ public MasterSlaveRule(final MasterSlaveRuleConfiguration config) {
masterDataSourceName = config.getMasterDataSourceName();
slaveDataSourceNames = config.getSlaveDataSourceNames();
loadBalanceAlgorithm = null == config.getLoadBalanceAlgorithm() ? MasterSlaveLoadBalanceAlgorithmType.getDefaultAlgorithmType().getAlgorithm() : config.getLoadBalanceAlgorithm();
masterSlaveRuleConfiguration = config;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @author panjuan
*/
@Getter
public final class ShardingRule {
public class ShardingRule {

private final ShardingRuleConfiguration shardingRuleConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static DataSource createDBCP(final DatabaseType databaseType, final Stri
result.setUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
result.setMaxTotal(50);
result.setMaxTotal(5);
result.setValidationQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
result.setConnectionInitSqls(Collections.singleton("ALTER SESSION SET CURRENT_SCHEMA = " + dataSourceName));
Expand All @@ -93,7 +93,7 @@ private static DataSource createHikariCP(final DatabaseType databaseType, final
result.setJdbcUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
result.setMaximumPoolSize(50);
result.setMaximumPoolSize(5);
result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
result.setConnectionTestQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<dataset update-count="2">
<metadata data-nodes="db_${0..9}.t_order">
<column name="order_id" type="numeric" />
<column name="user_id" type="numeric" />
<column name="status" type="varchar" />
</metadata>
<row data-node="db_0.t_order" values="1000, 10, init" />
<row data-node="db_0.t_order" values="1001, 10, init" />
<row data-node="db_0.t_order" values="2000, 20, init" />
<row data-node="db_0.t_order" values="2001, 20, init" />
<row data-node="db_1.t_order" values="1, 1, insert" />
<row data-node="db_1.t_order" values="1100, 11, init" />
<row data-node="db_1.t_order" values="1101, 11, init" />
<row data-node="db_1.t_order" values="2100, 21, init" />
<row data-node="db_1.t_order" values="2101, 21, init" />
<row data-node="db_2.t_order" values="2, 2, insert2" />
<row data-node="db_2.t_order" values="1200, 12, init" />
<row data-node="db_2.t_order" values="1201, 12, init" />
<row data-node="db_2.t_order" values="2200, 22, init" />
<row data-node="db_2.t_order" values="2201, 22, init" />
<row data-node="db_3.t_order" values="1300, 13, init" />
<row data-node="db_3.t_order" values="1301, 13, init" />
<row data-node="db_3.t_order" values="2300, 23, init" />
<row data-node="db_3.t_order" values="2301, 23, init" />
<row data-node="db_4.t_order" values="1400, 14, init" />
<row data-node="db_4.t_order" values="1401, 14, init" />
<row data-node="db_4.t_order" values="2400, 24, init" />
<row data-node="db_4.t_order" values="2401, 24, init" />
<row data-node="db_5.t_order" values="1500, 15, init" />
<row data-node="db_5.t_order" values="1501, 15, init" />
<row data-node="db_5.t_order" values="2500, 25, init" />
<row data-node="db_5.t_order" values="2501, 25, init" />
<row data-node="db_6.t_order" values="1600, 16, init" />
<row data-node="db_6.t_order" values="1601, 16, init" />
<row data-node="db_6.t_order" values="2600, 26, init" />
<row data-node="db_6.t_order" values="2601, 26, init" />
<row data-node="db_7.t_order" values="1700, 17, init" />
<row data-node="db_7.t_order" values="1701, 17, init" />
<row data-node="db_7.t_order" values="2700, 27, init" />
<row data-node="db_7.t_order" values="2701, 27, init" />
<row data-node="db_8.t_order" values="1800, 18, init" />
<row data-node="db_8.t_order" values="1801, 18, init" />
<row data-node="db_8.t_order" values="2800, 28, init" />
<row data-node="db_8.t_order" values="2801, 28, init" />
<row data-node="db_9.t_order" values="1900, 19, init" />
<row data-node="db_9.t_order" values="1901, 19, init" />
<row data-node="db_9.t_order" values="2900, 29, init" />
<row data-node="db_9.t_order" values="2901, 29, init" />
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<dataset update-count="2">
<metadata data-nodes="db_${0..9}.t_order">
<column name="order_id" type="numeric" />
<column name="user_id" type="numeric" />
<column name="status" type="varchar" />
</metadata>
<row data-node="db_0.t_order" values="1000, 10, update" />
<row data-node="db_0.t_order" values="1001, 10, init" />
<row data-node="db_0.t_order" values="2000, 20, init" />
<row data-node="db_0.t_order" values="2001, 20, init" />
<row data-node="db_1.t_order" values="1100, 11, init" />
<row data-node="db_1.t_order" values="1101, 11, init" />
<row data-node="db_1.t_order" values="2100, 21, init" />
<row data-node="db_1.t_order" values="2101, 21, init" />
<row data-node="db_2.t_order" values="1200, 12, init" />
<row data-node="db_2.t_order" values="1201, 12, init" />
<row data-node="db_2.t_order" values="2200, 22, init" />
<row data-node="db_2.t_order" values="2201, 22, init" />
<row data-node="db_3.t_order" values="1300, 13, init" />
<row data-node="db_3.t_order" values="1301, 13, init" />
<row data-node="db_3.t_order" values="2300, 23, init" />
<row data-node="db_3.t_order" values="2301, 23, init" />
<row data-node="db_4.t_order" values="1400, 14, init" />
<row data-node="db_4.t_order" values="1401, 14, init" />
<row data-node="db_4.t_order" values="2400, 24, init" />
<row data-node="db_4.t_order" values="2401, 24, init" />
<row data-node="db_5.t_order" values="1500, 15, init" />
<row data-node="db_5.t_order" values="1501, 15, init" />
<row data-node="db_5.t_order" values="2500, 25, init" />
<row data-node="db_5.t_order" values="2501, 25, init" />
<row data-node="db_6.t_order" values="1600, 16, init" />
<row data-node="db_6.t_order" values="1601, 16, init" />
<row data-node="db_6.t_order" values="2600, 26, init" />
<row data-node="db_6.t_order" values="2601, 26, init" />
<row data-node="db_7.t_order" values="1700, 17, init" />
<row data-node="db_7.t_order" values="1701, 17, init" />
<row data-node="db_7.t_order" values="2700, 27, init" />
<row data-node="db_7.t_order" values="2701, 27, init" />
<row data-node="db_8.t_order" values="1800, 18, init" />
<row data-node="db_8.t_order" values="1801, 18, init" />
<row data-node="db_8.t_order" values="2800, 28, init" />
<row data-node="db_8.t_order" values="2801, 28, init" />
<row data-node="db_9.t_order" values="1900, 19, init" />
<row data-node="db_9.t_order" values="1901, 19, init" />
<row data-node="db_9.t_order" values="2900, 29, init" />
<row data-node="db_9.t_order" values="2901, 29, init" />
</dataset>
Loading

0 comments on commit f452752

Please sign in to comment.