Skip to content

Commit

Permalink
Merge pull request #40 from sharding-sphere/dev
Browse files Browse the repository at this point in the history
update from origin
  • Loading branch information
beckhampu committed Oct 18, 2018
2 parents f452752 + 837a292 commit 82c8277
Show file tree
Hide file tree
Showing 157 changed files with 816 additions and 902 deletions.
14 changes: 11 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-sphere</artifactId>
<version>3.0.0.M5-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>

<modules>
<module>sharding-core</module>
Expand Down Expand Up @@ -36,7 +38,8 @@

<javax.transaction.version>1.1</javax.transaction.version>
<atomikos.version>4.0.4</atomikos.version>


<zookeeper.version>3.4.6</zookeeper.version>
<curator.version>2.10.0</curator.version>
<grpc.version>1.7.0</grpc.version>
<protobuf.version>3.4.0</protobuf.version>
Expand Down Expand Up @@ -153,6 +156,11 @@
<version>${atomikos.version}</version>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
Expand Down
1 change: 0 additions & 1 deletion sharding-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<version>3.0.0.M5-SNAPSHOT</version>
</parent>
<artifactId>sharding-core</artifactId>
<name>${project.artifactId}</name>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion sharding-core/src/test/resources/parser/delete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<table name="t_order" />
</tables>
<tokens>
<table-token begin-position="7" original-literals="`t_order`" />
<table-token begin-position="12" original-literals="`t_order`" />
</tokens>
</parser-result>

Expand Down
4 changes: 2 additions & 2 deletions sharding-core/src/test/resources/parser/insert.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
<table name="t_order" />
</tables>
<tokens>
<table-token begin-position="33" original-literals="`t_order`" />
<insert-values-token begin-position="84" table-name="t_order"/>
<table-token begin-position="33" original-literals="t_order" />
<insert-values-token begin-position="76" table-name="t_order"/>
</tokens>
<or-condition>
<and-condition>
Expand Down
4 changes: 2 additions & 2 deletions sharding-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>sharding-sphere</artifactId>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-sphere</artifactId>
<version>3.0.0.M5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sharding-jdbc</artifactId>
<packaging>pom</packaging>

Expand Down
6 changes: 4 additions & 2 deletions sharding-jdbc/sharding-jdbc-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -7,7 +9,7 @@
<version>3.0.0.M5-SNAPSHOT</version>
</parent>
<artifactId>sharding-jdbc-core</artifactId>
<name>${project.artifactId}</name>

<dependencies>
<dependency>
<groupId>io.shardingsphere</groupId>
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(5);
result.setMaxTotal(15);
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(5);
result.setMaximumPoolSize(15);
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
Expand Up @@ -145,7 +145,7 @@
</dml-test-case>

<dml-test-case sql-case-id="delete_with_special_character_without_sharding_value">
<assertion expected-data-file="delete_with_special_character_without_sharding_value.xml" />
<assertion expected-data-file="delete_with_sharding_value.xml" />
</dml-test-case>

<dml-test-case sql-case-id="delete_with_special_comments_without_sharding_value">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="19" />
<row values="19" />
<row values="19" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@
<metadata>
<column name="user_id" />
</metadata>
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
<row values="10" />
</dataset>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
initialized=false
run.additional.cases=false
sharding.rule.type=db,tbl,dbtbl_with_masterslave,masterslave

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.shardingsphere</groupId>
Expand All @@ -8,6 +11,13 @@
<artifactId>sharding-jdbc-orchestration-spring-boot-starter</artifactId>

