This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 0642cae Simplify signature of
RDLUpdater.updateCurrentRuleConfiguration() (#11148)
0642cae is described below
commit 0642cae43427f5fe182a049dce20a5794d7fc20d
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jul 4 19:53:17 2021 +0800
Simplify signature of RDLUpdater.updateCurrentRuleConfiguration() (#11148)
* Refactor CreateShardingBroadcastTableRuleStatementUpdater
* Refactor CreateShardingBroadcastTableRuleStatementUpdater
* Refactor CreateShardingBindingTableRuleStatementUpdater
* Simplify signature of RDLCreateUpdater.updateCurrentRuleConfiguration
* Refactor RDLBackendHandler
* Refactor RDLDropUpdater
* Refactor RDLDropUpdater
* Refactor RDLAlterUpdater
---
.../AlterDatabaseDiscoveryRuleStatementUpdater.java | 2 +-
.../CreateDatabaseDiscoveryRuleStatementUpdater.java | 3 +--
.../DropDatabaseDiscoveryRuleStatementUpdater.java | 2 +-
...terDatabaseDiscoveryRuleStatementUpdaterTest.java | 2 +-
...ropDatabaseDiscoveryRuleStatementUpdaterTest.java | 2 +-
.../update/AlterEncryptRuleStatementUpdater.java | 2 +-
.../update/CreateEncryptRuleStatementUpdater.java | 3 +--
.../update/DropEncryptRuleStatementUpdater.java | 2 +-
.../update/AlterEncryptRuleStatementUpdaterTest.java | 2 +-
.../update/DropEncryptRuleStatementUpdaterTest.java | 2 +-
.../AlterReadwriteSplittingRuleStatementUpdater.java | 2 +-
...CreateReadwriteSplittingRuleStatementUpdater.java | 3 +--
.../DropReadwriteSplittingRuleStatementUpdater.java | 2 +-
...erReadwriteSplittingRuleStatementUpdaterTest.java | 2 +-
...opReadwriteSplittingRuleStatementUpdaterTest.java | 2 +-
...lterShardingBindingTableRuleStatementUpdater.java | 2 +-
...erShardingBroadcastTableRuleStatementUpdater.java | 2 +-
.../AlterShardingTableRuleStatementUpdater.java | 2 +-
...eateShardingBindingTableRuleStatementUpdater.java | 15 +++++++++------
...teShardingBroadcastTableRuleStatementUpdater.java | 13 ++++++-------
.../CreateShardingTableRuleStatementUpdater.java | 3 +--
...DropShardingBindingTableRuleStatementUpdater.java | 2 +-
...opShardingBroadcastTableRuleStatementUpdater.java | 2 +-
.../DropShardingTableRuleStatementUpdater.java | 2 +-
...ShardingBindingTableRuleStatementUpdaterTest.java | 2 +-
...ardingBroadcastTableRuleStatementUpdaterTest.java | 2 +-
.../AlterShardingTableRuleStatementUpdaterTest.java | 2 +-
...ShardingBindingTableRuleStatementUpdaterTest.java | 2 +-
...ardingBroadcastTableRuleStatementUpdaterTest.java | 2 +-
.../DropShardingTableRuleStatementUpdaterTest.java | 2 +-
.../infra/distsql/update/RDLAlterUpdater.java | 3 +--
.../infra/distsql/update/RDLCreateUpdater.java | 4 +---
.../infra/distsql/update/RDLDropUpdater.java | 3 +--
.../backend/text/distsql/rdl/RDLBackendHandler.java | 20 ++++++++++----------
34 files changed, 56 insertions(+), 62 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDis
[...]
index c92465a..cbc98c5 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdater.java
@@ -104,7 +104,7 @@ public final class
AlterDatabaseDiscoveryRuleStatementUpdater implements RDLAlte
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterDatabaseDiscoveryRuleStatement sqlStatement, final
DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
AlterDatabaseDiscoveryRuleStatement sqlStatement, final
DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
dropRuleConfiguration(sqlStatement, currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseD
[...]
index 0e495ee..ff030ba 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryRuleStatementUpdater.java
@@ -101,8 +101,7 @@ public final class
CreateDatabaseDiscoveryRuleStatementUpdater implements RDLCre
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateDatabaseDiscoveryRuleStatement sqlStatement,
- final
DatabaseDiscoveryRuleConfiguration currentRuleConfig, final
DatabaseDiscoveryRuleConfiguration toBeCreatedRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
DatabaseDiscoveryRuleConfiguration currentRuleConfig, final
DatabaseDiscoveryRuleConfiguration toBeCreatedRuleConfig) {
if (null != currentRuleConfig) {
currentRuleConfig.getDataSources().addAll(toBeCreatedRuleConfig.getDataSources());
currentRuleConfig.getDiscoveryTypes().putAll(toBeCreatedRuleConfig.getDiscoveryTypes());
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDisco
[...]
index c7b8b6f..f42aea0 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
@@ -58,7 +58,7 @@ public final class DropDatabaseDiscoveryRuleStatementUpdater
implements RDLDropU
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropDatabaseDiscoveryRuleStatement sqlStatement, final
DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropDatabaseDiscoveryRuleStatement sqlStatement, final
DatabaseDiscoveryRuleConfiguration currentRuleConfig) {
for (String each : sqlStatement.getRuleNames()) {
dropRule(currentRuleConfig, each);
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabas
[...]
index 665e284..be6c05b 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -67,7 +67,7 @@ public final class
AlterDatabaseDiscoveryRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("TEST"), createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement("TEST"),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseD
[...]
index 7e7a58d..5e75d6a 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -50,7 +50,7 @@ public final class
DropDatabaseDiscoveryRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo", createSQLStatement(),
createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement(),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
index 43e8660..d213529 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdater.java
@@ -87,7 +87,7 @@ public final class AlterEncryptRuleStatementUpdater
implements RDLAlterUpdater<A
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration
currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final AlterEncryptRuleStatement
sqlStatement, final EncryptRuleConfiguration currentRuleConfig) {
dropRuleConfiguration(sqlStatement, currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
index f755fd5..ab3b5fe 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdater.java
@@ -80,8 +80,7 @@ public final class CreateEncryptRuleStatementUpdater
implements RDLCreateUpdater
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateEncryptRuleStatement sqlStatement,
- final EncryptRuleConfiguration
currentRuleConfig, final EncryptRuleConfiguration toBeCreatedRuleConfig) {
+ public void updateCurrentRuleConfiguration(final EncryptRuleConfiguration
currentRuleConfig, final EncryptRuleConfiguration toBeCreatedRuleConfig) {
if (null != currentRuleConfig) {
currentRuleConfig.getTables().addAll(toBeCreatedRuleConfig.getTables());
currentRuleConfig.getEncryptors().putAll(toBeCreatedRuleConfig.getEncryptors());
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
index e654219..64c2ccb 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
@@ -58,7 +58,7 @@ public final class DropEncryptRuleStatementUpdater implements
RDLDropUpdater<Dro
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration
currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration
currentRuleConfig) {
for (String each : sqlStatement.getTables()) {
dropRule(currentRuleConfig, each);
}
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
index 8d0eb28..4e674d3 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
@@ -57,7 +57,7 @@ public final class AlterEncryptRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("MD5"), createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement("MD5"),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
index a603291..35a2fc1 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
@@ -51,7 +51,7 @@ public final class DropEncryptRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo", createSQLStatement(),
createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement(),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/r
[...]
index b5c6aab..61ccaa6 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdater.java
@@ -100,7 +100,7 @@ public final class
AlterReadwriteSplittingRuleStatementUpdater implements RDLAlt
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterReadwriteSplittingRuleStatement sqlStatement, final
ReadwriteSplittingRuleConfiguration currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
AlterReadwriteSplittingRuleStatement sqlStatement, final
ReadwriteSplittingRuleConfiguration currentRuleConfig) {
dropRuleConfiguration(sqlStatement, currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/
[...]
index 7e669dc..f39645d 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdater.java
@@ -98,8 +98,7 @@ public final class
CreateReadwriteSplittingRuleStatementUpdater implements RDLCr
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateReadwriteSplittingRuleStatement sqlStatement,
- final
ReadwriteSplittingRuleConfiguration currentRuleConfig, final
ReadwriteSplittingRuleConfiguration toBeCreatedRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
ReadwriteSplittingRuleConfiguration currentRuleConfig, final
ReadwriteSplittingRuleConfiguration toBeCreatedRuleConfig) {
if (null != currentRuleConfig) {
currentRuleConfig.getDataSources().addAll(toBeCreatedRuleConfig.getDataSources());
currentRuleConfig.getLoadBalancers().putAll(toBeCreatedRuleConfig.getLoadBalancers());
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/re
[...]
index 6605824..53628ee 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java
@@ -58,7 +58,7 @@ public final class DropReadwriteSplittingRuleStatementUpdater
implements RDLDrop
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropReadwriteSplittingRuleStatement sqlStatement, final
ReadwriteSplittingRuleConfiguration currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropReadwriteSplittingRuleStatement sqlStatement, final
ReadwriteSplittingRuleConfiguration currentRuleConfig) {
for (String each : sqlStatement.getRuleNames()) {
dropRule(currentRuleConfig, each);
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphe
[...]
index a999dd9..4604f95 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java
@@ -66,7 +66,7 @@ public final class
AlterReadwriteSplittingRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("TEST"), createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement("TEST"),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingspher
[...]
index ab87ac9..20b6af1 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java
@@ -50,7 +50,7 @@ public final class
DropReadwriteSplittingRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo", createSQLStatement(),
createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement(),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRuleStatementUpdater.java
index 1ba5a3f..39c2427 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRuleStatementUpdater.java
@@ -76,7 +76,7 @@ public final class
AlterShardingBindingTableRuleStatementUpdater implements RDLA
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterShardingBindingTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
AlterShardingBindingTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
dropRuleConfiguration(currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBroadcastTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBroadcastTableRuleStatementU
[...]
index a092eb6..507e960 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBroadcastTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBroadcastTableRuleStatementUpdater.java
@@ -42,7 +42,7 @@ public final class
AlterShardingBroadcastTableRuleStatementUpdater implements RD
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterShardingBroadcastTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
AlterShardingBroadcastTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
dropRuleConfiguration(currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
index 4a087d1..94e8ce0 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingTableRuleStatementUpdater.java
@@ -142,7 +142,7 @@ public final class AlterShardingTableRuleStatementUpdater
implements RDLAlterUpd
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
AlterShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration
currentRuleConfig) {
+ public void updateCurrentRuleConfiguration(final
AlterShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration
currentRuleConfig) {
dropRuleConfiguration(sqlStatement, currentRuleConfig);
addRuleConfiguration(sqlStatement, currentRuleConfig);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpd
[...]
index 82128c6..2154c3d 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBindingTableRuleStatementUpdater.java
@@ -48,7 +48,7 @@ public final class
CreateShardingBindingTableRuleStatementUpdater implements RDL
private void checkCurrentRuleConfiguration(final String schemaName, final
ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException
{
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Binding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", schemaName);
}
}
@@ -89,14 +89,17 @@ public final class
CreateShardingBindingTableRuleStatementUpdater implements RDL
@Override
public ShardingRuleConfiguration buildToBeCreatedRuleConfiguration(final
String schemaName, final CreateShardingBindingTableRulesStatement sqlStatement)
{
- return null;
+ ShardingRuleConfiguration result = new ShardingRuleConfiguration();
+ for (BindingTableRuleSegment each : sqlStatement.getRules()) {
+ result.getBindingTableGroups().add(each.getTableGroups());
+ }
+ return result;
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateShardingBindingTableRulesStatement sqlStatement,
- final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
- for (BindingTableRuleSegment each : sqlStatement.getRules()) {
-
currentRuleConfig.getBindingTableGroups().add(each.getTableGroups());
+ public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
+ if (null != currentRuleConfig) {
+
currentRuleConfig.getBindingTableGroups().addAll(toBeCreatedRuleConfig.getBindingTableGroups());
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBroadcastTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBroadcastTableRuleStatemen
[...]
index 247077f..591efda 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBroadcastTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingBroadcastTableRuleStatementUpdater.java
@@ -43,16 +43,15 @@ public final class
CreateShardingBroadcastTableRuleStatementUpdater implements R
@Override
public ShardingRuleConfiguration buildToBeCreatedRuleConfiguration(final
String schemaName, final CreateShardingBroadcastTableRulesStatement
sqlStatement) {
- return new ShardingRuleConfiguration();
+ ShardingRuleConfiguration result = new ShardingRuleConfiguration();
+ result.setBroadcastTables(sqlStatement.getTables());
+ return result;
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateShardingBroadcastTableRulesStatement sqlStatement,
- final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
- if (null == currentRuleConfig) {
- toBeCreatedRuleConfig.setBroadcastTables(sqlStatement.getTables());
- } else {
-
currentRuleConfig.getBroadcastTables().addAll(sqlStatement.getTables());
+ public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
+ if (null != currentRuleConfig) {
+
currentRuleConfig.getBroadcastTables().addAll(toBeCreatedRuleConfig.getBroadcastTables());
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
index f8605d0..f2b26e8 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java
@@ -122,8 +122,7 @@ public final class CreateShardingTableRuleStatementUpdater
implements RDLCreateU
}
@Override
- public void updateCurrentRuleConfiguration(final String schemaName, final
CreateShardingTableRuleStatement sqlStatement,
- final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
+ public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
if (null != currentRuleConfig) {
currentRuleConfig.getAutoTables().addAll(toBeCreatedRuleConfig.getAutoTables());
currentRuleConfig.getShardingAlgorithms().putAll(toBeCreatedRuleConfig.getShardingAlgorithms());
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
index 2728193..c6d69c6 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
@@ -42,7 +42,7 @@ public final class
DropShardingBindingTableRuleStatementUpdater implements RDLDr
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropShardingBindingTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropShardingBindingTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
currentRuleConfig.getBindingTableGroups().clear();
return false;
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpd
[...]
index 34695ea..17c1006 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
@@ -42,7 +42,7 @@ public final class
DropShardingBroadcastTableRuleStatementUpdater implements RDL
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropShardingBroadcastTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropShardingBroadcastTableRulesStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
currentRuleConfig.getBroadcastTables().clear();
return false;
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
index 7761fad..2b3b3ef 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
@@ -88,7 +88,7 @@ public final class DropShardingTableRuleStatementUpdater
implements RDLDropUpdat
}
@Override
- public boolean updateCurrentRuleConfiguration(final String schemaName,
final DropShardingTableRuleStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
+ public boolean updateCurrentRuleConfiguration(final
DropShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration
currentRuleConfig) {
for (String each : getToBeDroppedShardingTableNames(sqlStatement)) {
dropShardingTable(currentRuleConfig, each);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBindingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBindingTableRuleStatementUpdaterTest.java
index 059a923..b3a038e 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBindingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBindingTableRuleStatementUpdaterTest.java
@@ -49,7 +49,7 @@ public final class
AlterShardingBindingTableRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createDuplicatedSQLStatement(), createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createDuplicatedSQLStatement(),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBroadcastTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBroadcastTableRuleStatementUpdaterTest.java
index 03993d9..ba94f2d 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBroadcastTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingBroadcastTableRuleStatementUpdaterTest.java
@@ -40,7 +40,7 @@ public final class
AlterShardingBroadcastTableRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("t_2"), createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement("t_2"),
createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
index 243f6ed..fc6c8d4 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java
@@ -64,7 +64,7 @@ public final class AlterShardingTableRuleStatementUpdaterTest
{
@Test
public void assertUpdateCurrentRuleConfiguration() {
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("t_order", "STANDARD_TEST"),
createCurrentRuleConfiguration());
+ updater.updateCurrentRuleConfiguration(createSQLStatement("t_order",
"STANDARD_TEST"), createCurrentRuleConfiguration());
// TODO assert current rule configuration
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
index 3ebc736..a783da3 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
@@ -47,7 +47,7 @@ public final class
DropShardingBindingTableRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
ShardingRuleConfiguration currentRuleConfig =
createCurrentRuleConfiguration();
- updater.updateCurrentRuleConfiguration("foo", createSQLStatement(),
currentRuleConfig);
+ updater.updateCurrentRuleConfiguration(createSQLStatement(),
currentRuleConfig);
assertTrue(currentRuleConfig.getBindingTableGroups().isEmpty());
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
index 3c20724..0af62e4 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
@@ -47,7 +47,7 @@ public final class
DropShardingBroadcastTableRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
ShardingRuleConfiguration currentRuleConfig =
createCurrentRuleConfiguration();
- updater.updateCurrentRuleConfiguration("foo", createSQLStatement(),
currentRuleConfig);
+ updater.updateCurrentRuleConfiguration(createSQLStatement(),
currentRuleConfig);
assertTrue(currentRuleConfig.getBroadcastTables().isEmpty());
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java
index 79e4f50..7662f56 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java
@@ -64,7 +64,7 @@ public final class DropShardingTableRuleStatementUpdaterTest {
@Test
public void assertUpdateCurrentRuleConfiguration() {
ShardingRuleConfiguration currentRuleConfig =
createCurrentRuleConfiguration();
- updater.updateCurrentRuleConfiguration("foo",
createSQLStatement("t_order"), currentRuleConfig);
+ updater.updateCurrentRuleConfiguration(createSQLStatement("t_order"),
currentRuleConfig);
assertFalse(getShardingTables(currentRuleConfig).contains("t_order"));
assertTrue(getBindingTables(currentRuleConfig).contains("t_order_item"));
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLAlterUpdater.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLAlterUpdater.java
index 5872c1d..666aee5 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLAlterUpdater.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLAlterUpdater.java
@@ -31,9 +31,8 @@ public interface RDLAlterUpdater<T extends SQLStatement, R
extends RuleConfigura
/**
* Update current rule configuration.
*
- * @param schemaName schema name
* @param sqlStatement SQL statement
* @param currentRuleConfig current rule configuration to be updated
*/
- void updateCurrentRuleConfiguration(String schemaName, T sqlStatement, R
currentRuleConfig);
+ void updateCurrentRuleConfiguration(T sqlStatement, R currentRuleConfig);
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLCreateUpdater.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLCreateUpdater.java
index 272cfc2..2bc081b 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLCreateUpdater.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLCreateUpdater.java
@@ -40,10 +40,8 @@ public interface RDLCreateUpdater<T extends SQLStatement, R
extends RuleConfigur
/**
* Update current rule configuration.
*
- * @param schemaName schema name
- * @param sqlStatement SQL statement
* @param currentRuleConfig current rule configuration to be updated
* @param toBeCreatedRuleConfig to be created rule configuration
*/
- void updateCurrentRuleConfiguration(String schemaName, T sqlStatement, R
currentRuleConfig, R toBeCreatedRuleConfig);
+ void updateCurrentRuleConfiguration(R currentRuleConfig, R
toBeCreatedRuleConfig);
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLDropUpdater.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLDropUpdater.java
index 5b453c7..0be2b26 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLDropUpdater.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/update/RDLDropUpdater.java
@@ -31,10 +31,9 @@ public interface RDLDropUpdater<T extends SQLStatement, R
extends RuleConfigurat
/**
* Update current rule configuration.
*
- * @param schemaName schema name
* @param sqlStatement SQL statement
* @param currentRuleConfig current rule configuration to be updated
* @return current rule configuration is empty or not
*/
- boolean updateCurrentRuleConfiguration(String schemaName, T sqlStatement,
R currentRuleConfig);
+ boolean updateCurrentRuleConfiguration(T sqlStatement, R
currentRuleConfig);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandler.java
index 60b1ad5..5275ef8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/RDLBackendHandler.java
@@ -19,13 +19,12 @@ package
org.apache.shardingsphere.proxy.backend.text.distsql.rdl;
import
org.apache.shardingsphere.governance.core.registry.config.event.rule.RuleConfigurationsAlteredSQLNotificationEvent;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
import org.apache.shardingsphere.infra.distsql.update.RDLAlterUpdater;
import org.apache.shardingsphere.infra.distsql.update.RDLCreateUpdater;
import org.apache.shardingsphere.infra.distsql.update.RDLDropUpdater;
import org.apache.shardingsphere.infra.distsql.update.RDLUpdater;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
-import
org.apache.shardingsphere.infra.distsql.exception.rule.RuleDefinitionViolationException;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
@@ -75,35 +74,36 @@ public final class RDLBackendHandler<T extends
SQLStatement> extends SchemaRequi
}
@SuppressWarnings("rawtypes")
- private void processSQLStatement(final String schemaName, final T
sqlStatement, final RDLUpdater updater, final RuleConfiguration
currentRuleConfig) throws RuleDefinitionViolationException {
+ private void processSQLStatement(final String schemaName, final T
sqlStatement, final RDLUpdater updater, final RuleConfiguration
currentRuleConfig) {
if (updater instanceof RDLCreateUpdater) {
processCreate(schemaName, sqlStatement, (RDLCreateUpdater)
updater, currentRuleConfig);
} else if (updater instanceof RDLAlterUpdater) {
- processAlter(schemaName, sqlStatement, (RDLAlterUpdater) updater,
currentRuleConfig);
+ processAlter(sqlStatement, (RDLAlterUpdater) updater,
currentRuleConfig);
} else if (updater instanceof RDLDropUpdater) {
processDrop(schemaName, sqlStatement, (RDLDropUpdater) updater,
currentRuleConfig);
} else {
- throw new UnsupportedOperationException(String.format("Cannot
support RDLUpdater type `%s`", updater.getClass().getCanonicalName()));
+ throw new UnsupportedOperationException(String.format("Cannot
support RDL updater type `%s`", updater.getClass().getCanonicalName()));
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
private void processCreate(final String schemaName, final T sqlStatement,
final RDLCreateUpdater updater, final RuleConfiguration currentRuleConfig) {
RuleConfiguration toBeCreatedRuleConfig =
updater.buildToBeCreatedRuleConfiguration(schemaName, sqlStatement);
- updater.updateCurrentRuleConfiguration(schemaName, sqlStatement,
currentRuleConfig, toBeCreatedRuleConfig);
- if (null == currentRuleConfig && null != toBeCreatedRuleConfig) {
+ if (null == currentRuleConfig) {
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().add(toBeCreatedRuleConfig);
+ } else {
+ updater.updateCurrentRuleConfiguration(currentRuleConfig,
toBeCreatedRuleConfig);
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
- private void processAlter(final String schemaName, final T sqlStatement,
final RDLAlterUpdater updater, final RuleConfiguration currentRuleConfig) {
- updater.updateCurrentRuleConfiguration(schemaName, sqlStatement,
currentRuleConfig);
+ private void processAlter(final T sqlStatement, final RDLAlterUpdater
updater, final RuleConfiguration currentRuleConfig) {
+ updater.updateCurrentRuleConfiguration(sqlStatement,
currentRuleConfig);
}
@SuppressWarnings({"rawtypes", "unchecked"})
private void processDrop(final String schemaName, final T sqlStatement,
final RDLDropUpdater rdlUpdater, final RuleConfiguration currentRuleConfig) {
- if (rdlUpdater.updateCurrentRuleConfiguration(schemaName,
sqlStatement, currentRuleConfig)) {
+ if (rdlUpdater.updateCurrentRuleConfiguration(sqlStatement,
currentRuleConfig)) {
ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().remove(currentRuleConfig);
}
}