You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/05 09:46:33 UTC
[shardingsphere] branch master updated: refactor config auditAlgorithms to auditors,auditAlgorithmNames to auditorNames (#18861)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 fd7e0aa61c6 refactor config auditAlgorithms to auditors,auditAlgorithmNames to auditorNames (#18861)
fd7e0aa61c6 is described below
commit fd7e0aa61c6baf020990da04d2aeef3081bff78a
Author: natehuang <na...@tencent.com>
AuthorDate: Tue Jul 5 17:46:27 2022 +0800
refactor config auditAlgorithms to auditors,auditAlgorithmNames to auditorNames (#18861)
* refactor config auditAlgorithms to auditors,auditAlgorithmNames to auditorNames
* adjustment
---
.../distsql/syntax/rql/rule-query/sharding.cn.md | 8 ++++----
.../distsql/syntax/rql/rule-query/sharding.en.md | 8 ++++----
.../sharding/api/config/ShardingRuleConfiguration.java | 2 +-
.../audit/ShardingAuditStrategyConfiguration.java | 8 ++++----
.../AlgorithmProvidedShardingRuleConfiguration.java | 2 +-
.../sharding/checker/audit/ShardingAuditChecker.java | 4 ++--
.../shardingsphere/sharding/rule/ShardingRule.java | 10 +++++-----
.../yaml/config/YamlShardingRuleConfiguration.java | 2 +-
.../audit/YamlShardingAuditStrategyConfiguration.java | 2 +-
...ingRuleAlgorithmProviderConfigurationYamlSwapper.java | 5 ++---
.../swapper/ShardingRuleConfigurationYamlSwapper.java | 4 ++--
.../ShardingAuditStrategyConfigurationYamlSwapper.java | 4 ++--
.../sharding/checker/ShardingAuditCheckerTest.java | 14 +++++++-------
.../shardingsphere/sharding/rule/ShardingRuleTest.java | 4 ++--
...hardingAuditStrategyConfigurationYamlSwapperTest.java | 10 +++++-----
...esultSet.java => ShardingAuditorsQueryResultSet.java} | 10 +++++-----
...e.shardingsphere.infra.distsql.query.DistSQLResultSet | 2 +-
.../src/main/antlr4/imports/sharding/Keyword.g4 | 5 +++--
.../src/main/antlr4/imports/sharding/RQLStatement.g4 | 4 ++--
.../distsql/parser/autogen/ShardingDistSQLStatement.g4 | 2 +-
.../parser/core/ShardingDistSQLStatementVisitor.java | 8 ++++----
...Statement.java => ShowShardingAuditorsStatement.java} | 4 ++--
.../src/main/resources/conf/config-sharding.yaml | 16 ++++------------
...ert.java => ShowShardingAuditorsStatementAssert.java} | 14 +++++++-------
.../jaxb/cases/domain/SQLParserTestCases.java | 8 ++++----
...e.java => ShowShardingAuditorsStatementTestCase.java} | 2 +-
.../src/main/resources/case/rql/show.xml | 6 +++---
.../src/main/resources/sql/supported/rql/show.xml | 2 +-
28 files changed, 81 insertions(+), 89 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
index 3c35e6401f5..0ad1395072c 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.cn.md
@@ -14,7 +14,7 @@ SHOW SHARDING ALGORITHMS [FROM databaseName]
SHOW UNUSED SHARDING ALGORITHMS [FROM databaseName]
-SHOW SHARDING AUDIT ALGORITHMS [FROM databaseName]
+SHOW SHARDING AUDITORS [FROM databaseName]
SHOW SHARDING TABLE RULES USED ALGORITHM algorithmName [FROM databaseName]
@@ -89,7 +89,7 @@ SHOW SHARDING SCALING RULES [FROM databaseName]
| type | 分片算法类型 |
| props | 分片算法参数 |
-### Sharding Audit Algorithms
+### Sharding Auditors
| 列 | 说明 |
| ------|-------------------|
@@ -205,9 +205,9 @@ mysql> SHOW UNUSED SHARDING ALGORITHMS;
1 row in set (0.01 sec)
```
-*SHOW SHARDING AUDIT ALGORITHMS*
+*SHOW SHARDING AUDITORS*
```sql
-mysql> SHOW SHARDING AUDIT ALGORITHMS;
+mysql> SHOW SHARDING AUDITORS;
+------------+-------------------------+-------+
| name | type | props |
+------------+-------------------------+-------+
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
index 64ea142a7ff..0a439def0c0 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/sharding.en.md
@@ -14,7 +14,7 @@ SHOW SHARDING ALGORITHMS [FROM databaseName]
SHOW UNUSED SHARDING ALGORITHMS [FROM databaseName]
-SHOW SHARDING AUDIT ALGORITHMS [FROM databaseName]
+SHOW SHARDING AUDITORS [FROM databaseName]
SHOW SHARDING TABLE RULES USED ALGORITHM algorithmName [FROM databaseName]
@@ -89,7 +89,7 @@ SHOW SHARDING SCALING RULES [FROM databaseName]
| type | Sharding algorithm type |
| props | Sharding algorithm properties |
-### Sharding audit Algorithms
+### Sharding auditors
| Column | Description |
| ------ |-------------------------------------|
@@ -205,9 +205,9 @@ mysql> SHOW UNUSED SHARDING ALGORITHMS;
1 row in set (0.01 sec)
```
-*SHOW SHARDING AUDIT ALGORITHMS*
+*SHOW SHARDING AUDITORS*
```sql
-mysql> SHOW SHARDING AUDIT ALGORITHMS;
+mysql> SHOW SHARDING AUDITORS;
+------------+-------------------------+-------+
| name | type | props |
+------------+-------------------------+-------+
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
index 7ef6fde8f8e..3be3c6f297b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/ShardingRuleConfiguration.java
@@ -63,7 +63,7 @@ public final class ShardingRuleConfiguration implements DatabaseRuleConfiguratio
private Map<String, ShardingSphereAlgorithmConfiguration> keyGenerators = new LinkedHashMap<>();
- private Map<String, ShardingSphereAlgorithmConfiguration> auditAlgorithms = new LinkedHashMap<>();
+ private Map<String, ShardingSphereAlgorithmConfiguration> auditors = new LinkedHashMap<>();
private String scalingName;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/strategy/audit/ShardingAuditStrategyConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/strategy/audit/ShardingAuditStrategyConfiguration.java
index 045d0fdd3a4..15b11f29b92 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/strategy/audit/ShardingAuditStrategyConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/main/java/org/apache/shardingsphere/sharding/api/config/strategy/audit/ShardingAuditStrategyConfiguration.java
@@ -28,13 +28,13 @@ import lombok.Getter;
@Getter
public final class ShardingAuditStrategyConfiguration {
- private final Collection<String> auditAlgorithmNames;
+ private final Collection<String> auditorNames;
private final boolean allowHintDisable;
- public ShardingAuditStrategyConfiguration(final Collection<String> auditAlgorithmNames, final boolean allowHintDisable) {
- Preconditions.checkNotNull(auditAlgorithmNames, "Sharding audit algorithm names is required.");
- this.auditAlgorithmNames = auditAlgorithmNames;
+ public ShardingAuditStrategyConfiguration(final Collection<String> auditorNames, final boolean allowHintDisable) {
+ Preconditions.checkNotNull(auditorNames, "Sharding audit algorithm names is required.");
+ this.auditorNames = auditorNames;
this.allowHintDisable = allowHintDisable;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
index 932c9b6ad9a..7eff474cf05 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/config/AlgorithmProvidedShardingRuleConfiguration.java
@@ -64,5 +64,5 @@ public final class AlgorithmProvidedShardingRuleConfiguration implements Databas
private Map<String, KeyGenerateAlgorithm> keyGenerators = new LinkedHashMap<>();
- private Map<String, ShardingAuditAlgorithm> auditAlgorithms = new LinkedHashMap<>();
+ private Map<String, ShardingAuditAlgorithm> auditors = new LinkedHashMap<>();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/checker/audit/ShardingAuditChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/checker/audit/ShardingAuditChecker.java
index 734ddcd89c7..3916d523d90 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/checker/audit/ShardingAuditChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/checker/audit/ShardingAuditChecker.java
@@ -48,11 +48,11 @@ public final class ShardingAuditChecker implements SQLChecker<ShardingRule> {
Collection<String> disableAuditNames = sqlStatementContext instanceof CommonSQLStatementContext
? ((CommonSQLStatementContext<?>) sqlStatementContext).getSqlHintExtractor().findDisableAuditNames()
: Collections.emptyList();
- for (String each : rule.getAuditStrategyConfig().getAuditAlgorithmNames()) {
+ for (String each : rule.getAuditStrategyConfig().getAuditorNames()) {
if (rule.getAuditStrategyConfig().isAllowHintDisable() && disableAuditNames.contains(each.toLowerCase())) {
continue;
}
- SQLCheckResult result = rule.getAuditAlgorithms().get(each).check(sqlStatementContext, parameters, grantee, databases.get(currentDatabase));
+ SQLCheckResult result = rule.getAuditors().get(each).check(sqlStatementContext, parameters, grantee, databases.get(currentDatabase));
if (!result.isPassed()) {
return result;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index 6cbe50317c0..15c45dc785d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -94,7 +94,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
private final Map<String, KeyGenerateAlgorithm> keyGenerators = new LinkedHashMap<>();
- private final Map<String, ShardingAuditAlgorithm> auditAlgorithms = new LinkedHashMap<>();
+ private final Map<String, ShardingAuditAlgorithm> auditors = new LinkedHashMap<>();
private final Map<String, TableRule> tableRules = new LinkedHashMap<>();
@@ -119,7 +119,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
this.dataSourceNames = getDataSourceNames(config.getTables(), config.getAutoTables(), dataSourceNames);
config.getShardingAlgorithms().forEach((key, value) -> shardingAlgorithms.put(key, createShardingAlgorithm(key, value, config.getTables(), config.getAutoTables())));
config.getKeyGenerators().forEach((key, value) -> keyGenerators.put(key, KeyGenerateAlgorithmFactory.newInstance(value)));
- config.getAuditAlgorithms().forEach((key, value) -> auditAlgorithms.put(key, ShardingAuditAlgorithmFactory.newInstance(value)));
+ config.getAuditors().forEach((key, value) -> auditors.put(key, ShardingAuditAlgorithmFactory.newInstance(value)));
tableRules.putAll(createTableRules(config.getTables(), config.getDefaultKeyGenerateStrategy()));
tableRules.putAll(createAutoTableRules(config.getAutoTables(), config.getDefaultKeyGenerateStrategy()));
broadcastTables = createBroadcastTables(config.getBroadcastTables());
@@ -135,7 +135,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
broadcastTables, defaultDatabaseShardingStrategyConfig, defaultTableShardingStrategyConfig, defaultShardingColumn)),
"Invalid binding table configuration in ShardingRuleConfiguration.");
auditStrategyConfig = null == config.getAuditStrategy() ? new ShardingAuditStrategyConfiguration(Collections.emptyList(), true) : config.getAuditStrategy();
- Preconditions.checkArgument(auditStrategyConfig.getAuditAlgorithmNames().stream().allMatch(auditAlgorithms::containsKey), "Cannot find sharding audit algorithm");
+ Preconditions.checkArgument(auditStrategyConfig.getAuditorNames().stream().allMatch(auditors::containsKey), "Cannot find sharding audit algorithm");
keyGenerators.values().stream().filter(each -> each instanceof InstanceAwareAlgorithm).forEach(each -> ((InstanceAwareAlgorithm) each).setInstanceContext(instanceContext));
if (defaultKeyGenerateAlgorithm instanceof InstanceAwareAlgorithm) {
((InstanceAwareAlgorithm) defaultKeyGenerateAlgorithm).setInstanceContext(instanceContext);
@@ -147,7 +147,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
this.dataSourceNames = getDataSourceNames(config.getTables(), config.getAutoTables(), dataSourceNames);
shardingAlgorithms.putAll(config.getShardingAlgorithms());
keyGenerators.putAll(config.getKeyGenerators());
- auditAlgorithms.putAll(config.getAuditAlgorithms());
+ auditors.putAll(config.getAuditors());
tableRules.putAll(createTableRules(config.getTables(), config.getDefaultKeyGenerateStrategy()));
tableRules.putAll(createAutoTableRules(config.getAutoTables(), config.getDefaultKeyGenerateStrategy()));
broadcastTables = createBroadcastTables(config.getBroadcastTables());
@@ -163,7 +163,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
broadcastTables, defaultDatabaseShardingStrategyConfig, defaultTableShardingStrategyConfig, defaultShardingColumn)),
"Invalid binding table configuration in ShardingRuleConfiguration.");
auditStrategyConfig = null == config.getAuditStrategy() ? new ShardingAuditStrategyConfiguration(Collections.emptyList(), true) : config.getAuditStrategy();
- Preconditions.checkArgument(auditStrategyConfig.getAuditAlgorithmNames().stream().allMatch(auditAlgorithms::containsKey), "Cannot find sharding audit algorithm");
+ Preconditions.checkArgument(auditStrategyConfig.getAuditorNames().stream().allMatch(auditors::containsKey), "Cannot find sharding audit algorithm");
keyGenerators.values().stream().filter(each -> each instanceof InstanceAwareAlgorithm).forEach(each -> ((InstanceAwareAlgorithm) each).setInstanceContext(instanceContext));
if (defaultKeyGenerateAlgorithm instanceof InstanceAwareAlgorithm) {
((InstanceAwareAlgorithm) defaultKeyGenerateAlgorithm).setInstanceContext(instanceContext);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
index a2f1d9f7403..0abd72f98c9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/YamlShardingRuleConfiguration.java
@@ -61,7 +61,7 @@ public final class YamlShardingRuleConfiguration implements YamlRuleConfiguratio
private Map<String, YamlShardingSphereAlgorithmConfiguration> keyGenerators = new LinkedHashMap<>();
- private Map<String, YamlShardingSphereAlgorithmConfiguration> auditAlgorithms = new LinkedHashMap<>();
+ private Map<String, YamlShardingSphereAlgorithmConfiguration> auditors = new LinkedHashMap<>();
private String defaultShardingColumn;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/strategy/audit/YamlShardingAuditStrategyConfiguration.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/strategy/audit/YamlShardingAuditStrategyConfiguration.java
index 0e96967e225..de0fc209da1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/strategy/audit/YamlShardingAuditStrategyConfiguration.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/config/strategy/audit/YamlShardingAuditStrategyConfiguration.java
@@ -30,7 +30,7 @@ import java.util.Collection;
@Setter
public final class YamlShardingAuditStrategyConfiguration implements YamlConfiguration {
- private Collection<String> auditAlgorithmNames;
+ private Collection<String> auditorNames;
private boolean allowHintDisable = true;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
index 8e4846ec941..687a5b0bb65 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleAlgorithmProviderConfigurationYamlSwapper.java
@@ -81,9 +81,8 @@ public final class ShardingRuleAlgorithmProviderConfigurationYamlSwapper impleme
if (null != data.getKeyGenerators()) {
data.getKeyGenerators().forEach((key, value) -> yamlConfig.getKeyGenerators().put(key, new YamlShardingSphereAlgorithmConfiguration(value.getType(), value.getProps())));
}
- if (null != data.getAuditAlgorithms()) {
- data.getAuditAlgorithms().forEach(
- (key, value) -> yamlConfig.getAuditAlgorithms().put(key, new YamlShardingSphereAlgorithmConfiguration(value.getType(), value.getProps())));
+ if (null != data.getAuditors()) {
+ data.getAuditors().forEach((key, value) -> yamlConfig.getAuditors().put(key, new YamlShardingSphereAlgorithmConfiguration(value.getType(), value.getProps())));
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationYamlSwapper.java
index aaf392f9c62..ae4f9ae2840 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationYamlSwapper.java
@@ -137,8 +137,8 @@ public final class ShardingRuleConfigurationYamlSwapper implements YamlRuleConfi
if (null != yamlConfig.getKeyGenerators()) {
yamlConfig.getKeyGenerators().forEach((key, value) -> ruleConfig.getKeyGenerators().put(key, algorithmSwapper.swapToObject(value)));
}
- if (null != yamlConfig.getAuditAlgorithms()) {
- yamlConfig.getAuditAlgorithms().forEach((key, value) -> ruleConfig.getAuditAlgorithms().put(key, algorithmSwapper.swapToObject(value)));
+ if (null != yamlConfig.getAuditors()) {
+ yamlConfig.getAuditors().forEach((key, value) -> ruleConfig.getAuditors().put(key, algorithmSwapper.swapToObject(value)));
}
if (null != yamlConfig.getScaling()) {
yamlConfig.getScaling().forEach((key, value) -> ruleConfig.getScaling().put(key, onRuleAlteredActionYamlSwapper.swapToObject(value)));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapper.java
index deacc8a5b13..da5ef8a8cd7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapper.java
@@ -29,13 +29,13 @@ public final class ShardingAuditStrategyConfigurationYamlSwapper implements Yaml
@Override
public YamlShardingAuditStrategyConfiguration swapToYamlConfiguration(final ShardingAuditStrategyConfiguration data) {
YamlShardingAuditStrategyConfiguration result = new YamlShardingAuditStrategyConfiguration();
- result.setAuditAlgorithmNames(data.getAuditAlgorithmNames());
+ result.setAuditorNames(data.getAuditorNames());
result.setAllowHintDisable(data.isAllowHintDisable());
return result;
}
@Override
public ShardingAuditStrategyConfiguration swapToObject(final YamlShardingAuditStrategyConfiguration yamlConfig) {
- return new ShardingAuditStrategyConfiguration(yamlConfig.getAuditAlgorithmNames(), yamlConfig.isAllowHintDisable());
+ return new ShardingAuditStrategyConfiguration(yamlConfig.getAuditorNames(), yamlConfig.isAllowHintDisable());
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/ShardingAuditCheckerTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/ShardingAuditCheckerTest.java
index 9dbcfb9205c..c681bd39323 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/ShardingAuditCheckerTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/checker/ShardingAuditCheckerTest.java
@@ -64,34 +64,34 @@ public final class ShardingAuditCheckerTest {
@Before
public void setUp() {
when(sqlStatementContext.getSqlHintExtractor().findDisableAuditNames()).thenReturn(new HashSet<>(Collections.singletonList("audit_algorithm")));
- when(rule.getAuditStrategyConfig().getAuditAlgorithmNames()).thenReturn(Collections.singleton("audit_algorithm"));
+ when(rule.getAuditStrategyConfig().getAuditorNames()).thenReturn(Collections.singleton("audit_algorithm"));
databases.put("foo_db", mock(ShardingSphereDatabase.class));
}
@Test
public void assertCheckSQLStatementPass() {
- when(rule.getAuditAlgorithms().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
+ when(rule.getAuditors().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
.thenReturn(new SQLCheckResult(true, ""));
asserCheckResult(checker.check(sqlStatementContext, Collections.emptyList(), grantee, "foo_db", databases, rule), true, "");
- verify(rule.getAuditAlgorithms().get("audit_algorithm"), times(1)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
+ verify(rule.getAuditors().get("audit_algorithm"), times(1)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
}
@Test
public void assertSQCheckPassByDisableAuditNames() {
- when(rule.getAuditAlgorithms().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
+ when(rule.getAuditors().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
.thenReturn(new SQLCheckResult(false, ""));
when(rule.getAuditStrategyConfig().isAllowHintDisable()).thenReturn(true);
asserCheckResult(checker.check(sqlStatementContext, Collections.emptyList(), grantee, "foo_db", databases, rule), true, "");
- verify(rule.getAuditAlgorithms().get("audit_algorithm"), times(0)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
+ verify(rule.getAuditors().get("audit_algorithm"), times(0)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
}
@Test
public void assertSQLCheckNotPass() {
- when(rule.getAuditAlgorithms().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
+ when(rule.getAuditors().get("audit_algorithm").check(sqlStatementContext, parameters, grantee, databases.get("foo_db")))
.thenReturn(new SQLCheckResult(false, "Not allow DML operation without sharding conditions"));
asserCheckResult(checker.check(sqlStatementContext, Collections.emptyList(), grantee, "foo_db", databases, rule), false, "Not allow DML operation without sharding conditions");
- verify(rule.getAuditAlgorithms().get("audit_algorithm"), times(1)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
+ verify(rule.getAuditors().get("audit_algorithm"), times(1)).check(sqlStatementContext, parameters, grantee, databases.get("foo_db"));
}
private void asserCheckResult(final SQLCheckResult checkResult, final boolean isPassed, final String errorMessage) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
index 8004db375a1..f5148efecd6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
@@ -90,7 +90,7 @@ public final class ShardingRuleTest {
assertThat(actual.getBindingTableRules().values().iterator().next().getTableRules().size(), is(2));
assertThat(actual.getBroadcastTables(), is(new TreeSet<>(Collections.singletonList("BROADCAST_TABLE"))));
assertThat(actual.getDefaultKeyGenerateAlgorithm(), instanceOf(UUIDKeyGenerateAlgorithm.class));
- assertThat(actual.getAuditAlgorithms().get("audit_algorithm"), instanceOf(DMLShardingConditionsShardingAuditAlgorithm.class));
+ assertThat(actual.getAuditors().get("audit_algorithm"), instanceOf(DMLShardingConditionsShardingAuditAlgorithm.class));
assertThat(actual.getDefaultShardingColumn(), is("table_id"));
}
@@ -476,7 +476,7 @@ public final class ShardingRuleTest {
shardingRuleConfig.getShardingAlgorithms().put("core_standard_fixture", new ShardingSphereAlgorithmConfiguration("CORE.STANDARD.FIXTURE", new Properties()));
shardingRuleConfig.getKeyGenerators().put("uuid", new ShardingSphereAlgorithmConfiguration("UUID", new Properties()));
shardingRuleConfig.getKeyGenerators().put("default", new ShardingSphereAlgorithmConfiguration("UUID", new Properties()));
- shardingRuleConfig.getAuditAlgorithms().put("audit_algorithm", new ShardingSphereAlgorithmConfiguration("DML_SHARDING_CONDITIONS", new Properties()));
+ shardingRuleConfig.getAuditors().put("audit_algorithm", new ShardingSphereAlgorithmConfiguration("DML_SHARDING_CONDITIONS", new Properties()));
return new ShardingRule(shardingRuleConfig, createDataSourceNames(), mock(InstanceContext.class));
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapperTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapperTest.java
index dd82481b651..e2eb46c855c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapperTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/swapper/strategy/ShardingAuditStrategyConfigurationYamlSwapperTest.java
@@ -35,19 +35,19 @@ public final class ShardingAuditStrategyConfigurationYamlSwapperTest {
public void assertSwapToYaml() {
YamlShardingAuditStrategyConfiguration actual = new ShardingAuditStrategyConfigurationYamlSwapper()
.swapToYamlConfiguration(new ShardingAuditStrategyConfiguration(Arrays.asList("audit_algorithm1", "audit_algorithm2"), false));
- assertThat(actual.getAuditAlgorithmNames().size(), is(2));
- assertTrue(actual.getAuditAlgorithmNames().containsAll(Arrays.asList("audit_algorithm1", "audit_algorithm2")));
+ assertThat(actual.getAuditorNames().size(), is(2));
+ assertTrue(actual.getAuditorNames().containsAll(Arrays.asList("audit_algorithm1", "audit_algorithm2")));
assertFalse(actual.isAllowHintDisable());
}
@Test
public void assertSwapToObject() {
YamlShardingAuditStrategyConfiguration yamlShardingAuditStrategyConfig = new YamlShardingAuditStrategyConfiguration();
- yamlShardingAuditStrategyConfig.setAuditAlgorithmNames(Arrays.asList("audit_algorithm1", "audit_algorithm2"));
+ yamlShardingAuditStrategyConfig.setAuditorNames(Arrays.asList("audit_algorithm1", "audit_algorithm2"));
yamlShardingAuditStrategyConfig.setAllowHintDisable(false);
ShardingAuditStrategyConfiguration actual = new ShardingAuditStrategyConfigurationYamlSwapper().swapToObject(yamlShardingAuditStrategyConfig);
- assertThat(actual.getAuditAlgorithmNames().size(), is(2));
- assertTrue(actual.getAuditAlgorithmNames().containsAll(Arrays.asList("audit_algorithm1", "audit_algorithm2")));
+ assertThat(actual.getAuditorNames().size(), is(2));
+ assertTrue(actual.getAuditorNames().containsAll(Arrays.asList("audit_algorithm1", "audit_algorithm2")));
assertFalse(actual.isAllowHintDisable());
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditAlgorithmsQueryResultSet.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditorsQueryResultSet.java
similarity index 89%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditAlgorithmsQueryResultSet.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditorsQueryResultSet.java
index da813775510..9f27ea0dd3c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditAlgorithmsQueryResultSet.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingAuditorsQueryResultSet.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.properties.PropertiesConverter;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditAlgorithmsStatement;
+import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditorsStatement;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -37,16 +37,16 @@ import java.util.Optional;
import java.util.Properties;
/**
- * Query result set for show sharding audit algorithms.
+ * Query result set for show sharding auditors.
*/
-public final class ShardingAuditAlgorithmsQueryResultSet implements DistSQLResultSet {
+public final class ShardingAuditorsQueryResultSet implements DistSQLResultSet {
private Iterator<Entry<String, ShardingSphereAlgorithmConfiguration>> data;
@Override
public void init(final ShardingSphereDatabase database, final SQLStatement sqlStatement) {
Optional<ShardingRule> rule = database.getRuleMetaData().findSingleRule(ShardingRule.class);
- data = rule.map(optional -> ((ShardingRuleConfiguration) optional.getConfiguration()).getAuditAlgorithms().entrySet().iterator()).orElse(Collections.emptyIterator());
+ data = rule.map(optional -> ((ShardingRuleConfiguration) optional.getConfiguration()).getAuditors().entrySet().iterator()).orElse(Collections.emptyIterator());
}
@Override
@@ -78,6 +78,6 @@ public final class ShardingAuditAlgorithmsQueryResultSet implements DistSQLResul
@Override
public String getType() {
- return ShowShardingAuditAlgorithmsStatement.class.getName();
+ return ShowShardingAuditorsStatement.class.getName();
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
index 8f037316ed2..bfd674086f3 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
@@ -19,7 +19,7 @@ org.apache.shardingsphere.sharding.distsql.handler.query.ShardingTableRuleQueryR
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingBindingTableRuleQueryResultSet
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingBroadcastTableRuleQueryResultSet
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingAlgorithmsQueryResultSet
-org.apache.shardingsphere.sharding.distsql.handler.query.ShardingAuditAlgorithmsQueryResultSet
+org.apache.shardingsphere.sharding.distsql.handler.query.ShardingAuditorsQueryResultSet
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingTableNodesQueryResultSet
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingKeyGeneratorsQueryResultSet
org.apache.shardingsphere.sharding.distsql.handler.query.DefaultShardingStrategyQueryResultSet
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/Keyword.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/Keyword.g4
index 8633cf22ac1..1c0bf8f3bcd 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/Keyword.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/Keyword.g4
@@ -211,6 +211,7 @@ WITH
: W I T H
;
-AUDIT
- : A U D I T
+
+AUDITORS
+ : A U D I T O R S
;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RQLStatement.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RQLStatement.g4
index e378d155684..d9ce9a8c300 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RQLStatement.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RQLStatement.g4
@@ -35,8 +35,8 @@ showShardingAlgorithms
: SHOW SHARDING ALGORITHMS (FROM databaseName)?
;
-showShardingAuditAlgorithms
- : SHOW SHARDING AUDIT ALGORITHMS (FROM databaseName)?
+showShardingAuditors
+ : SHOW SHARDING AUDITORS (FROM databaseName)?
;
showShardingTableNodes
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
index 6e04256f341..31b22e396f6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/sharding/org/apache/shardingsphere/distsql/parser/autogen/ShardingDistSQLStatement.g4
@@ -37,7 +37,6 @@ execute
| showShardingBindingTableRules
| showShardingBroadcastTableRules
| showShardingAlgorithms
- | showShardingAuditAlgorithms
| setShardingHintDatabaseValue
| addShardingHintDatabaseValue
| addShardingHintTableValue
@@ -50,6 +49,7 @@ execute
| alterShardingKeyGenerator
| showShardingKeyGenerators
| dropShardingKeyGenerator
+ | showShardingAuditors
| showShardingDefaultShardingStrategy
| alterDefaultShardingStrategy
| dropDefaultShardingStrategy
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
index c2d8ab02693..9d313a3633d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
@@ -58,7 +58,7 @@ import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatement
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShardingTableRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShardingTableRuleDefinitionContext;
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingAlgorithmsContext;
-import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingAuditAlgorithmsContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingAuditorsContext;
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingBindingTableRulesContext;
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingBroadcastTableRulesContext;
import org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.ShowShardingDefaultShardingStrategyContext;
@@ -101,7 +101,7 @@ import org.apache.shardingsphere.sharding.distsql.parser.statement.DropShardingK
import org.apache.shardingsphere.sharding.distsql.parser.statement.DropShardingTableRuleStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowDefaultShardingStrategyStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAlgorithmsStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditAlgorithmsStatement;
+import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditorsStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingBindingTableRulesStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingBroadcastTableRulesStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingKeyGeneratorsStatement;
@@ -293,8 +293,8 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
}
@Override
- public ASTNode visitShowShardingAuditAlgorithms(final ShowShardingAuditAlgorithmsContext ctx) {
- return new ShowShardingAuditAlgorithmsStatement(Objects.nonNull(ctx.databaseName()) ? (DatabaseSegment) visit(ctx.databaseName()) : null);
+ public ASTNode visitShowShardingAuditors(final ShowShardingAuditorsContext ctx) {
+ return new ShowShardingAuditorsStatement(Objects.nonNull(ctx.databaseName()) ? (DatabaseSegment) visit(ctx.databaseName()) : null);
}
@Override
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditAlgorithmsStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditorsStatement.java
similarity index 87%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditAlgorithmsStatement.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditorsStatement.java
index 203ac9f6d1a..877e5b91820 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditAlgorithmsStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/ShowShardingAuditorsStatement.java
@@ -23,9 +23,9 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseS
/**
* Show sharding audit algorithms statement.
*/
-public final class ShowShardingAuditAlgorithmsStatement extends ShowRulesStatement {
+public final class ShowShardingAuditorsStatement extends ShowRulesStatement {
- public ShowShardingAuditAlgorithmsStatement(final DatabaseSegment database) {
+ public ShowShardingAuditorsStatement(final DatabaseSegment database) {
super(database);
}
}
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 e11cf042f04..1bc41386b38 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
@@ -74,7 +74,7 @@
# defaultTableStrategy:
# none:
# auditStrategy:
-# auditAlgorithmNames:
+# auditorNames:
# - sharding_key_required_audit_algorithm
# allowHintDisable: true
#
@@ -96,7 +96,7 @@
# snowflake:
# type: SNOWFLAKE
#
-# auditAlgorithms:
+# auditors:
# sharding_key_required_audit_algorithm:
# type: DML_SHARDING_CONDITIONS
#
@@ -121,14 +121,6 @@
# type: DATA_MATCH
# props:
# chunk-size: 1000
-#
-# auditAlgorithms:
-# sharding_key_required_audit_algorithm:
-# type: DML_SHARDING_CONDITIONS
-# auditStrategy:
-# auditAlgorithmNames:
-# - sharding_key_required_audit_algorithm
-# allowHintDisable: true
######################################################################################################
#
@@ -188,7 +180,7 @@
# defaultTableStrategy:
# none:
# auditStrategy:
-# auditAlgorithmNames:
+# auditorNames:
# - sharding_key_required_audit_algorithm
# allowHintDisable: true
#
@@ -210,7 +202,7 @@
# snowflake:
# type: SNOWFLAKE
#
-# auditAlgorithms:
+# auditors:
# sharding_key_required_audit_algorithm:
# type: DML_SHARDING_CONDITIONS
#
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditAlgorithmsStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditorsStatementAssert.java
similarity index 78%
rename from shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditAlgorithmsStatementAssert.java
rename to shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditorsStatementAssert.java
index d916fd79793..47ec8bfd2b3 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditAlgorithmsStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rql/impl/rule/ShowShardingAuditorsStatementAssert.java
@@ -19,10 +19,10 @@ package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statemen
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditAlgorithmsStatement;
+import org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingAuditorsStatement;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.database.DatabaseAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingAuditAlgorithmsStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingAuditorsStatementTestCase;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -31,16 +31,16 @@ import static org.junit.Assert.assertTrue;
* Show sharding audit algorithms statement assert.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShowShardingAuditAlgorithmsStatementAssert {
+public final class ShowShardingAuditorsStatementAssert {
/**
- * Assert show sharding audit algorithms statement is correct with expected parser result.
+ * Assert show sharding auditors statement is correct with expected parser result.
*
* @param assertContext assert context
- * @param actual actual show sharding audit algorithms statement
- * @param expected expected show sharding audit algorithms statement test case
+ * @param actual actual show sharding auditors statement
+ * @param expected expected show sharding auditors statement test case
*/
- public static void assertIs(final SQLCaseAssertContext assertContext, final ShowShardingAuditAlgorithmsStatement actual, final ShowShardingAuditAlgorithmsStatementTestCase expected) {
+ public static void assertIs(final SQLCaseAssertContext assertContext, final ShowShardingAuditorsStatement actual, final ShowShardingAuditorsStatementTestCase expected) {
if (null != expected.getDatabase()) {
assertTrue(assertContext.getText("Actual database should exist."), actual.getDatabase().isPresent());
DatabaseAssert.assertIs(assertContext, actual.getDatabase().get(), expected.getDatabase());
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index d2d1f01ec5b..eeaf10facda 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -355,7 +355,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShadowRulesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShadowTableRulesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingAlgorithmsStatementTestCase;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingAuditAlgorithmsStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingAuditorsStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingBindingTableRulesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingBroadcastTableRulesStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rql.ShowShardingKeyGeneratorsStatementTestCase;
@@ -937,8 +937,8 @@ public final class SQLParserTestCases {
@XmlElement(name = "show-sharding-algorithms")
private final List<ShowShardingAlgorithmsStatementTestCase> showShardingAlgorithmsTestCases = new LinkedList<>();
- @XmlElement(name = "show-sharding-audit-algorithms")
- private final List<ShowShardingAuditAlgorithmsStatementTestCase> showShardingAuditAlgorithmsTestCases = new LinkedList<>();
+ @XmlElement(name = "show-sharding-auditors")
+ private final List<ShowShardingAuditorsStatementTestCase> showShardingAuditorsTestCases = new LinkedList<>();
@XmlElement(name = "show-sharding-table-rules")
private final List<ShowShardingTableRulesStatementTestCase> showShardingTableRulesTestCases = new LinkedList<>();
@@ -1685,7 +1685,7 @@ public final class SQLParserTestCases {
putAll(showShardingBindingTableRulesTestCases, result);
putAll(showShardingBroadcastTableRulesTestCases, result);
putAll(showShardingAlgorithmsTestCases, result);
- putAll(showShardingAuditAlgorithmsTestCases, result);
+ putAll(showShardingAuditorsTestCases, result);
putAll(showShardingTableRulesTestCases, result);
putAll(showShardingTableRuleTestCases, result);
putAll(showScalingListTestCases, result);
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditAlgorithmsStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditorsStatementTestCase.java
similarity index 93%
rename from shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditAlgorithmsStatementTestCase.java
rename to shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditorsStatementTestCase.java
index 632e28daafe..3fe342ff5af 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditAlgorithmsStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rql/ShowShardingAuditorsStatementTestCase.java
@@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlElement;
*/
@Getter
@Setter
-public final class ShowShardingAuditAlgorithmsStatementTestCase extends SQLParserTestCase {
+public final class ShowShardingAuditorsStatementTestCase extends SQLParserTestCase {
@XmlElement
private ExpectedDatabase database;
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rql/show.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rql/show.xml
index 54790984f85..e96935d7cda 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rql/show.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rql/show.xml
@@ -42,9 +42,9 @@
<database name="databaseName" start-index="30" stop-index="41"/>
</show-sharding-algorithms>
- <show-sharding-audit-algorithms sql-case-id="show-sharding-audit-algorithms-from">
- <database name="databaseName" start-index="36" stop-index="47"/>
- </show-sharding-audit-algorithms>
+ <show-sharding-auditors sql-case-id="show-sharding-auditors-from">
+ <database name="databaseName" start-index="28" stop-index="39"/>
+ </show-sharding-auditors>
<show-readwrite-splitting-rules sql-case-id="show-readwrite-splitting-rules">
<database name="readwrite_splitting_db" start-index="36" stop-index="57"/>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rql/show.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rql/show.xml
index 7d63c024944..3c559eb89e4 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rql/show.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rql/show.xml
@@ -23,7 +23,7 @@
<distsql-case id="show-sharding-table-rule" value="SHOW SHARDING TABLE RULE t_order" />
<distsql-case id="show-sharding-table-rule-from" value="SHOW SHARDING TABLE RULE t_order FROM databaseName" />
<distsql-case id="show-sharding-algorithms-from" value="SHOW SHARDING ALGORITHMS FROM databaseName" />
- <distsql-case id="show-sharding-audit-algorithms-from" value = "SHOW SHARDING AUDIT ALGORITHMS FROM databaseName" />
+ <distsql-case id="show-sharding-auditors-from" value = "SHOW SHARDING AUDITORS FROM databaseName" />
<distsql-case id="show-readwrite-splitting-rules" value="SHOW READWRITE_SPLITTING RULES FROM readwrite_splitting_db" />
<distsql-case id="show-db-discovery-rules" value="SHOW DB_DISCOVERY RULES FROM db_discovery_db" />
<distsql-case id="show-db-discovery-types" value="SHOW DB_DISCOVERY TYPES FROM db_discovery_db" />