<dependencies>
<dependency>
<groupId>io.shardingsphere</groupId>
<artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
"type": "io.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"name": "sharding.jdbc.config.orchestration.etcd",
"type": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"name": "sharding.jdbc.config.orchestration.zookeeper",
"type": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration"
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"name": "sharding.jdbc.config.orchestration.registry",
"type": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration"
},
{
"sourceType": "io.shardingsphere.core.yaml.sharding.YamlShardingStrategyConfiguration",
Expand Down Expand Up @@ -77,90 +72,49 @@
"sourceType": "io.shardingsphere.shardingjdbc.util.DataSourceUtil"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"defaultValue": 3,
"name": "sharding.jdbc.config.orchestration.etcd.max-retries",
"description": "Maximal retries when calling a etcd method.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"defaultValue": 200,
"name": "sharding.jdbc.config.orchestration.etcd.retry-interval-milliseconds",
"description": "Maximal retries when calling a etcd method.",
"type": "java.lang.Integer"
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"name": "sharding.jdbc.config.orchestration.registry.server-lists",
"description": "Registry center server list.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"name": "sharding.jdbc.config.orchestration.etcd.server-lists",
"description": "Etcd server list.\n \n <p>Include ip address and port, multiple servers split by comma. Etc: {@code http:\/\/host1:2379,http:\/\/host2:2379}<\/p>.",
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"name": "sharding.jdbc.config.orchestration.registry.namespace",
"description": "Namespace of registry center.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"defaultValue": 60,
"name": "sharding.jdbc.config.orchestration.etcd.time-to-live-seconds",
"description": "Time to live seconds of ephemeral keys.",
"type": "java.lang.Integer"
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"name": "sharding.jdbc.config.orchestration.registry.digest",
"description": "Digest for registry center.\n \n <p>Default is not need digest<\/p>.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 500,
"name": "sharding.jdbc.config.orchestration.etcd.timeout-milliseconds",
"description": "Timeout when calling a etcd method in milliseconds.",
"name": "sharding.jdbc.config.orchestration.registry.operation-timeout-milliseconds",
"description": "Operation timeout time in milliseconds.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"defaultValue": 1000,
"name": "sharding.jdbc.config.orchestration.zookeeper.base-sleep-time-milliseconds",
"description": "Base sleep time milliseconds.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"defaultValue": 0,
"name": "sharding.jdbc.config.orchestration.zookeeper.connection-timeout-milliseconds",
"description": "Connection timeout milliseconds.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"name": "sharding.jdbc.config.orchestration.zookeeper.digest",
"description": "Digest for zookeeper.\n \n <p>Default is not need digest<\/p>.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 3,
"name": "sharding.jdbc.config.orchestration.zookeeper.max-retries",
"description": "Max retries.",
"name": "sharding.jdbc.config.orchestration.registry.max-retries",
"description": "Max number of times to retry.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"defaultValue": 3000,
"name": "sharding.jdbc.config.orchestration.zookeeper.max-sleep-time-milliseconds",
"description": "Max sleep time milliseconds.",
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 500,
"name": "sharding.jdbc.config.orchestration.registry.retry-interval-milliseconds",
"description": "Time interval in milliseconds on each retry.",
"type": "java.lang.Integer"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"name": "sharding.jdbc.config.orchestration.zookeeper.namespace",
"description": "Namespace of zookeeper.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"name": "sharding.jdbc.config.orchestration.zookeeper.server-lists",
"description": "Zookeeper server list.\n \n <p>Include ip address and port, multiple servers split by comma. Etc: {@code host1:2181,host2:2181}<\/p>.",
"type": "java.lang.String"
},
{
"sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
"defaultValue": 0,
"name": "sharding.jdbc.config.orchestration.zookeeper.session-timeout-milliseconds",
"description": "Session timeout milliseconds.",
"sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 500,
"name": "sharding.jdbc.config.orchestration.registry.time-to-live-seconds",
"description": "Time to live in seconds of ephemeral keys.",
"type": "java.lang.Integer"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

package io.shardingsphere.shardingjdbc.spring.boot.util;

import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.curator.test.TestingServer;
import org.apache.zookeeper.KeeperException.ConnectionLossException;
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.KeeperException.NodeExistsException;

import java.io.File;
import java.io.IOException;
Expand All @@ -41,22 +43,25 @@ public static void start() {
}
try {
testingServer = new TestingServer(PORT, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
RegExceptionHandler.handleException(ex);
if (!isIgnoredException(ex)) {
throw new RuntimeException(ex);
}
} finally {
Runtime.getRuntime().addShutdownHook(new Thread() {

@Override
public void run() {
try {
testingServer.close();
} catch (final IOException ex) {
RegExceptionHandler.handleException(ex);
} catch (final IOException ignore) {
}
}
});
}
}

private static boolean isIgnoredException(final Throwable cause) {
return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ sharding.jdbc.config.masterslave.slave-data-source-names=ds_slave_0,ds_slave_1

sharding.jdbc.config.orchestration.name=demo_spring_boot_ds_ms
sharding.jdbc.config.orchestration.overwrite=true
sharding.jdbc.config.orchestration.zookeeper.namespace=orchestration-spring-boot-master-slave-test
sharding.jdbc.config.orchestration.zookeeper.server-lists=localhost:3181
sharding.jdbc.config.orchestration.registry.namespace=orchestration-spring-boot-master-slave-test
sharding.jdbc.config.orchestration.registry.server-lists=localhost:3181

sharding.jdbc.config.masterslave.config-map.key1=value1
sharding.jdbc.config.masterslave.config-map.key2=${sharding.jdbc.config.masterslave.config-map.key1}
Expand Down
Loading

0 comments on commit 82c8277

Please sign in to comment.