This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 a8779786520 Adjust RuleDefinitionException‘s error codes (#30702)
a8779786520 is described below
commit a87797865202f793b03713425b8ef5deac022b85
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Mar 30 20:09:40 2024 +0800
Adjust RuleDefinitionException‘s error codes (#30702)
---
.../content/user-manual/error-code/sql-error-code.cn.md | 15 +++++----------
.../content/user-manual/error-code/sql-error-code.en.md | 15 +++++----------
.../infra/exception/rule/DuplicateRuleException.java | 6 +++---
.../exception/rule/InvalidRuleConfigurationException.java | 6 +++---
.../exception/rule/MissingRequiredRuleException.java | 6 +++---
.../infra/exception/rule/RuleInUsedException.java | 4 ++--
.../infra/exception/rule/RuleNotExistedException.java | 2 +-
.../sql/type/kernel/category/RuleDefinitionException.java | 7 ++-----
.../exception/MissingRequiredSingleTableException.java | 2 +-
9 files changed, 25 insertions(+), 38 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index 197e243cb2e..feb757f829e 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -34,6 +34,11 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 44000 | 10105 | Invalid storage unit status, error message is: %s.
|
| 44000 | 10106 | Read storage unit \`%s\` does not exist in rule
\`%s\`. |
| 42000 | 10107 | There is no storage unit in database \`%s\`.
|
+| 44000 | 10200 | Invalid \`%s\` rule \`%s\`, error message is: %s
|
+| 44000 | 10201 | %s rules \`%s\` do not exist in database \`%s\`.
|
+| 44000 | 10202 | %s rules \`%s\` in database \`%s\` are still in
used. |
+| 44000 | 10205 | Duplicate %s rule names \`%s\` in database \`%s\`.
|
+| 44000 | 10210 | There is no rule in database '%s'.
|
| 44000 | 10300 | Algorithm '%s.'%s' initialization failed, reason
is: %s. |
| 44000 | 10301 | '%s' algorithm on %s is required.
|
| 42S02 | 10302 | '%s' algorithm '%s' on %s is unregistered.
|
@@ -147,16 +152,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY000 | 18201 | CDC server exception, reason is: %s.
|
| HY000 | 18202 | CDC login failed, reason is: %s
|
-### 规则定义
-
-| SQL State | Vendor Code | 错误信息
|
-|-----------|-------------|-------------------------------------------------------|
-| 44000 | 19100 | Invalid \`%s\` rule \`%s\`, error message is: %s
|
-| 44000 | 19101 | %s rules \`%s\` do not exist in database \`%s\`.
|
-| 44000 | 19102 | %s rules \`%s\` in database \`%s\` are still in
used. |
-| 44000 | 19105 | Duplicate %s rule names \`%s\` in database \`%s\`.
|
-| 44000 | 19110 | There is no rule in database '%s'.
|
-
### DistSQL
| SQL State | Vendor Code | 错误信息
|
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md
b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index 65bed95a23c..57af866bc95 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -38,6 +38,11 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| 44000 | 10105 | Invalid storage unit status, error message is: %s.
|
| 44000 | 10106 | Read storage unit \`%s\` does not exist in rule
\`%s\`. |
| 42000 | 10107 | There is no storage unit in database \`%s\`.
|
+| 44000 | 10200 | Invalid \`%s\` rule \`%s\`, error message is: %s
|
+| 44000 | 10201 | %s rules \`%s\` do not exist in database \`%s\`.
|
+| 44000 | 10202 | %s rules \`%s\` in database \`%s\` are still in
used. |
+| 44000 | 10205 | Duplicate %s rule names \`%s\` in database \`%s\`.
|
+| 44000 | 10210 | There is no rule in database '%s'.
|
| 44000 | 10300 | Algorithm '%s.'%s' initialization failed, reason
is: %s. |
| 44000 | 10301 | '%s' algorithm on %s is required.
|
| 42S02 | 10302 | '%s' algorithm '%s' on %s is unregistered.
|
@@ -151,16 +156,6 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| HY000 | 18201 | CDC server exception, reason is: %s.
|
| HY000 | 18202 | CDC login failed, reason is: %s
|
-### Rule Definition
-
-| SQL State | Vendor Code | Reason
|
-|-----------|-------------|-------------------------------------------------------|
-| 44000 | 19100 | Invalid \`%s\` rule \`%s\`, error message is: %s
|
-| 44000 | 19101 | %s rules \`%s\` do not exist in database \`%s\`.
|
-| 44000 | 19102 | %s rules \`%s\` in database \`%s\` are still in
used. |
-| 44000 | 19105 | Duplicate %s rule names \`%s\` in database \`%s\`.
|
-| 44000 | 19110 | There is no rule in database '%s'.
|
-
### DistSQL
| SQL State | Vendor Code | Reason
|
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/DuplicateRuleException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/DuplicateRuleException.java
index 53c055d0c0f..9d99a007da3 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/DuplicateRuleException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/DuplicateRuleException.java
@@ -30,14 +30,14 @@ public final class DuplicateRuleException extends
RuleDefinitionException {
private static final long serialVersionUID = -1738699538105858939L;
public DuplicateRuleException(final String ruleType, final String
databaseName, final Collection<String> ruleNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 105,
String.format("Duplicate %s rule names `%s` in database `%s`.", ruleType,
ruleNames, databaseName));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 205,
String.format("Duplicate %s rule names `%s` in database `%s`.", ruleType,
ruleNames, databaseName));
}
public DuplicateRuleException(final String ruleType, final
Collection<String> ruleNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 105,
String.format("Duplicate %s rule names `%s`.", ruleType, ruleNames));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 205,
String.format("Duplicate %s rule names `%s`.", ruleType, ruleNames));
}
public DuplicateRuleException(final String type, final String
databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 105,
String.format("Duplicate `%s` in database `%s`.", type, databaseName));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 205,
String.format("Duplicate `%s` in database `%s`.", type, databaseName));
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InvalidRuleConfigurationException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InvalidRuleConfigurationException.java
index 719881b5a79..de29a935912 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InvalidRuleConfigurationException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InvalidRuleConfigurationException.java
@@ -30,14 +30,14 @@ public final class InvalidRuleConfigurationException
extends RuleDefinitionExcep
private static final long serialVersionUID = 6085010920008859376L;
public InvalidRuleConfigurationException(final String ruleType, final
String rule, final String errorMessage) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 100, "Invalid `%s` rule
`%s`, error message is: %s", ruleType, rule, errorMessage);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 200, "Invalid `%s` rule
`%s`, error message is: %s", ruleType, rule, errorMessage);
}
public InvalidRuleConfigurationException(final String ruleType, final
Collection<String> rules, final Collection<String> errorMessages) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 100, "Invalid `%s` rules
`%s`, error messages are: %s", ruleType, rules, errorMessages);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 200, "Invalid `%s` rules
`%s`, error messages are: %s", ruleType, rules, errorMessages);
}
public InvalidRuleConfigurationException(final String ruleType, final
String errorMessage) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 100, "Invalid `%s` rule,
error message is: %s", ruleType, errorMessage);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 200, "Invalid `%s` rule,
error message is: %s", ruleType, errorMessage);
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/MissingRequiredRuleException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/MissingRequiredRuleException.java
index 90c075987a5..405344681a8 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/MissingRequiredRuleException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/MissingRequiredRuleException.java
@@ -30,15 +30,15 @@ public final class MissingRequiredRuleException extends
RuleDefinitionException
private static final long serialVersionUID = -8464574460917965546L;
public MissingRequiredRuleException(final String ruleType) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 101, String.format("%s
rule does not exist.", ruleType));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 201, String.format("%s
rule does not exist.", ruleType));
}
public MissingRequiredRuleException(final String ruleType, final String
databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 101, String.format("%s
rule does not exist in database `%s`.", ruleType, databaseName));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 201, String.format("%s
rule does not exist in database `%s`.", ruleType, databaseName));
}
public MissingRequiredRuleException(final String ruleType, final
Collection<String> ruleNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 101, String.format("%s
rules `%s` do not exist.", ruleType, ruleNames));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 201, String.format("%s
rules `%s` do not exist.", ruleType, ruleNames));
}
public MissingRequiredRuleException(final String ruleType, final String
databaseName, final String ruleName) {
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleInUsedException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleInUsedException.java
index 77d3f959e10..eefe3cdb4d5 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleInUsedException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleInUsedException.java
@@ -30,10 +30,10 @@ public final class RuleInUsedException extends
RuleDefinitionException {
private static final long serialVersionUID = 3308787279125477660L;
public RuleInUsedException(final String ruleType, final String
databaseName, final Collection<String> ruleNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 102, "%s rules `%s` in
database `%s` are still in used.", ruleType, ruleNames, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 202, "%s rules `%s` in
database `%s` are still in used.", ruleType, ruleNames, databaseName);
}
public RuleInUsedException(final String ruleType, final String
databaseName, final Collection<String> ruleNames, final String usingType) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 102, "%s rules `%s` in
database `%s` are still in used by %s.", ruleType, ruleNames, databaseName,
usingType);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 202, "%s rules `%s` in
database `%s` are still in used by %s.", ruleType, ruleNames, databaseName,
usingType);
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleNotExistedException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleNotExistedException.java
index 00571995691..a397e397a00 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleNotExistedException.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleNotExistedException.java
@@ -28,6 +28,6 @@ public final class RuleNotExistedException extends
RuleDefinitionException {
private static final long serialVersionUID = -4150905802300104824L;
public RuleNotExistedException(final String databaseName) {
- super(XOpenSQLState.SYNTAX_ERROR, 110, "There is no rule in database
'%s'.", databaseName);
+ super(XOpenSQLState.SYNTAX_ERROR, 210, "There is no rule in database
'%s'.", databaseName);
}
}
diff --git
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java
index 9ba47573411..226e3ba9f6e 100644
---
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java
+++
b/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java
@@ -18,18 +18,15 @@
package
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.KernelSQLException;
/**
* Rule definition exception.
*/
-public abstract class RuleDefinitionException extends KernelSQLException {
+public abstract class RuleDefinitionException extends MetaDataSQLException {
private static final long serialVersionUID = -6414242067345718028L;
- private static final int KERNEL_CODE = 9;
-
protected RuleDefinitionException(final SQLState sqlState, final int
errorCode, final String reason, final Object... messageArgs) {
- super(sqlState, KERNEL_CODE, errorCode, reason, messageArgs);
+ super(sqlState, errorCode, reason, messageArgs);
}
}
diff --git
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/exception/MissingRequiredSingleTableException.java
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/exception/MissingRequiredSingleTableException.java
index d7e76fd2abc..426ca7faf4e 100644
---
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/exception/MissingRequiredSingleTableException.java
+++
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/exception/MissingRequiredSingleTableException.java
@@ -28,6 +28,6 @@ public final class MissingRequiredSingleTableException
extends RuleDefinitionExc
private static final long serialVersionUID = 3155006580453893122L;
public MissingRequiredSingleTableException(final String storageUnitName,
final String tableName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 106,
String.format("Missing required table `%s` in storage unit `%s`.", tableName,
storageUnitName));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 206,
String.format("Missing required table `%s` in storage unit `%s`.", tableName,
storageUnitName));
}
}