You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/04/19 23:39:24 UTC
[shardingsphere] branch master updated: Adjust schemaName to databaseName (#16930)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 9c8446da2a9 Adjust schemaName to databaseName (#16930)
9c8446da2a9 is described below
commit 9c8446da2a93e512022187239a793eaf0b43896e
Author: zhaojinchao <zh...@apache.org>
AuthorDate: Wed Apr 20 07:39:03 2022 +0800
Adjust schemaName to databaseName (#16930)
* Rename schemaName to databaseName
* Update
* Recover
* update
* Recover
* Update config
* Update
---
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 20 ++++++++---------
...AlterDatabaseDiscoveryRuleStatementUpdater.java | 20 ++++++++---------
...AlterDatabaseDiscoveryTypeStatementUpdater.java | 20 ++++++++---------
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 8 +++----
...reateDatabaseDiscoveryRuleStatementUpdater.java | 20 ++++++++---------
...reateDatabaseDiscoveryTypeStatementUpdater.java | 8 +++----
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 20 ++++++++---------
.../DropDatabaseDiscoveryRuleStatementUpdater.java | 20 ++++++++---------
.../DropDatabaseDiscoveryTypeStatementUpdater.java | 20 ++++++++---------
.../update/AlterEncryptRuleStatementUpdater.java | 14 ++++++------
.../update/CreateEncryptRuleStatementUpdater.java | 4 ++--
.../update/DropEncryptRuleStatementUpdater.java | 10 ++++-----
...lterReadwriteSplittingRuleStatementUpdater.java | 22 +++++++++---------
...eateReadwriteSplittingRuleStatementUpdater.java | 16 ++++++-------
...DropReadwriteSplittingRuleStatementUpdater.java | 20 ++++++++---------
.../checker/ShadowRuleStatementChecker.java | 12 +++++-----
.../AlterShadowAlgorithmStatementUpdater.java | 16 ++++++-------
.../update/AlterShadowRuleStatementUpdater.java | 26 +++++++++++-----------
...eateDefaultShadowAlgorithmStatementUpdater.java | 8 +++----
.../CreateShadowAlgorithmStatementUpdater.java | 14 ++++++------
.../update/CreateShadowRuleStatementUpdater.java | 24 ++++++++++----------
...DropDefaultShadowAlgorithmStatementUpdater.java | 14 ++++++------
.../DropShadowAlgorithmStatementUpdater.java | 18 +++++++--------
.../update/DropShadowRuleStatementUpdater.java | 14 ++++++------
.../CreateShardingScalingRuleStatementUpdater.java | 14 ++++++------
...DisableShardingScalingRuleStatementUpdater.java | 20 ++++++++---------
.../DropShardingScalingRuleStatementUpdater.java | 18 +++++++--------
.../EnableShardingScalingRuleStatementUpdater.java | 20 ++++++++---------
...terDefaultShardingStrategyStatementUpdater.java | 20 ++++++++---------
.../AlterShardingAlgorithmStatementUpdater.java | 8 +++----
...rShardingBindingTableRulesStatementUpdater.java | 20 ++++++++---------
...ShardingBroadcastTableRuleStatementUpdater.java | 4 ++--
.../AlterShardingKeyGeneratorStatementUpdater.java | 8 +++----
...ateDefaultShardingStrategyStatementUpdater.java | 20 ++++++++---------
.../CreateShardingAlgorithmStatementUpdater.java | 10 ++++-----
...teShardingBindingTableRuleStatementUpdater.java | 20 ++++++++---------
...ShardingBroadcastTableRuleStatementUpdater.java | 4 ++--
...CreateShardingKeyGeneratorStatementUpdater.java | 6 ++---
.../DropDefaultStrategyStatementUpdater.java | 14 ++++++------
.../DropShardingAlgorithmStatementUpdater.java | 20 ++++++++---------
...opShardingBindingTableRuleStatementUpdater.java | 14 ++++++------
...ShardingBroadcastTableRuleStatementUpdater.java | 14 ++++++------
.../DropShardingKeyGeneratorStatementUpdater.java | 20 ++++++++---------
.../DropShardingTableRuleStatementUpdater.java | 20 ++++++++---------
.../resource/RequiredResourceMissedException.java | 8 +++----
.../rdl/resource/AlterResourceBackendHandler.java | 16 ++++++-------
.../rdl/resource/DropResourceBackendHandler.java | 26 +++++++++++-----------
...lterDefaultSingleTableRuleStatementUpdater.java | 20 ++++++++---------
...eateDefaultSingleTableRuleStatementUpdater.java | 14 ++++++------
...DropDefaultSingleTableRuleStatementUpdater.java | 8 +++----
.../rdl/rule/RuleDefinitionBackendHandler.java | 4 ++--
.../resource/DropResourceBackendHandlerTest.java | 2 +-
.../src/main/resources/conf/config-sharding.yaml | 4 ++--
53 files changed, 392 insertions(+), 392 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/AlterDatabaseDiscoveryHeartbeatStatementUpdater.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/AlterDataba [...]
index bae0634ff0b..7fb125d6b6d 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/AlterDatabaseDiscoveryHeartbeatStatementUpdater.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/AlterDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -50,27 +50,27 @@ public final class AlterDatabaseDiscoveryHeartbeatStatementUpdater implements Ru
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentConfiguration(schemaName, currentRuleConfig);
- checkDuplicateHeartbeat(schemaName, sqlStatement);
- checkNotExistHeartbeat(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentConfiguration(databaseName, currentRuleConfig);
+ checkDuplicateHeartbeat(databaseName, sqlStatement);
+ checkNotExistHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentConfiguration(final String schemaName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
+ private void checkCurrentConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
}
- private void checkNotExistHeartbeat(final String schemaName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement,
+ private void checkNotExistHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentHeartbeats = currentRuleConfig.getDiscoveryHeartbeats().keySet();
Collection<String> notExistHeartbeats = sqlStatement.getHeartbeats().stream().map(DatabaseDiscoveryHeartbeatSegment::getHeartbeatName)
.filter(each -> !currentHeartbeats.contains(each)).collect(Collectors.toSet());
- DistSQLException.predictionThrow(notExistHeartbeats.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, schemaName, notExistHeartbeats));
+ DistSQLException.predictionThrow(notExistHeartbeats.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, databaseName, notExistHeartbeats));
}
- private void checkDuplicateHeartbeat(final String schemaName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicateHeartbeat(final String databaseName, final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement) throws DistSQLException {
Collection<String> duplicateRuleNames = getToBeCreatedDuplicateRuleNames(sqlStatement);
- DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, schemaName, duplicateRuleNames));
+ DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateRuleNames));
}
private Collection<String> getToBeCreatedDuplicateRuleNames(final AlterDatabaseDiscoveryHeartbeatStatement sqlStatement) {
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 093becadaec..aa7520826e1 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
@@ -60,31 +60,31 @@ public final class AlterDatabaseDiscoveryRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeAlteredRules(schemaName, sqlStatement, currentRuleConfig);
- checkToBeAlteredResources(schemaName, sqlStatement, shardingSphereMetaData.getResource());
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
+ checkToBeAlteredResources(databaseName, sqlStatement, shardingSphereMetaData.getResource());
checkDiscoverTypeAndHeartbeat(sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("database discovery", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("database discovery", databaseName));
}
- private void checkToBeAlteredRules(final String schemaName, final AlterDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkToBeAlteredRules(final String databaseName, final AlterDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getGroupName).collect(Collectors.toSet());
Collection<String> notExistedRuleNames = getToBeAlteredRuleNames(sqlStatement).stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException("database discovery", schemaName, notExistedRuleNames));
+ DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException("database discovery", databaseName, notExistedRuleNames));
}
private Collection<String> getToBeAlteredRuleNames(final AlterDatabaseDiscoveryRuleStatement sqlStatement) {
return sqlStatement.getRules().stream().map(AbstractDatabaseDiscoverySegment::getName).collect(Collectors.toList());
}
- private void checkToBeAlteredResources(final String schemaName, final AlterDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) throws DistSQLException {
+ private void checkToBeAlteredResources(final String databaseName, final AlterDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereResource resource) throws DistSQLException {
Collection<String> notExistedResources = resource.getNotExistedResources(getToBeAlteredResourceNames(sqlStatement));
- DistSQLException.predictionThrow(notExistedResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistedResources));
+ DistSQLException.predictionThrow(notExistedResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistedResources));
}
private Collection<String> getToBeAlteredResourceNames(final AlterDatabaseDiscoveryRuleStatement sqlStatement) {
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/AlterDatabaseDiscoveryTypeStatementUpdater.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 79870621c64..02d5fbc666b 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/AlterDatabaseDiscoveryTypeStatementUpdater.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/AlterDatabaseDiscoveryTypeStatementUpdater.java
@@ -52,29 +52,29 @@ public final class AlterDatabaseDiscoveryTypeStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkDuplicateDiscoveryType(schemaName, sqlStatement);
- checkNotExistDiscoveryType(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkDuplicateDiscoveryType(databaseName, sqlStatement);
+ checkNotExistDiscoveryType(databaseName, sqlStatement, currentRuleConfig);
checkInvalidDiscoverType(sqlStatement);
}
- private void checkNotExistDiscoveryType(final String schemaName, final AlterDatabaseDiscoveryTypeStatement sqlStatement,
+ private void checkNotExistDiscoveryType(final String databaseName, final AlterDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> existTypes = currentRuleConfig.getDiscoveryTypes().keySet();
Collection<String> notExistTypes = sqlStatement.getTypes().stream().map(DatabaseDiscoveryTypeSegment::getDiscoveryTypeName)
.filter(each -> !existTypes.contains(each)).collect(Collectors.toSet());
- DistSQLException.predictionThrow(notExistTypes.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
+ DistSQLException.predictionThrow(notExistTypes.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
}
- private void checkDuplicateDiscoveryType(final String schemaName, final AlterDatabaseDiscoveryTypeStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicateDiscoveryType(final String databaseName, final AlterDatabaseDiscoveryTypeStatement sqlStatement) throws DistSQLException {
Collection<String> duplicateTypeNames = getToBeAlteredDuplicateTypeNames(sqlStatement);
- DistSQLException.predictionThrow(duplicateTypeNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, schemaName, duplicateTypeNames));
+ DistSQLException.predictionThrow(duplicateTypeNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateTypeNames));
}
private Collection<String> getToBeAlteredDuplicateTypeNames(final AlterDatabaseDiscoveryTypeStatement sqlStatement) {
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/CreateDatabaseDiscoveryHeartbeatStatementUpdater.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/CreateData [...]
index 1311978a9e9..4173194d34e 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/CreateDatabaseDiscoveryHeartbeatStatementUpdater.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/CreateDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -49,11 +49,11 @@ public final class CreateDatabaseDiscoveryHeartbeatStatementUpdater implements R
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkDuplicateHeartbeat(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkDuplicateHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkDuplicateHeartbeat(final String schemaName, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement,
+ private void checkDuplicateHeartbeat(final String databaseName, final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null == currentRuleConfig) {
return;
@@ -62,7 +62,7 @@ public final class CreateDatabaseDiscoveryHeartbeatStatementUpdater implements R
Collection<String> duplicateRuleNames = sqlStatement.getHeartbeats().stream().map(DatabaseDiscoveryHeartbeatSegment::getHeartbeatName)
.filter(existRuleNames::contains).collect(Collectors.toSet());
duplicateRuleNames.addAll(getToBeCreatedDuplicateRuleNames(sqlStatement));
- DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, schemaName, duplicateRuleNames));
+ DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateRuleNames));
}
private Collection<String> getToBeCreatedDuplicateRuleNames(final CreateDatabaseDiscoveryHeartbeatStatement sqlStatement) {
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 8ad396176ba..dab8d1ec5bb 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
@@ -60,13 +60,13 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkDuplicateRuleNames(schemaName, sqlStatement, currentRuleConfig);
- checkResources(schemaName, sqlStatement, shardingSphereMetaData.getResource());
- checkDiscoverTypeAndHeartbeat(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig);
+ checkResources(databaseName, sqlStatement, shardingSphereMetaData.getResource());
+ checkDiscoverTypeAndHeartbeat(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkDuplicateRuleNames(final String schemaName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkDuplicateRuleNames(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null == currentRuleConfig) {
return;
@@ -74,7 +74,7 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
Collection<String> existRuleNames = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getGroupName).collect(Collectors.toList());
Collection<String> duplicateRuleNames = sqlStatement.getRules().stream().map(AbstractDatabaseDiscoverySegment::getName).filter(existRuleNames::contains).collect(Collectors.toSet());
duplicateRuleNames.addAll(getToBeCreatedDuplicateRuleNames(sqlStatement));
- DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE.toLowerCase(), schemaName, duplicateRuleNames));
+ DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE.toLowerCase(), databaseName, duplicateRuleNames));
}
private Collection<String> getToBeCreatedDuplicateRuleNames(final CreateDatabaseDiscoveryRuleStatement sqlStatement) {
@@ -82,17 +82,17 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
.entrySet().stream().filter(entry -> entry.getValue() > 1).map(Entry::getKey).collect(Collectors.toSet());
}
- private void checkResources(final String schemaName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkResources(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
final ShardingSphereResource resource) throws RequiredResourceMissedException {
Collection<String> resources = new LinkedHashSet<>();
sqlStatement.getRules().forEach(each -> resources.addAll(each.getDataSources()));
Collection<String> notExistResources = resource.getNotExistedResources(resources);
if (!notExistResources.isEmpty()) {
- throw new RequiredResourceMissedException(schemaName, notExistResources);
+ throw new RequiredResourceMissedException(databaseName, notExistResources);
}
}
- private void checkDiscoverTypeAndHeartbeat(final String schemaName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkDiscoverTypeAndHeartbeat(final String databaseName, final CreateDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Map<String, List<AbstractDatabaseDiscoverySegment>> segmentMap = sqlStatement.getRules().stream().collect(Collectors.groupingBy(each -> each.getClass().getSimpleName()));
Collection<String> invalidInput = segmentMap.getOrDefault(DatabaseDiscoveryDefinitionSegment.class.getSimpleName(), Collections.emptyList()).stream()
@@ -108,7 +108,7 @@ public final class CreateDatabaseDiscoveryRuleStatementUpdater implements RuleDe
invalidInput.add(each.getDiscoveryHeartbeatName());
}
});
- DistSQLException.predictionThrow(invalidInput.isEmpty(), () -> new RequiredAlgorithmMissedException(RULE_TYPE, schemaName, invalidInput));
+ DistSQLException.predictionThrow(invalidInput.isEmpty(), () -> new RequiredAlgorithmMissedException(RULE_TYPE, databaseName, invalidInput));
}
@Override
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/CreateDatabaseDiscoveryTypeStatementUpdater.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 4d2bf6282a9..d1f7b2ccd2d 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/CreateDatabaseDiscoveryTypeStatementUpdater.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/CreateDatabaseDiscoveryTypeStatementUpdater.java
@@ -51,12 +51,12 @@ public final class CreateDatabaseDiscoveryTypeStatementUpdater implements RuleDe
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkDuplicateDiscoveryType(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkDuplicateDiscoveryType(databaseName, sqlStatement, currentRuleConfig);
checkInvalidDiscoverType(sqlStatement);
}
- private void checkDuplicateDiscoveryType(final String schemaName, final CreateDatabaseDiscoveryTypeStatement sqlStatement,
+ private void checkDuplicateDiscoveryType(final String databaseName, final CreateDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null == currentRuleConfig) {
return;
@@ -64,7 +64,7 @@ public final class CreateDatabaseDiscoveryTypeStatementUpdater implements RuleDe
Collection<String> existRuleNames = currentRuleConfig.getDiscoveryTypes().keySet();
Collection<String> duplicateRuleNames = sqlStatement.getTypes().stream().map(DatabaseDiscoveryTypeSegment::getDiscoveryTypeName).filter(existRuleNames::contains).collect(Collectors.toSet());
duplicateRuleNames.addAll(getToBeCreatedDuplicateRuleNames(sqlStatement));
- DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, schemaName, duplicateRuleNames));
+ DistSQLException.predictionThrow(duplicateRuleNames.isEmpty(), () -> new DuplicateRuleException(RULE_TYPE, databaseName, duplicateRuleNames));
}
private Collection<String> getToBeCreatedDuplicateRuleNames(final CreateDatabaseDiscoveryTypeStatement sqlStatement) {
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/DropDatabaseDiscoveryHeartbeatStatementUpdater.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/DropDatabase [...]
index 98b7fc1874b..c6341355884 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/DropDatabaseDiscoveryHeartbeatStatementUpdater.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/DropDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -39,32 +39,32 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, sqlStatement, currentRuleConfig);
- checkIsInUse(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
+ checkIsInUse(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
- checkIsExist(schemaName, sqlStatement, currentRuleConfig);
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
+ checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String schemaName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDiscoveryHeartbeats().keySet();
Collection<String> notExistedRuleNames = sqlStatement.getHeartbeatNames().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, schemaName, notExistedRuleNames));
+ DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, databaseName, notExistedRuleNames));
}
- private void checkIsInUse(final String schemaName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryHeartbeatStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> heartbeatInUse = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getDiscoveryHeartbeatName).collect(Collectors.toSet());
Collection<String> invalid = sqlStatement.getHeartbeatNames().stream().filter(heartbeatInUse::contains).collect(Collectors.toList());
- DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, schemaName, invalid));
+ DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, databaseName, invalid));
}
@Override
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 e372a081322..2b9128a38c6 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
@@ -43,34 +43,34 @@ public final class DropDatabaseDiscoveryRuleStatementUpdater implements RuleDefi
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, sqlStatement, currentRuleConfig);
- checkIsInUse(schemaName, sqlStatement, shardingSphereMetaData);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
+ checkIsInUse(databaseName, sqlStatement, shardingSphereMetaData);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
- checkIsExist(schemaName, sqlStatement, currentRuleConfig);
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
+ checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String schemaName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getGroupName).collect(Collectors.toList());
Collection<String> notExistedRuleNames = sqlStatement.getRuleNames().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
+ DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
}
- private void checkIsInUse(final String schemaName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereMetaData shardingSphereMetaData) throws DistSQLException {
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement, final ShardingSphereMetaData shardingSphereMetaData) throws DistSQLException {
Collection<String> rulesInUse = shardingSphereMetaData.getRuleMetaData().findRules(ExportableRule.class).stream()
.filter(each -> each.containExportableKey(Collections.singletonList(ExportableConstants.EXPORTABLE_KEY_AUTO_AWARE_DATA_SOURCE_NAME)))
.map(each -> each.export(ExportableConstants.EXPORTABLE_KEY_AUTO_AWARE_DATA_SOURCE_NAME)).filter(Optional::isPresent)
.map(each -> (Collection<String>) each.get()).flatMap(Collection::stream).collect(Collectors.toSet());
Collection<String> invalid = sqlStatement.getRuleNames().stream().filter(rulesInUse::contains).collect(Collectors.toList());
- DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, schemaName, invalid));
+ DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, databaseName, invalid));
}
@Override
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/DropDatabaseDiscoveryTypeStatementUpdater.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 5e03a27652c..d1bca2c0781 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/DropDatabaseDiscoveryTypeStatementUpdater.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/DropDatabaseDiscoveryTypeStatementUpdater.java
@@ -39,32 +39,32 @@ public final class DropDatabaseDiscoveryTypeStatementUpdater implements RuleDefi
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, sqlStatement, currentRuleConfig);
- checkIsInUse(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
+ checkIsInUse(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, schemaName));
- checkIsExist(schemaName, sqlStatement, currentRuleConfig);
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
+ checkIsExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkIsExist(final String schemaName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
+ private void checkIsExist(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDiscoveryTypes().keySet();
Collection<String> notExistedRuleNames = sqlStatement.getTypes().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, schemaName, notExistedRuleNames));
+ DistSQLException.predictionThrow(notExistedRuleNames.isEmpty(), () -> new RequiredRuleMissedException(RULE_TYPE, databaseName, notExistedRuleNames));
}
- private void checkIsInUse(final String schemaName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
+ private void checkIsInUse(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> heartbeatInUse = currentRuleConfig.getDataSources().stream().map(DatabaseDiscoveryDataSourceRuleConfiguration::getDiscoveryTypeName).collect(Collectors.toSet());
Collection<String> invalid = sqlStatement.getTypes().stream().filter(heartbeatInUse::contains).collect(Collectors.toList());
- DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, schemaName, invalid));
+ DistSQLException.predictionThrow(invalid.isEmpty(), () -> new RuleInUsedException(RULE_TYPE, databaseName, invalid));
}
@Override
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 be3959e8532..4c240b953fd 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
@@ -56,23 +56,23 @@ public final class AlterEncryptRuleStatementUpdater implements RuleDefinitionAlt
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterEncryptRuleStatement sqlStatement,
final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeAlteredRules(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
checkToBeAlteredEncryptors(sqlStatement);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final EncryptRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final EncryptRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Encrypt", schemaName);
+ throw new RequiredRuleMissedException("Encrypt", databaseName);
}
}
- private void checkToBeAlteredRules(final String schemaName, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkToBeAlteredRules(final String databaseName, final AlterEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentEncryptTableNames = currentRuleConfig.getTables().stream().map(EncryptTableRuleConfiguration::getName).collect(Collectors.toList());
Collection<String> notExistEncryptTableNames = getToBeAlteredEncryptTableNames(sqlStatement).stream().filter(each -> !currentEncryptTableNames.contains(each)).collect(Collectors.toList());
if (!notExistEncryptTableNames.isEmpty()) {
- throw new RequiredRuleMissedException("Encrypt", schemaName, notExistEncryptTableNames);
+ throw new RequiredRuleMissedException("Encrypt", databaseName, notExistEncryptTableNames);
}
checkDataType(sqlStatement);
}
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 741fe5fac94..a4651a94308 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
@@ -59,12 +59,12 @@ public final class CreateEncryptRuleStatementUpdater implements RuleDefinitionCr
// TODO check resource
}
- private void checkDuplicateRuleNames(final String schemaName, final CreateEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DuplicateRuleException {
+ private void checkDuplicateRuleNames(final String databaseName, final CreateEncryptRuleStatement sqlStatement, final EncryptRuleConfiguration currentRuleConfig) throws DuplicateRuleException {
if (null != currentRuleConfig) {
Collection<String> currentRuleNames = currentRuleConfig.getTables().stream().map(EncryptTableRuleConfiguration::getName).collect(Collectors.toList());
Collection<String> toBeCreatedDuplicateRuleNames = sqlStatement.getRules().stream().map(EncryptRuleSegment::getTableName).filter(currentRuleNames::contains).collect(Collectors.toList());
if (!toBeCreatedDuplicateRuleNames.isEmpty()) {
- throw new DuplicateRuleException("encrypt", schemaName, toBeCreatedDuplicateRuleNames);
+ throw new DuplicateRuleException("encrypt", databaseName, toBeCreatedDuplicateRuleNames);
}
}
}
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 229c1fbf482..df9c532173a 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
@@ -37,19 +37,19 @@ public final class DropEncryptRuleStatementUpdater implements RuleDefinitionDrop
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropEncryptRuleStatement sqlStatement,
final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkToBeDroppedEncryptTableNames(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkToBeDroppedEncryptTableNames(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkToBeDroppedEncryptTableNames(final String schemaName, final DropEncryptRuleStatement sqlStatement,
+ private void checkToBeDroppedEncryptTableNames(final String databaseName, final DropEncryptRuleStatement sqlStatement,
final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
- DistSQLException.predictionThrow(isExistRuleConfig(currentRuleConfig), () -> new RequiredRuleMissedException("Encrypt", schemaName));
+ DistSQLException.predictionThrow(isExistRuleConfig(currentRuleConfig), () -> new RequiredRuleMissedException("Encrypt", databaseName));
Collection<String> currentEncryptTableNames = currentRuleConfig.getTables().stream().map(EncryptTableRuleConfiguration::getName).collect(Collectors.toList());
Collection<String> notExistedTableNames = sqlStatement.getTables().stream().filter(each -> !currentEncryptTableNames.contains(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedTableNames.isEmpty(), () -> new RequiredRuleMissedException("Encrypt", schemaName, notExistedTableNames));
+ DistSQLException.predictionThrow(notExistedTableNames.isEmpty(), () -> new RequiredRuleMissedException("Encrypt", databaseName, notExistedTableNames));
}
@Override
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 c9d6fb80fc7..cdab25bda26 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
@@ -60,25 +60,25 @@ public final class AlterReadwriteSplittingRuleStatementUpdater implements RuleDe
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeAlteredRules(schemaName, sqlStatement, currentRuleConfig);
- checkToBeAlteredResources(schemaName, sqlStatement, shardingSphereMetaData);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeAlteredRules(databaseName, sqlStatement, currentRuleConfig);
+ checkToBeAlteredResources(databaseName, sqlStatement, shardingSphereMetaData);
checkToBeAlteredLoadBalancer(sqlStatement);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Readwrite splitting", schemaName);
+ throw new RequiredRuleMissedException("Readwrite splitting", databaseName);
}
}
- private void checkToBeAlteredRules(final String schemaName, final AlterReadwriteSplittingRuleStatement sqlStatement,
+ private void checkToBeAlteredRules(final String databaseName, final AlterReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(ReadwriteSplittingDataSourceRuleConfiguration::getName).collect(Collectors.toSet());
Collection<String> notExistedRuleNames = getToBeAlteredRuleNames(sqlStatement).stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
if (!notExistedRuleNames.isEmpty()) {
- throw new RequiredRuleMissedException("Readwrite splitting", schemaName, notExistedRuleNames);
+ throw new RequiredRuleMissedException("Readwrite splitting", databaseName, notExistedRuleNames);
}
}
@@ -94,7 +94,7 @@ public final class AlterReadwriteSplittingRuleStatementUpdater implements RuleDe
}
}
- private void checkToBeAlteredResources(final String schemaName, final AlterReadwriteSplittingRuleStatement sqlStatement,
+ private void checkToBeAlteredResources(final String databaseName, final AlterReadwriteSplittingRuleStatement sqlStatement,
final ShardingSphereMetaData shardingSphereMetaData) throws DistSQLException {
Collection<String> requireResources = new LinkedHashSet<>();
Collection<String> requireDiscoverableResources = new LinkedHashSet<>();
@@ -107,10 +107,10 @@ public final class AlterReadwriteSplittingRuleStatementUpdater implements RuleDe
}
});
Collection<String> notExistResources = shardingSphereMetaData.getResource().getNotExistedResources(requireResources);
- DistSQLException.predictionThrow(notExistResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistResources));
+ DistSQLException.predictionThrow(notExistResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistResources));
Collection<String> logicResources = getLogicResources(shardingSphereMetaData);
Set<String> notExistLogicResources = requireDiscoverableResources.stream().filter(each -> !logicResources.contains(each)).collect(Collectors.toSet());
- DistSQLException.predictionThrow(notExistLogicResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistLogicResources));
+ DistSQLException.predictionThrow(notExistLogicResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistLogicResources));
}
private Collection<String> getLogicResources(final ShardingSphereMetaData shardingSphereMetaData) {
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 8f804e10b52..73d74d62693 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
@@ -61,13 +61,13 @@ public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkDuplicateRuleNames(schemaName, sqlStatement, currentRuleConfig, shardingSphereMetaData.getResource());
- checkToBeCreatedResources(schemaName, sqlStatement, shardingSphereMetaData);
+ String databaseName = shardingSphereMetaData.getName();
+ checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig, shardingSphereMetaData.getResource());
+ checkToBeCreatedResources(databaseName, sqlStatement, shardingSphereMetaData);
checkToBeCreatedLoadBalancers(sqlStatement);
}
- private void checkDuplicateRuleNames(final String schemaName, final CreateReadwriteSplittingRuleStatement sqlStatement,
+ private void checkDuplicateRuleNames(final String databaseName, final CreateReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig, final ShardingSphereResource resource) throws DistSQLException {
Collection<String> currentRuleNames = new ArrayList<>();
if (null != resource && null != resource.getDataSources()) {
@@ -82,11 +82,11 @@ public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleD
}
duplicateRuleNames = sqlStatement.getRules().stream().map(ReadwriteSplittingRuleSegment::getName).filter(currentRuleNames::contains).collect(Collectors.toList());
if (!duplicateRuleNames.isEmpty()) {
- throw new DuplicateRuleException("readwrite splitting", schemaName, duplicateRuleNames);
+ throw new DuplicateRuleException("readwrite splitting", databaseName, duplicateRuleNames);
}
}
- private void checkToBeCreatedResources(final String schemaName, final CreateReadwriteSplittingRuleStatement sqlStatement,
+ private void checkToBeCreatedResources(final String databaseName, final CreateReadwriteSplittingRuleStatement sqlStatement,
final ShardingSphereMetaData shardingSphereMetaData) throws DistSQLException {
Collection<String> requireResources = new LinkedHashSet<>();
Collection<String> requireDiscoverableResources = new LinkedHashSet<>();
@@ -99,10 +99,10 @@ public final class CreateReadwriteSplittingRuleStatementUpdater implements RuleD
}
});
Collection<String> notExistResources = shardingSphereMetaData.getResource().getNotExistedResources(requireResources);
- DistSQLException.predictionThrow(notExistResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistResources));
+ DistSQLException.predictionThrow(notExistResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistResources));
Collection<String> logicResources = getLogicResources(shardingSphereMetaData);
Set<String> notExistLogicResources = requireDiscoverableResources.stream().filter(each -> !logicResources.contains(each)).collect(Collectors.toSet());
- DistSQLException.predictionThrow(notExistLogicResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistLogicResources));
+ DistSQLException.predictionThrow(notExistLogicResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistLogicResources));
}
private Collection<String> getLogicResources(final ShardingSphereMetaData shardingSphereMetaData) {
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 912834e7d50..bb976547595 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
@@ -40,22 +40,22 @@ public final class DropReadwriteSplittingRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeDroppedRuleNames(schemaName, sqlStatement, currentRuleConfig);
- checkToBeDroppedInUsed(schemaName, sqlStatement, shardingSphereMetaData);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeDroppedRuleNames(databaseName, sqlStatement, currentRuleConfig);
+ checkToBeDroppedInUsed(databaseName, sqlStatement, shardingSphereMetaData);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Readwrite splitting", schemaName);
+ throw new RequiredRuleMissedException("Readwrite splitting", databaseName);
}
}
- private void checkToBeDroppedRuleNames(final String schemaName, final DropReadwriteSplittingRuleStatement sqlStatement,
+ private void checkToBeDroppedRuleNames(final String databaseName, final DropReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (sqlStatement.isContainsExistClause()) {
return;
@@ -63,17 +63,17 @@ public final class DropReadwriteSplittingRuleStatementUpdater implements RuleDef
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(ReadwriteSplittingDataSourceRuleConfiguration::getName).collect(Collectors.toList());
Collection<String> notExistedRuleNames = sqlStatement.getRuleNames().stream().filter(each -> !currentRuleNames.contains(each)).collect(Collectors.toList());
if (!notExistedRuleNames.isEmpty()) {
- throw new RequiredRuleMissedException("Readwrite splitting", schemaName, sqlStatement.getRuleNames());
+ throw new RequiredRuleMissedException("Readwrite splitting", databaseName, sqlStatement.getRuleNames());
}
}
- private void checkToBeDroppedInUsed(final String schemaName, final DropReadwriteSplittingRuleStatement sqlStatement,
+ private void checkToBeDroppedInUsed(final String databaseName, final DropReadwriteSplittingRuleStatement sqlStatement,
final ShardingSphereMetaData shardingSphereMetaData) throws RuleInUsedException {
Collection<String> resourceBeUsed = shardingSphereMetaData.getRuleMetaData().findRuleConfiguration(ResourceRequiredRuleConfiguration.class).stream()
.map(ResourceRequiredRuleConfiguration::getRequiredResource).flatMap(Collection::stream).collect(Collectors.toSet());
Collection<String> ruleInUsed = sqlStatement.getRuleNames().stream().filter(resourceBeUsed::contains).collect(Collectors.toSet());
if (!ruleInUsed.isEmpty()) {
- throw new RuleInUsedException("Readwrite splitting", schemaName, ruleInUsed);
+ throw new RuleInUsedException("Readwrite splitting", databaseName, ruleInUsed);
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
index 98385440b67..3689105d35a 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java
@@ -41,12 +41,12 @@ public class ShadowRuleStatementChecker {
/**
* Check if the configuration exists.
*
- * @param schemaName schema name
+ * @param databaseName database name
* @param configuration configuration
* @throws DistSQLException DistSQL exception
*/
- public static void checkConfigurationExist(final String schemaName, final SchemaRuleConfiguration configuration) throws DistSQLException {
- DistSQLException.predictionThrow(null != configuration, () -> new RequiredRuleMissedException(SHADOW, schemaName));
+ public static void checkConfigurationExist(final String databaseName, final SchemaRuleConfiguration configuration) throws DistSQLException {
+ DistSQLException.predictionThrow(null != configuration, () -> new RequiredRuleMissedException(SHADOW, databaseName));
}
/**
@@ -54,12 +54,12 @@ public class ShadowRuleStatementChecker {
*
* @param resources resource being checked
* @param metaData meta rules
- * @param schemaName schema name
+ * @param databaseName database name
* @throws DistSQLException DistSQL exception
*/
- public static void checkResourceExist(final Collection<String> resources, final ShardingSphereMetaData metaData, final String schemaName) throws DistSQLException {
+ public static void checkResourceExist(final Collection<String> resources, final ShardingSphereMetaData metaData, final String databaseName) throws DistSQLException {
Collection<String> notExistedResources = metaData.getResource().getNotExistedResources(resources);
- DistSQLException.predictionThrow(notExistedResources.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistedResources));
+ DistSQLException.predictionThrow(notExistedResources.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistedResources));
}
/**
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
index e5fb7e0dd4f..5e0ad760ae7 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowAlgorithmStatementUpdater.java
@@ -59,21 +59,21 @@ public final class AlterShadowAlgorithmStatementUpdater implements RuleDefinitio
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkAlgorithms(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = metaData.getName();
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkAlgorithms(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String schemaName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- ShadowRuleStatementChecker.checkConfigurationExist(schemaName, currentRuleConfig);
+ private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithms(final String schemaName, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final AlterShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
ShadowRuleStatementChecker.checkAlgorithmCompleteness(sqlStatement.getAlgorithms());
Collection<String> requireAlgorithmNames = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList());
- ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new AlgorithmInUsedException(schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new AlgorithmInUsedException(databaseName, duplicate));
ShadowRuleStatementChecker.checkAlgorithmExist(requireAlgorithmNames, currentRuleConfig.getShadowAlgorithms().keySet(),
- different -> new RequiredAlgorithmMissedException(SHADOW, schemaName, different));
+ different -> new RequiredAlgorithmMissedException(SHADOW, databaseName, different));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
index 73b2364eb7c..0c1fde8832b 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleStatementUpdater.java
@@ -68,35 +68,35 @@ public final class AlterShadowRuleStatementUpdater implements RuleDefinitionAlte
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final AlterShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
Collection<ShadowRuleSegment> rules = sqlStatement.getRules();
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkRuleNames(schemaName, rules, currentRuleConfig);
- checkResources(schemaName, rules, metaData);
- checkAlgorithms(schemaName, rules);
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkRuleNames(databaseName, rules, currentRuleConfig);
+ checkResources(databaseName, rules, metaData);
+ checkAlgorithms(databaseName, rules);
}
- private void checkConfigurationExist(final String schemaName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
- ShadowRuleStatementChecker.checkConfigurationExist(schemaName, currentRuleConfig);
+ private void checkConfigurationExist(final String databaseName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
+ ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkRuleNames(final String schemaName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = ShadowRuleStatementSupporter.getRuleNames(currentRuleConfig);
Collection<String> requireRuleNames = ShadowRuleStatementSupporter.getRuleNames(rules);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicate -> new DuplicateRuleException(SHADOW, schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicate -> new DuplicateRuleException(SHADOW, databaseName, duplicate));
ShadowRuleStatementChecker.checkRulesExist(requireRuleNames, currentRuleNames, different -> new InvalidAlgorithmConfigurationException("shadow rule name ", different));
}
- private void checkResources(final String schemaName, final Collection<ShadowRuleSegment> rules, final ShardingSphereMetaData metaData) throws DistSQLException {
+ private void checkResources(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShardingSphereMetaData metaData) throws DistSQLException {
Collection<String> requireResource = ShadowRuleStatementSupporter.getResourceNames(rules);
- ShadowRuleStatementChecker.checkResourceExist(requireResource, metaData, schemaName);
+ ShadowRuleStatementChecker.checkResourceExist(requireResource, metaData, databaseName);
}
- private void checkAlgorithms(final String schemaName, final Collection<ShadowRuleSegment> rules) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules) throws DistSQLException {
Collection<ShadowAlgorithmSegment> shadowAlgorithmSegment = ShadowRuleStatementSupporter.getShadowAlgorithmSegment(rules);
ShadowRuleStatementChecker.checkAlgorithmCompleteness(shadowAlgorithmSegment);
Collection<String> requireAlgorithms = ShadowRuleStatementSupporter.getAlgorithmNames(rules);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithms, duplicate -> new AlgorithmInUsedException(schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithms, duplicate -> new AlgorithmInUsedException(databaseName, duplicate));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
index 3eef878dcb6..8506a05765a 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
@@ -47,13 +47,13 @@ public final class CreateDefaultShadowAlgorithmStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final CreateDefaultShadowAlgorithmStatement sqlStatement,
final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
- checkAlgorithmExist(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = metaData.getName();
+ checkAlgorithmExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkAlgorithmExist(final String schemaName, final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithmExist(final String databaseName, final CreateDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
DistSQLException.predictionThrow(currentRuleConfig.getShadowAlgorithms().containsKey(sqlStatement.getAlgorithmName()),
- () -> new RequiredAlgorithmMissedException(schemaName, Collections.singleton(sqlStatement.getAlgorithmName())));
+ () -> new RequiredAlgorithmMissedException(databaseName, Collections.singleton(sqlStatement.getAlgorithmName())));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
index 034f1e85294..26bb15bffa6 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowAlgorithmStatementUpdater.java
@@ -63,10 +63,10 @@ public final class CreateShadowAlgorithmStatementUpdater implements RuleDefiniti
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
ShadowRuleStatementChecker.checkAlgorithmCompleteness(sqlStatement.getAlgorithms());
- checkDuplicatedInput(schemaName, sqlStatement);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
+ checkDuplicatedInput(databaseName, sqlStatement);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
checkAlgorithmType(sqlStatement);
}
@@ -76,18 +76,18 @@ public final class CreateShadowAlgorithmStatementUpdater implements RuleDefiniti
DistSQLException.predictionThrow(notExistedShardingAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException(SHADOW, notExistedShardingAlgorithms));
}
- private void checkDuplicatedInput(final String schemaName, final CreateShadowAlgorithmStatement sqlStatement) throws DistSQLException {
+ private void checkDuplicatedInput(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement) throws DistSQLException {
Collection<String> requireAlgorithmNames = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList());
- ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, databaseName, duplicate));
}
- private void checkExist(final String schemaName, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final CreateShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null == currentRuleConfig) {
return;
}
Collection<String> requireAlgorithmNames = sqlStatement.getAlgorithms().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList());
ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, currentRuleConfig.getShadowAlgorithms().keySet(),
- different -> new DuplicateRuleException(SHADOW, schemaName, different));
+ different -> new DuplicateRuleException(SHADOW, databaseName, different));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
index b707091b9a9..2858c036306 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateShadowRuleStatementUpdater.java
@@ -61,32 +61,32 @@ public final class CreateShadowRuleStatementUpdater implements RuleDefinitionCre
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final CreateShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
Collection<ShadowRuleSegment> rules = sqlStatement.getRules();
- checkRuleNames(schemaName, rules, currentRuleConfig);
- checkResources(schemaName, rules, metaData);
- checkAlgorithms(schemaName, rules, currentRuleConfig);
+ checkRuleNames(databaseName, rules, currentRuleConfig);
+ checkResources(databaseName, rules, metaData);
+ checkAlgorithms(databaseName, rules, currentRuleConfig);
}
- private void checkRuleNames(final String schemaName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> requireRuleNames = ShadowRuleStatementSupporter.getRuleNames(rules);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicate -> new DuplicateRuleException(SHADOW, schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, duplicate -> new DuplicateRuleException(SHADOW, databaseName, duplicate));
Collection<String> currentRuleName = ShadowRuleStatementSupporter.getRuleNames(currentRuleConfig);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, currentRuleName, identical -> new DuplicateRuleException(SHADOW, schemaName, identical));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireRuleNames, currentRuleName, identical -> new DuplicateRuleException(SHADOW, databaseName, identical));
}
- private void checkResources(final String schemaName, final Collection<ShadowRuleSegment> rules, final ShardingSphereMetaData metaData) throws DistSQLException {
+ private void checkResources(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShardingSphereMetaData metaData) throws DistSQLException {
Collection<String> requireResource = ShadowRuleStatementSupporter.getResourceNames(rules);
- ShadowRuleStatementChecker.checkResourceExist(requireResource, metaData, schemaName);
+ ShadowRuleStatementChecker.checkResourceExist(requireResource, metaData, databaseName);
}
- private void checkAlgorithms(final String schemaName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithms(final String databaseName, final Collection<ShadowRuleSegment> rules, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<ShadowAlgorithmSegment> requireAlgorithms = ShadowRuleStatementSupporter.getShadowAlgorithmSegment(rules);
ShadowRuleStatementChecker.checkAlgorithmCompleteness(requireAlgorithms);
Collection<String> requireAlgorithmNames = ShadowRuleStatementSupporter.getAlgorithmNames(rules);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, databaseName, duplicate));
Collection<String> currentAlgorithmNames = ShadowRuleStatementSupporter.getAlgorithmNames(currentRuleConfig);
- ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, currentAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, schemaName, duplicate));
+ ShadowRuleStatementChecker.checkAnyDuplicate(requireAlgorithmNames, currentAlgorithmNames, duplicate -> new DuplicateRuleException(SHADOW, databaseName, duplicate));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
index f4f00371354..a243431ca58 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
@@ -38,22 +38,22 @@ public final class DropDefaultShadowAlgorithmStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final DropDefaultShadowAlgorithmStatement sqlStatement,
final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
if (sqlStatement.isContainsExistClause() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkAlgorithm(schemaName, sqlStatement, currentRuleConfig);
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkAlgorithm(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String schemaName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
- ShadowRuleStatementChecker.checkConfigurationExist(schemaName, currentRuleConfig);
+ private void checkConfigurationExist(final String databaseName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
+ ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithm(final String schemaName, final DropDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final DropDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
if (!sqlStatement.isContainsExistClause()) {
DistSQLException.predictionThrow(null != currentRuleConfig.getDefaultShadowAlgorithmName(),
- () -> new RequiredAlgorithmMissedException(SHADOW, schemaName, Collections.singleton("default")));
+ () -> new RequiredAlgorithmMissedException(SHADOW, databaseName, Collections.singleton("default")));
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
index 17e66cfbf81..206f89b0a91 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
@@ -45,27 +45,27 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
if (sqlStatement.isContainsExistClause() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkAlgorithm(schemaName, sqlStatement, currentRuleConfig);
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkAlgorithm(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String schemaName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
- ShadowRuleStatementChecker.checkConfigurationExist(schemaName, currentRuleConfig);
+ private void checkConfigurationExist(final String databaseName, final SchemaRuleConfiguration currentRuleConfig) throws DistSQLException {
+ ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkAlgorithm(final String schemaName, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentAlgorithms = ShadowRuleStatementSupporter.getAlgorithmNames(currentRuleConfig);
Collection<String> requireAlgorithms = sqlStatement.getAlgorithmNames();
String defaultShadowAlgorithmName = currentRuleConfig.getDefaultShadowAlgorithmName();
if (!sqlStatement.isContainsExistClause()) {
- ShadowRuleStatementChecker.checkAlgorithmExist(requireAlgorithms, currentAlgorithms, different -> new RequiredAlgorithmMissedException(SHADOW, schemaName, different));
+ ShadowRuleStatementChecker.checkAlgorithmExist(requireAlgorithms, currentAlgorithms, different -> new RequiredAlgorithmMissedException(SHADOW, databaseName, different));
}
- checkAlgorithmInUsed(requireAlgorithms, getAlgorithmInUse(currentRuleConfig), identical -> new AlgorithmInUsedException(schemaName, identical));
- DistSQLException.predictionThrow(!requireAlgorithms.contains(defaultShadowAlgorithmName), () -> new AlgorithmInUsedException(schemaName, Collections.singleton(defaultShadowAlgorithmName)));
+ checkAlgorithmInUsed(requireAlgorithms, getAlgorithmInUse(currentRuleConfig), identical -> new AlgorithmInUsedException(databaseName, identical));
+ DistSQLException.predictionThrow(!requireAlgorithms.contains(defaultShadowAlgorithmName), () -> new AlgorithmInUsedException(databaseName, Collections.singleton(defaultShadowAlgorithmName)));
}
private void checkAlgorithmInUsed(final Collection<String> requireAlgorithms, final Collection<String> currentAlgorithms,
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
index eefcb298da2..81d11bd5688 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
@@ -36,22 +36,22 @@ public final class DropShadowRuleStatementUpdater implements RuleDefinitionDropU
@Override
public void checkSQLStatement(final ShardingSphereMetaData metaData, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = metaData.getName();
+ String databaseName = metaData.getName();
if (sqlStatement.isContainsExistClause() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkRuleNames(schemaName, sqlStatement, currentRuleConfig);
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkRuleNames(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkConfigurationExist(final String schemaName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- ShadowRuleStatementChecker.checkConfigurationExist(schemaName, currentRuleConfig);
+ private void checkConfigurationExist(final String databaseName, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ ShadowRuleStatementChecker.checkConfigurationExist(databaseName, currentRuleConfig);
}
- private void checkRuleNames(final String schemaName, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkRuleNames(final String databaseName, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().keySet();
if (!sqlStatement.isContainsExistClause()) {
- ShadowRuleStatementChecker.checkRulesExist(sqlStatement.getRuleNames(), currentRuleNames, different -> new RequiredRuleMissedException(SHADOW, schemaName, different));
+ ShadowRuleStatementChecker.checkRulesExist(sqlStatement.getRuleNames(), currentRuleNames, different -> new RequiredRuleMissedException(SHADOW, databaseName, different));
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/CreateShardingScalingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/CreateShardingScalingRuleStatementUpdater.java
index c04285f3405..032ad2002e7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/CreateShardingScalingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/CreateShardingScalingRuleStatementUpdater.java
@@ -58,21 +58,21 @@ public final class CreateShardingScalingRuleStatementUpdater implements RuleDefi
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateShardingScalingRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkDuplicate(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkDuplicate(databaseName, sqlStatement, currentRuleConfig);
checkAlgorithms(sqlStatement.getConfigurationSegment());
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkDuplicate(final String schemaName, final CreateShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (currentRuleConfig.getScaling().containsKey(sqlStatement.getScalingName())) {
- throw new DuplicateRuleException("Scaling", schemaName, Collections.singletonList(sqlStatement.getScalingName()));
+ throw new DuplicateRuleException("Scaling", databaseName, Collections.singletonList(sqlStatement.getScalingName()));
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DisableShardingScalingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DisableShardingScalingRuleStatementUpdater.java
index 7a929b5f9c0..b8cf484b199 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DisableShardingScalingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DisableShardingScalingRuleStatementUpdater.java
@@ -33,27 +33,27 @@ public final class DisableShardingScalingRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DisableShardingScalingRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
- checkDisabled(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
+ checkDisabled(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkExist(final String schemaName, final DisableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final DisableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (!currentRuleConfig.getScaling().containsKey(sqlStatement.getScalingName())) {
- throw new RequiredRuleMissedException("Scaling", schemaName, sqlStatement.getScalingName());
+ throw new RequiredRuleMissedException("Scaling", databaseName, sqlStatement.getScalingName());
}
}
- private void checkDisabled(final String schemaName, final DisableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDisabled(final String databaseName, final DisableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null == currentRuleConfig.getScalingName() || !currentRuleConfig.getScalingName().equals(sqlStatement.getScalingName())) {
- throw new RuleDisabledException("Scaling", schemaName, sqlStatement.getScalingName());
+ throw new RuleDisabledException("Scaling", databaseName, sqlStatement.getScalingName());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
index 75e2920e38a..b184dff627c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
@@ -32,31 +32,31 @@ public final class DropShardingScalingRuleStatementUpdater implements RuleDefini
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropShardingScalingRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkStatement(schemaName, sqlStatement, currentRuleConfig);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkStatement(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkStatement(final String schemaName, final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- checkExist(schemaName, sqlStatement, currentRuleConfig);
+ private void checkStatement(final String databaseName, final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
// TODO checkNotInUse
}
- private void checkExist(final String schemaName, final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
if (!currentRuleConfig.getScaling().containsKey(sqlStatement.getScalingName())) {
- throw new RequiredRuleMissedException("Scaling", schemaName, sqlStatement.getScalingName());
+ throw new RequiredRuleMissedException("Scaling", databaseName, sqlStatement.getScalingName());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/EnableShardingScalingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/EnableShardingScalingRuleStatementUpdater.java
index 919058c2dd0..55e5254541d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/EnableShardingScalingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/EnableShardingScalingRuleStatementUpdater.java
@@ -33,27 +33,27 @@ public final class EnableShardingScalingRuleStatementUpdater implements RuleDefi
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final EnableShardingScalingRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
- checkEnabled(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
+ checkEnabled(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkExist(final String schemaName, final EnableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final EnableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (!currentRuleConfig.getScaling().containsKey(sqlStatement.getScalingName())) {
- throw new RequiredRuleMissedException("Scaling", schemaName, sqlStatement.getScalingName());
+ throw new RequiredRuleMissedException("Scaling", databaseName, sqlStatement.getScalingName());
}
}
- private void checkEnabled(final String schemaName, final EnableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkEnabled(final String databaseName, final EnableShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null != currentRuleConfig.getScalingName() && currentRuleConfig.getScalingName().equals(sqlStatement.getScalingName())) {
- throw new RuleEnabledException("Scaling", schemaName, sqlStatement.getScalingName());
+ throw new RuleEnabledException("Scaling", databaseName, sqlStatement.getScalingName());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
index 316f005e4ed..3a789daf2b6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
@@ -45,17 +45,17 @@ public final class AlterDefaultShardingStrategyStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterDefaultShardingStrategyStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkAlgorithm(schemaName, currentRuleConfig, sqlStatement);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkAlgorithm(databaseName, currentRuleConfig, sqlStatement);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException("Sharding", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException("Sharding", databaseName));
}
- private void checkAlgorithm(final String schemaName, final ShardingRuleConfiguration currentRuleConfig, final AlterDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final AlterDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
DistSQLException.predictionThrow(ShardingStrategyType.contain(sqlStatement.getStrategyType()), () -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
DistSQLException.predictionThrow(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType()).isValid(sqlStatement.getShardingColumn()),
() -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
@@ -64,17 +64,17 @@ public final class AlterDefaultShardingStrategyStatementUpdater implements RuleD
return;
}
boolean isAlgorithmExist = currentRuleConfig.getShardingAlgorithms().containsKey(sqlStatement.getShardingAlgorithmName());
- DistSQLException.predictionThrow(isAlgorithmExist, () -> new RequiredAlgorithmMissedException(schemaName, Collections.singleton(sqlStatement.getShardingAlgorithmName())));
+ DistSQLException.predictionThrow(isAlgorithmExist, () -> new RequiredAlgorithmMissedException(databaseName, Collections.singleton(sqlStatement.getShardingAlgorithmName())));
}
private boolean isAlgorithmDefinitionExists(final AlterDefaultShardingStrategyStatement sqlStatement) {
return null != sqlStatement.getShardingAlgorithmName() || null != sqlStatement.getAlgorithmSegment();
}
- private void checkExist(final String schemaName, final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final AlterDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Optional<ShardingStrategyConfiguration> strategyConfiguration = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
DistSQLException.predictionThrow(strategyConfiguration.isPresent(),
- () -> new RequiredRuleMissedException(String.format("Default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), schemaName));
+ () -> new RequiredRuleMissedException(String.format("Default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), databaseName));
}
private Optional<ShardingStrategyConfiguration> getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig, final String type) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
index 78e57aa7d9d..7681b175201 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
@@ -46,17 +46,17 @@ public final class AlterShardingAlgorithmStatementUpdater implements RuleDefinit
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterShardingAlgorithmStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
Collection<String> requireNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toCollection(LinkedList::new));
- checkDuplicate(schemaName, requireNames);
+ checkDuplicate(databaseName, requireNames);
checkExist(requireNames, currentRuleConfig);
checkAlgorithmType(sqlStatement);
}
- private void checkDuplicate(final String schemaName, final Collection<String> requireNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> requireNames) throws DistSQLException {
Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- DistSQLException.predictionThrow(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", schemaName, duplicateRequire));
+ DistSQLException.predictionThrow(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
}
private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRulesStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRulesStatementUpd [...]
index bf45f9fc286..994c7813039 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRulesStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingBindingTableRulesStatementUpdater.java
@@ -41,24 +41,24 @@ public final class AlterShardingBindingTableRulesStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterShardingBindingTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeAlertedBindingTables(schemaName, sqlStatement, currentRuleConfig);
- checkToBeAlteredDuplicateBindingTables(schemaName, sqlStatement);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeAlertedBindingTables(databaseName, sqlStatement, currentRuleConfig);
+ checkToBeAlteredDuplicateBindingTables(databaseName, sqlStatement);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkToBeAlertedBindingTables(final String schemaName, final AlterShardingBindingTableRulesStatement sqlStatement,
+ private void checkToBeAlertedBindingTables(final String databaseName, final AlterShardingBindingTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DuplicateRuleException {
Collection<String> currentLogicTables = getCurrentLogicTables(currentRuleConfig);
Collection<String> notExistedBindingTables = sqlStatement.getBindingTables().stream().filter(each -> !currentLogicTables.contains(each)).collect(Collectors.toSet());
if (!notExistedBindingTables.isEmpty()) {
- throw new DuplicateRuleException("binding", schemaName, notExistedBindingTables);
+ throw new DuplicateRuleException("binding", databaseName, notExistedBindingTables);
}
}
@@ -69,11 +69,11 @@ public final class AlterShardingBindingTableRulesStatementUpdater implements Rul
return result;
}
- private void checkToBeAlteredDuplicateBindingTables(final String schemaName, final AlterShardingBindingTableRulesStatement sqlStatement) throws DuplicateRuleException {
+ private void checkToBeAlteredDuplicateBindingTables(final String databaseName, final AlterShardingBindingTableRulesStatement sqlStatement) throws DuplicateRuleException {
Collection<String> toBeAlteredBindingTables = new HashSet<>();
Collection<String> duplicateBindingTables = sqlStatement.getBindingTables().stream().filter(each -> !toBeAlteredBindingTables.add(each)).collect(Collectors.toSet());
if (!duplicateBindingTables.isEmpty()) {
- throw new DuplicateRuleException("binding", schemaName, duplicateBindingTables);
+ throw new DuplicateRuleException("binding", databaseName, duplicateBindingTables);
}
}
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 3a4d339e07e..95975d3c861 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
@@ -35,9 +35,9 @@ public final class AlterShardingBroadcastTableRuleStatementUpdater implements Ru
checkCurrentRuleConfiguration(shardingSphereMetaData.getName(), currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
index 448c3dc4440..fc32bb45499 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
@@ -46,17 +46,17 @@ public final class AlterShardingKeyGeneratorStatementUpdater implements RuleDefi
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterShardingKeyGeneratorStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
Collection<String> requireNames = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toCollection(LinkedList::new));
- checkDuplicate(schemaName, requireNames);
+ checkDuplicate(databaseName, requireNames);
checkExist(requireNames, currentRuleConfig);
checkAlgorithmType(sqlStatement);
}
- private void checkDuplicate(final String schemaName, final Collection<String> requireNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> requireNames) throws DistSQLException {
Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- DistSQLException.predictionThrow(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", schemaName, duplicateRequire));
+ DistSQLException.predictionThrow(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
}
private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
index 335c7911719..58d57fa0c4b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
@@ -46,17 +46,17 @@ public final class CreateDefaultShardingStrategyStatementUpdater implements Rule
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateDefaultShardingStrategyStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkAlgorithm(schemaName, currentRuleConfig, sqlStatement);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkAlgorithm(databaseName, currentRuleConfig, sqlStatement);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("Sharding", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("Sharding", databaseName));
}
- private void checkAlgorithm(final String schemaName, final ShardingRuleConfiguration currentRuleConfig, final CreateDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
+ private void checkAlgorithm(final String databaseName, final ShardingRuleConfiguration currentRuleConfig, final CreateDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
DistSQLException.predictionThrow(ShardingStrategyType.contain(sqlStatement.getStrategyType()), () -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
DistSQLException.predictionThrow(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType()).isValid(sqlStatement.getShardingColumn()),
() -> new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
@@ -65,17 +65,17 @@ public final class CreateDefaultShardingStrategyStatementUpdater implements Rule
return;
}
boolean isAlgorithmExist = currentRuleConfig.getShardingAlgorithms().containsKey(sqlStatement.getShardingAlgorithmName());
- DistSQLException.predictionThrow(isAlgorithmExist, () -> new RequiredAlgorithmMissedException(schemaName, Collections.singleton(sqlStatement.getShardingAlgorithmName())));
+ DistSQLException.predictionThrow(isAlgorithmExist, () -> new RequiredAlgorithmMissedException(databaseName, Collections.singleton(sqlStatement.getShardingAlgorithmName())));
}
private boolean isAlgorithmDefinitionExists(final CreateDefaultShardingStrategyStatement sqlStatement) {
return null != sqlStatement.getShardingAlgorithmName() || null != sqlStatement.getAlgorithmSegment();
}
- private void checkExist(final String schemaName, final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final CreateDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Optional<ShardingStrategyConfiguration> strategyConfiguration = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
DistSQLException.predictionThrow(!strategyConfiguration.isPresent(),
- () -> new DuplicateRuleException(String.format("default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), schemaName));
+ () -> new DuplicateRuleException(String.format("default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), databaseName));
}
private Optional<ShardingStrategyConfiguration> getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig, final String type) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
index c6ce3606254..7912926632d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
@@ -46,17 +46,17 @@ public final class CreateShardingAlgorithmStatementUpdater implements RuleDefini
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateShardingAlgorithmStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkDuplicate(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkDuplicate(databaseName, sqlStatement, currentRuleConfig);
checkAlgorithm(sqlStatement);
}
- private void checkDuplicate(final String schemaName, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> shardingAlgorithmNames = sqlStatement.getAlgorithmSegments().stream()
.map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toCollection(LinkedList::new));
- checkDuplicateInput(shardingAlgorithmNames, duplicated -> new DuplicateRuleException("sharding", schemaName, duplicated));
+ checkDuplicateInput(shardingAlgorithmNames, duplicated -> new DuplicateRuleException("sharding", databaseName, duplicated));
if (currentRuleConfig != null) {
- checkExist(shardingAlgorithmNames, currentRuleConfig.getShardingAlgorithms().keySet(), duplicated -> new DuplicateRuleException("sharding", schemaName, duplicated));
+ checkExist(shardingAlgorithmNames, currentRuleConfig.getShardingAlgorithms().keySet(), duplicated -> new DuplicateRuleException("sharding", databaseName, duplicated));
}
}
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 477ecbecab5..0a92669cc88 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
@@ -42,23 +42,23 @@ public final class CreateShardingBindingTableRuleStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateShardingBindingTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeCreatedBindingTables(schemaName, sqlStatement, currentRuleConfig);
- checkToBeCreatedDuplicateBindingTables(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeCreatedBindingTables(databaseName, sqlStatement, currentRuleConfig);
+ checkToBeCreatedDuplicateBindingTables(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
- private void checkToBeCreatedBindingTables(final String schemaName, final CreateShardingBindingTableRulesStatement sqlStatement,
+ private void checkToBeCreatedBindingTables(final String databaseName, final CreateShardingBindingTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentLogicTables = getCurrentLogicTables(currentRuleConfig);
Collection<String> notExistedBindingTables = sqlStatement.getBindingTables().stream().filter(each -> !currentLogicTables.contains(each)).collect(Collectors.toCollection(LinkedHashSet::new));
- DistSQLException.predictionThrow(notExistedBindingTables.isEmpty(), () -> new RequiredRuleMissedException("Sharding", schemaName, notExistedBindingTables));
+ DistSQLException.predictionThrow(notExistedBindingTables.isEmpty(), () -> new RequiredRuleMissedException("Sharding", databaseName, notExistedBindingTables));
}
private Collection<String> getCurrentLogicTables(final ShardingRuleConfiguration currentRuleConfig) {
@@ -68,13 +68,13 @@ public final class CreateShardingBindingTableRuleStatementUpdater implements Rul
return result;
}
- private void checkToBeCreatedDuplicateBindingTables(final String schemaName,
+ private void checkToBeCreatedDuplicateBindingTables(final String databaseName,
final CreateShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DuplicateRuleException {
Collection<String> toBeCreatedBindingTables = new HashSet<>();
Collection<String> duplicateBindingTables = sqlStatement.getBindingTables().stream().filter(each -> !toBeCreatedBindingTables.add(each)).collect(Collectors.toSet());
duplicateBindingTables.addAll(getCurrentBindingTables(currentRuleConfig).stream().filter(each -> !toBeCreatedBindingTables.add(each)).collect(Collectors.toSet()));
if (!duplicateBindingTables.isEmpty()) {
- throw new DuplicateRuleException("binding", schemaName, duplicateBindingTables);
+ throw new DuplicateRuleException("binding", databaseName, duplicateBindingTables);
}
}
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 88e09701a6f..3371f71a072 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
@@ -35,9 +35,9 @@ public final class CreateShardingBroadcastTableRuleStatementUpdater implements R
checkCurrentRuleConfiguration(shardingSphereMetaData.getName(), currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RuleInUsedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RuleInUsedException {
if (null != currentRuleConfig && !currentRuleConfig.getBroadcastTables().isEmpty()) {
- throw new RuleInUsedException("Broadcast", schemaName);
+ throw new RuleInUsedException("Broadcast", databaseName);
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
index d95b3de6db5..cba29775bd8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
@@ -50,12 +50,12 @@ public final class CreateShardingKeyGeneratorStatementUpdater implements RuleDef
checkKeyGeneratorAlgorithm(sqlStatement);
}
- private void checkDuplicate(final String schemaName, final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> keyGeneratorNames = sqlStatement.getKeyGeneratorSegments().stream()
.map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toCollection(LinkedList::new));
- checkDuplicateInput(keyGeneratorNames, duplicated -> new DuplicateKeyGeneratorException("sharding", schemaName, duplicated));
+ checkDuplicateInput(keyGeneratorNames, duplicated -> new DuplicateKeyGeneratorException("sharding", databaseName, duplicated));
if (null != currentRuleConfig) {
- checkExist(keyGeneratorNames, currentRuleConfig.getKeyGenerators().keySet(), duplicated -> new DuplicateKeyGeneratorException("sharding", schemaName, duplicated));
+ checkExist(keyGeneratorNames, currentRuleConfig.getKeyGenerators().keySet(), duplicated -> new DuplicateKeyGeneratorException("sharding", databaseName, duplicated));
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
index 9dfb2b94010..49897661801 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
@@ -36,21 +36,21 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDefaultShardingStrategyStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkExist(schemaName, sqlStatement, currentRuleConfig);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkExist(final String schemaName, final DropDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkExist(final String databaseName, final DropDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
Optional<ShardingStrategyConfiguration> strategyConfiguration = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
DistSQLException.predictionThrow(strategyConfiguration.isPresent(),
- () -> new RequiredRuleMissedException(String.format("Default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), schemaName));
+ () -> new RequiredRuleMissedException(String.format("Default sharding %s strategy", sqlStatement.getDefaultType().toLowerCase()), databaseName));
}
private Optional<ShardingStrategyConfiguration> getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig, final String type) {
@@ -59,8 +59,8 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
return Optional.ofNullable(result);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException("Sharding", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(currentRuleConfig != null, () -> new RequiredRuleMissedException("Sharding", databaseName));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
index bff98a51829..8a71a2c1e02 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
@@ -42,19 +42,19 @@ public final class DropShardingAlgorithmStatementUpdater implements RuleDefiniti
if (null == currentRuleConfig && sqlStatement.isContainsExistClause()) {
return;
}
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeDroppedShardingAlgorithms(schemaName, sqlStatement, currentRuleConfig);
- checkShardingAlgorithmsInUsed(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeDroppedShardingAlgorithms(databaseName, sqlStatement, currentRuleConfig);
+ checkShardingAlgorithmsInUsed(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredAlgorithmMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredAlgorithmMissedException {
if (null == currentRuleConfig) {
- throw new RequiredAlgorithmMissedException(schemaName);
+ throw new RequiredAlgorithmMissedException(databaseName);
}
}
- private void checkToBeDroppedShardingAlgorithms(final String schemaName, final DropShardingAlgorithmStatement sqlStatement,
+ private void checkToBeDroppedShardingAlgorithms(final String databaseName, final DropShardingAlgorithmStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RequiredAlgorithmMissedException {
if (sqlStatement.isContainsExistClause()) {
return;
@@ -62,16 +62,16 @@ public final class DropShardingAlgorithmStatementUpdater implements RuleDefiniti
Collection<String> currentShardingAlgorithms = getCurrentShardingAlgorithms(currentRuleConfig);
Collection<String> notExistedAlgorithms = sqlStatement.getAlgorithmNames().stream().filter(each -> !currentShardingAlgorithms.contains(each)).collect(Collectors.toList());
if (!notExistedAlgorithms.isEmpty()) {
- throw new RequiredAlgorithmMissedException(schemaName, notExistedAlgorithms);
+ throw new RequiredAlgorithmMissedException(databaseName, notExistedAlgorithms);
}
}
- private void checkShardingAlgorithmsInUsed(final String schemaName, final DropShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig)
+ private void checkShardingAlgorithmsInUsed(final String databaseName, final DropShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig)
throws AlgorithmInUsedException {
Collection<String> allInUsed = getAllOfAlgorithmsInUsed(currentRuleConfig);
Collection<String> usedAlgorithms = sqlStatement.getAlgorithmNames().stream().filter(allInUsed::contains).collect(Collectors.toList());
if (!usedAlgorithms.isEmpty()) {
- throw new AlgorithmInUsedException(schemaName, usedAlgorithms);
+ throw new AlgorithmInUsedException(databaseName, usedAlgorithms);
}
}
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 0fb05cfa64f..9dc0aee1525 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
@@ -46,17 +46,17 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropShardingBindingTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
bindingTableRules = buildBindingTableRule(currentRuleConfig);
- checkBindingTableRuleExist(schemaName, sqlStatement, bindingTableRules);
+ checkBindingTableRuleExist(databaseName, sqlStatement, bindingTableRules);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig && !currentRuleConfig.getBindingTableGroups().isEmpty(), () -> new RequiredRuleMissedException("Binding", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig && !currentRuleConfig.getBindingTableGroups().isEmpty(), () -> new RequiredRuleMissedException("Binding", databaseName));
}
private Map<String, String> buildBindingTableRule(final ShardingRuleConfiguration configuration) {
@@ -65,7 +65,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
return result;
}
- private void checkBindingTableRuleExist(final String schemaName, final DropShardingBindingTableRulesStatement sqlStatement,
+ private void checkBindingTableRuleExist(final String databaseName, final DropShardingBindingTableRulesStatement sqlStatement,
final Map<String, String> bindingRelationship) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
@@ -76,7 +76,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
notExistBindingGroups.add(each.getTableGroups());
}
}
- DistSQLException.predictionThrow(notExistBindingGroups.isEmpty(), () -> new RequiredRuleMissedException("Binding", schemaName, notExistBindingGroups));
+ DistSQLException.predictionThrow(notExistBindingGroups.isEmpty(), () -> new RequiredRuleMissedException("Binding", databaseName, notExistBindingGroups));
}
private boolean isToBeDroppedRuleExists(final BindingTableRuleSegment bindingRule, final Map<String, String> bindingRelationship) {
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 911e5073155..65044681b93 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
@@ -36,15 +36,15 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropShardingBroadcastTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkBroadCastTableRuleExist(schemaName, sqlStatement, currentRuleConfig);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkBroadCastTableRuleExist(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkBroadCastTableRuleExist(final String schemaName, final DropShardingBroadcastTableRulesStatement sqlStatement,
+ private void checkBroadCastTableRuleExist(final String databaseName, final DropShardingBroadcastTableRulesStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
@@ -52,12 +52,12 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
if (!sqlStatement.getRules().isEmpty()) {
Collection<String> currentRules = currentRuleConfig.getBroadcastTables();
LinkedList<String> notExistRules = sqlStatement.getRules().stream().filter(each -> !currentRules.contains(each)).collect(Collectors.toCollection(LinkedList::new));
- DistSQLException.predictionThrow(notExistRules.isEmpty(), () -> new RequiredRuleMissedException("Broadcast", schemaName, notExistRules));
+ DistSQLException.predictionThrow(notExistRules.isEmpty(), () -> new RequiredRuleMissedException("Broadcast", databaseName, notExistRules));
}
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("Broadcast", schemaName));
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException("Broadcast", databaseName));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
index 0427880b68c..e360086f71e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
@@ -48,32 +48,32 @@ public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefin
if (null == currentRuleConfig && sqlStatement.isContainsExistClause()) {
return;
}
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
Collection<String> keyGeneratorNames = new LinkedList<>(sqlStatement.getKeyGeneratorNames());
- checkDuplicate(schemaName, keyGeneratorNames);
- checkExist(schemaName, keyGeneratorNames, currentRuleConfig, sqlStatement);
- checkInUsed(schemaName, keyGeneratorNames, currentRuleConfig);
+ checkDuplicate(databaseName, keyGeneratorNames);
+ checkExist(databaseName, keyGeneratorNames, currentRuleConfig, sqlStatement);
+ checkInUsed(databaseName, keyGeneratorNames, currentRuleConfig);
}
- private void checkDuplicate(final String schemaName, final Collection<String> keyGeneratorNames) throws DistSQLException {
+ private void checkDuplicate(final String databaseName, final Collection<String> keyGeneratorNames) throws DistSQLException {
Collection<String> duplicateNames = keyGeneratorNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
.filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- DistSQLException.predictionThrow(duplicateNames.isEmpty(), () -> new DuplicateKeyGeneratorException("sharding", schemaName, duplicateNames));
+ DistSQLException.predictionThrow(duplicateNames.isEmpty(), () -> new DuplicateKeyGeneratorException("sharding", databaseName, duplicateNames));
}
- private void checkExist(final String schemaName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig,
+ private void checkExist(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig,
final DropShardingKeyGeneratorStatement sqlStatement) throws DistSQLException {
if (sqlStatement.isContainsExistClause()) {
return;
}
Collection<String> notExistKeyGenerators = keyGeneratorNames.stream().filter(each -> !currentRuleConfig.getKeyGenerators().containsKey(each)).collect(Collectors.toCollection(LinkedList::new));
- DistSQLException.predictionThrow(notExistKeyGenerators.isEmpty(), () -> new RequiredKeyGeneratorMissedException("Sharding", schemaName, notExistKeyGenerators));
+ DistSQLException.predictionThrow(notExistKeyGenerators.isEmpty(), () -> new RequiredKeyGeneratorMissedException("Sharding", databaseName, notExistKeyGenerators));
}
- private void checkInUsed(final String schemaName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkInUsed(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> usedKeyGenerators = getUsedKeyGenerators(currentRuleConfig);
Collection<String> inUsedNames = keyGeneratorNames.stream().filter(usedKeyGenerators::contains).collect(Collectors.toCollection(LinkedList::new));
- DistSQLException.predictionThrow(inUsedNames.isEmpty(), () -> new KeyGeneratorInUsedException("Sharding", schemaName, inUsedNames));
+ DistSQLException.predictionThrow(inUsedNames.isEmpty(), () -> new KeyGeneratorInUsedException("Sharding", databaseName, inUsedNames));
}
@Override
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 b57f6830807..ea50103b668 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
@@ -42,18 +42,18 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropShardingTableRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- String schemaName = shardingSphereMetaData.getName();
+ String databaseName = shardingSphereMetaData.getName();
if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isContainsExistClause()) {
return;
}
- checkCurrentRuleConfiguration(schemaName, currentRuleConfig);
- checkToBeDroppedShardingTableNames(schemaName, sqlStatement, currentRuleConfig);
- checkBindingTables(schemaName, sqlStatement, currentRuleConfig);
+ checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
+ checkToBeDroppedShardingTableNames(databaseName, sqlStatement, currentRuleConfig);
+ checkBindingTables(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
+ private void checkCurrentRuleConfiguration(final String databaseName, final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (null == currentRuleConfig) {
- throw new RequiredRuleMissedException("Sharding", schemaName);
+ throw new RequiredRuleMissedException("Sharding", databaseName);
}
}
@@ -61,7 +61,7 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
return sqlStatement.getTableNames().stream().map(each -> each.getIdentifier().getValue()).collect(Collectors.toList());
}
- private void checkToBeDroppedShardingTableNames(final String schemaName, final DropShardingTableRuleStatement sqlStatement,
+ private void checkToBeDroppedShardingTableNames(final String databaseName, final DropShardingTableRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
if (sqlStatement.isContainsExistClause()) {
return;
@@ -69,7 +69,7 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
Collection<String> currentShardingTableNames = getCurrentShardingTableNames(currentRuleConfig);
Collection<String> notExistedTableNames = getToBeDroppedShardingTableNames(sqlStatement).stream().filter(each -> !currentShardingTableNames.contains(each)).collect(Collectors.toList());
if (!notExistedTableNames.isEmpty()) {
- throw new RequiredRuleMissedException("sharding", schemaName, notExistedTableNames);
+ throw new RequiredRuleMissedException("sharding", databaseName, notExistedTableNames);
}
}
@@ -80,11 +80,11 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
return result;
}
- private void checkBindingTables(final String schemaName, final DropShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws RuleInUsedException {
+ private void checkBindingTables(final String databaseName, final DropShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws RuleInUsedException {
Collection<String> bindingTables = getBindingTables(currentRuleConfig);
Collection<String> usedTableNames = getToBeDroppedShardingTableNames(sqlStatement).stream().filter(bindingTables::contains).collect(Collectors.toList());
if (!usedTableNames.isEmpty()) {
- throw new RuleInUsedException("Sharding", schemaName, usedTableNames);
+ throw new RuleInUsedException("Sharding", databaseName, usedTableNames);
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/exception/resource/RequiredResourceMissedException.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/exception/resource/RequiredResourceMissedException.java
index cff8ea8a527..d9d348e075c 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/exception/resource/RequiredResourceMissedException.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/distsql/exception/resource/RequiredResourceMissedException.java
@@ -26,11 +26,11 @@ public final class RequiredResourceMissedException extends ResourceDefinitionVio
private static final long serialVersionUID = 1704331180489268L;
- public RequiredResourceMissedException(final String schemaName, final Collection<String> resourceNames) {
- super(1102, String.format("Resources %s do not exist in schema %s.", resourceNames, schemaName));
+ public RequiredResourceMissedException(final String databaseName, final Collection<String> resourceNames) {
+ super(1102, String.format("Resources %s do not exist in database %s.", resourceNames, databaseName));
}
- public RequiredResourceMissedException(final String schemaName) {
- super(1102, String.format("There are no resources in the schema %s.", schemaName));
+ public RequiredResourceMissedException(final String databaseName) {
+ super(1102, String.format("There are no resources in the database %s.", databaseName));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AlterResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AlterResourceBackendHandler.java
index 749f02148e6..bf4583ec4c9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AlterResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/AlterResourceBackendHandler.java
@@ -75,15 +75,15 @@ public final class AlterResourceBackendHandler extends SchemaRequiredBackendHand
return new UpdateResponseHeader(sqlStatement);
}
- private void checkSQLStatement(final String schemaName, final AlterResourceStatement sqlStatement) throws DistSQLException {
+ private void checkSQLStatement(final String databaseName, final AlterResourceStatement sqlStatement) throws DistSQLException {
Collection<String> toBeAlteredResourceNames = getToBeAlteredResourceNames(sqlStatement);
checkToBeAlteredDuplicateResourceNames(toBeAlteredResourceNames);
- checkResourceNameExisted(schemaName, toBeAlteredResourceNames);
- checkDatabase(schemaName, sqlStatement);
+ checkResourceNameExisted(databaseName, toBeAlteredResourceNames);
+ checkDatabase(databaseName, sqlStatement);
}
- private void checkDatabase(final String schemaName, final AlterResourceStatement sqlStatement) throws DistSQLException {
- Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
+ private void checkDatabase(final String databaseName, final AlterResourceStatement sqlStatement) throws DistSQLException {
+ Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(databaseName).getResource().getDataSources();
Collection<String> invalid = sqlStatement.getDataSources().stream().collect(Collectors.toMap(DataSourceSegment::getName, each -> each)).entrySet().stream()
.filter(each -> !isIdenticalDatabase(each.getValue(), resources.get(each.getKey()))).map(Entry::getKey).collect(Collectors.toSet());
DistSQLException.predictionThrow(invalid.isEmpty(), () -> new InvalidResourcesException(Collections.singleton(String.format("Cannot alter the database of %s", invalid))));
@@ -102,10 +102,10 @@ public final class AlterResourceBackendHandler extends SchemaRequiredBackendHand
return resourceNames.stream().filter(each -> resourceNames.stream().filter(each::equals).count() > 1).collect(Collectors.toList());
}
- private void checkResourceNameExisted(final String schemaName, final Collection<String> resourceNames) throws DistSQLException {
- Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
+ private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) throws DistSQLException {
+ Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(databaseName).getResource().getDataSources();
Collection<String> notExistedResourceNames = resourceNames.stream().filter(each -> !resources.containsKey(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedResourceNames.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistedResourceNames));
+ DistSQLException.predictionThrow(notExistedResourceNames.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistedResourceNames));
}
private boolean isIdenticalDatabase(final DataSourceSegment segment, final DataSource dataSource) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
index 72b0842c0cc..f54ac59a9d6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
@@ -50,29 +50,29 @@ public final class DropResourceBackendHandler extends SchemaRequiredBackendHandl
}
@Override
- public ResponseHeader execute(final String schemaName, final DropResourceStatement sqlStatement) throws DistSQLException {
+ public ResponseHeader execute(final String databaseName, final DropResourceStatement sqlStatement) throws DistSQLException {
Collection<String> toBeDroppedResourceNames = sqlStatement.getNames();
- check(schemaName, toBeDroppedResourceNames, sqlStatement.isIgnoreSingleTables(), sqlStatement.isContainsExistClause());
- ProxyContext.getInstance().getContextManager().dropResource(schemaName, toBeDroppedResourceNames);
+ check(databaseName, toBeDroppedResourceNames, sqlStatement.isIgnoreSingleTables(), sqlStatement.isContainsExistClause());
+ ProxyContext.getInstance().getContextManager().dropResource(databaseName, toBeDroppedResourceNames);
return new UpdateResponseHeader(sqlStatement);
}
- private void check(final String schemaName, final Collection<String> toBeDroppedResourceNames,
+ private void check(final String databaseName, final Collection<String> toBeDroppedResourceNames,
final boolean ignoreSingleTables, final boolean allowNotExist) throws DistSQLException {
if (!allowNotExist) {
- checkResourceNameExisted(schemaName, toBeDroppedResourceNames);
+ checkResourceNameExisted(databaseName, toBeDroppedResourceNames);
}
- checkResourceNameNotInUse(schemaName, toBeDroppedResourceNames, ignoreSingleTables);
+ checkResourceNameNotInUse(databaseName, toBeDroppedResourceNames, ignoreSingleTables);
}
- private void checkResourceNameExisted(final String schemaName, final Collection<String> resourceNames) throws DistSQLException {
- Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
+ private void checkResourceNameExisted(final String databaseName, final Collection<String> resourceNames) throws DistSQLException {
+ Map<String, DataSource> resources = ProxyContext.getInstance().getMetaData(databaseName).getResource().getDataSources();
Collection<String> notExistedResourceNames = resourceNames.stream().filter(each -> !resources.containsKey(each)).collect(Collectors.toList());
- DistSQLException.predictionThrow(notExistedResourceNames.isEmpty(), () -> new RequiredResourceMissedException(schemaName, notExistedResourceNames));
+ DistSQLException.predictionThrow(notExistedResourceNames.isEmpty(), () -> new RequiredResourceMissedException(databaseName, notExistedResourceNames));
}
- private void checkResourceNameNotInUse(final String schemaName, final Collection<String> toBeDroppedResourceNames, final boolean ignoreSingleTables) throws DistSQLException {
- Multimap<String, String> inUsedMultimap = getInUsedResources(schemaName);
+ private void checkResourceNameNotInUse(final String databaseName, final Collection<String> toBeDroppedResourceNames, final boolean ignoreSingleTables) throws DistSQLException {
+ Multimap<String, String> inUsedMultimap = getInUsedResources(databaseName);
Collection<String> inUsedResourceNames = inUsedMultimap.keySet();
inUsedResourceNames.retainAll(toBeDroppedResourceNames);
if (!inUsedResourceNames.isEmpty()) {
@@ -93,9 +93,9 @@ public final class DropResourceBackendHandler extends SchemaRequiredBackendHandl
}
}
- private Multimap<String, String> getInUsedResources(final String schemaName) {
+ private Multimap<String, String> getInUsedResources(final String databaseName) {
Multimap<String, String> result = LinkedListMultimap.create();
- for (ShardingSphereRule each : ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getRules()) {
+ for (ShardingSphereRule each : ProxyContext.getInstance().getMetaData(databaseName).getRuleMetaData().getRules()) {
if (each instanceof DataSourceContainedRule) {
Collection<String> inUsedResourceNames = getInUsedResourceNames((DataSourceContainedRule) each);
inUsedResourceNames.forEach(eachResource -> result.put(eachResource, each.getType()));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
index ded906bf90d..1d18fa820ee 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/AlterDefaultSingleTableRuleStatementUpdater.java
@@ -36,24 +36,24 @@ public final class AlterDefaultSingleTableRuleStatementUpdater implements RuleDe
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final AlterDefaultSingleTableRuleStatement sqlStatement,
final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkConfigurationExist(schemaName, currentRuleConfig);
- checkResourceExist(schemaName, shardingSphereMetaData, sqlStatement);
- checkDefaultResourceExist(schemaName, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkConfigurationExist(databaseName, currentRuleConfig);
+ checkResourceExist(databaseName, shardingSphereMetaData, sqlStatement);
+ checkDefaultResourceExist(databaseName, currentRuleConfig);
}
- private void checkConfigurationExist(final String schemaName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(schemaName, "single table"));
+ private void checkConfigurationExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(databaseName, "single table"));
}
- private void checkResourceExist(final String schemaName, final ShardingSphereMetaData metaData, final AlterDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
+ private void checkResourceExist(final String databaseName, final ShardingSphereMetaData metaData, final AlterDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
Set<String> resourceNames = metaData.getResource().getDataSources().keySet();
DistSQLException.predictionThrow(resourceNames.contains(sqlStatement.getDefaultResource()),
- () -> new RequiredResourceMissedException(schemaName, Collections.singleton(sqlStatement.getDefaultResource())));
+ () -> new RequiredResourceMissedException(databaseName, Collections.singleton(sqlStatement.getDefaultResource())));
}
- private void checkDefaultResourceExist(final String schemaName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- DistSQLException.predictionThrow(currentRuleConfig.getDefaultDataSource().isPresent(), () -> new RequiredRuleMissedException("single table", schemaName));
+ private void checkDefaultResourceExist(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ DistSQLException.predictionThrow(currentRuleConfig.getDefaultDataSource().isPresent(), () -> new RequiredRuleMissedException("single table", databaseName));
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
index 00283fa2664..a9acdec3c4d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/CreateDefaultSingleTableRuleStatementUpdater.java
@@ -36,20 +36,20 @@ public final class CreateDefaultSingleTableRuleStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final CreateDefaultSingleTableRuleStatement sqlStatement,
final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkResourceExist(schemaName, shardingSphereMetaData, sqlStatement);
- checkDefaultResourceDuplicate(schemaName, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkResourceExist(databaseName, shardingSphereMetaData, sqlStatement);
+ checkDefaultResourceDuplicate(databaseName, currentRuleConfig);
}
- private void checkResourceExist(final String schemaName, final ShardingSphereMetaData metaData, final CreateDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
+ private void checkResourceExist(final String databaseName, final ShardingSphereMetaData metaData, final CreateDefaultSingleTableRuleStatement sqlStatement) throws DistSQLException {
Collection<String> resourceNames = metaData.getResource().getDataSources().keySet();
DistSQLException.predictionThrow(resourceNames.contains(sqlStatement.getDefaultResource()),
- () -> new RequiredResourceMissedException(schemaName, Collections.singleton(sqlStatement.getDefaultResource())));
+ () -> new RequiredResourceMissedException(databaseName, Collections.singleton(sqlStatement.getDefaultResource())));
}
- private void checkDefaultResourceDuplicate(final String schemaName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
+ private void checkDefaultResourceDuplicate(final String databaseName, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
if (null != currentRuleConfig) {
- DistSQLException.predictionThrow(!currentRuleConfig.getDefaultDataSource().isPresent(), () -> new DuplicateRuleException("default single table rule", schemaName));
+ DistSQLException.predictionThrow(!currentRuleConfig.getDefaultDataSource().isPresent(), () -> new DuplicateRuleException("default single table rule", databaseName));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
index 265ae49e594..ee828724b08 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
@@ -32,14 +32,14 @@ public final class DropDefaultSingleTableRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereMetaData shardingSphereMetaData, final DropDefaultSingleTableRuleStatement sqlStatement,
final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- String schemaName = shardingSphereMetaData.getName();
- checkCurrentRuleConfiguration(schemaName, sqlStatement, currentRuleConfig);
+ String databaseName = shardingSphereMetaData.getName();
+ checkCurrentRuleConfiguration(databaseName, sqlStatement, currentRuleConfig);
}
- private void checkCurrentRuleConfiguration(final String schemaName, final DropDefaultSingleTableRuleStatement sqlStatement,
+ private void checkCurrentRuleConfiguration(final String databaseName, final DropDefaultSingleTableRuleStatement sqlStatement,
final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
if (!sqlStatement.isContainsExistClause()) {
- DistSQLException.predictionThrow(null != currentRuleConfig && currentRuleConfig.getDefaultDataSource().isPresent(), () -> new RequiredRuleMissedException("single table", schemaName));
+ DistSQLException.predictionThrow(null != currentRuleConfig && currentRuleConfig.getDefaultDataSource().isPresent(), () -> new RequiredRuleMissedException("single table", databaseName));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
index 6c117909340..b9fd5a664d8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
@@ -73,10 +73,10 @@ public final class RuleDefinitionBackendHandler<T extends RuleDefinitionStatemen
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
- protected ResponseHeader execute(final String schemaName, final T sqlStatement) throws DistSQLException {
+ protected ResponseHeader execute(final String databaseName, final T sqlStatement) throws DistSQLException {
RuleDefinitionUpdater ruleDefinitionUpdater = TypedSPIRegistry.getRegisteredService(RuleDefinitionUpdater.class, sqlStatement.getClass().getCanonicalName());
Class<? extends RuleConfiguration> ruleConfigClass = ruleDefinitionUpdater.getRuleConfigurationClass();
- ShardingSphereMetaData shardingSphereMetaData = ProxyContext.getInstance().getMetaData(schemaName);
+ ShardingSphereMetaData shardingSphereMetaData = ProxyContext.getInstance().getMetaData(databaseName);
RuleConfiguration currentRuleConfig = findCurrentRuleConfiguration(shardingSphereMetaData, ruleConfigClass).orElse(null);
ruleDefinitionUpdater.checkSQLStatement(shardingSphereMetaData, sqlStatement, currentRuleConfig);
Optional<RuleDefinitionAlterPreprocessor> preprocessor = TypedSPIRegistry.findRegisteredService(RuleDefinitionAlterPreprocessor.class, sqlStatement.getClass().getCanonicalName());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandlerTest.java
index 9836d6503b9..9c7eac831a2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandlerTest.java
@@ -113,7 +113,7 @@ public final class DropResourceBackendHandlerTest {
try {
dropResourceBackendHandler.execute("test", createDropResourceStatement());
} catch (final SQLException ex) {
- assertThat(ex.getMessage(), is("Resources [test0] do not exist in schema test."));
+ assertThat(ex.getMessage(), is("Resources [test0] do not exist in database test."));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
index 1c0abc52e87..77d463fde29 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/config-sharding.yaml
@@ -171,7 +171,7 @@
# shardingAlgorithmName: database_inline
# defaultTableStrategy:
# none:
-#
+#
# shardingAlgorithms:
# database_inline:
# type: INLINE
@@ -185,7 +185,7 @@
# type: INLINE
# props:
# algorithm-expression: t_order_item_${order_id % 2}
-#
+#
# keyGenerators:
# snowflake:
# type: SNOWFLAKE