This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 f25e264b0ca Redefine DBDiscoverySQLException's vendor codes (#20926)
f25e264b0ca is described below
commit f25e264b0ca29caed0ef70e735ea503dc9a2f580
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Sep 11 18:29:20 2022 +0800
Redefine DBDiscoverySQLException's vendor codes (#20926)
---
docs/document/content/user-manual/error-code/sql-error-code.cn.md | 8 ++++----
docs/document/content/user-manual/error-code/sql-error-code.en.md | 8 ++++----
.../{ => mgr}/InvalidMGRGroupNameConfigurationException.java | 5 +++--
.../mysql/exception/{ => mgr}/InvalidMGRModeException.java | 5 +++--
.../mysql/exception/{ => mgr}/InvalidMGRPluginException.java | 5 +++--
.../{ => mgr}/InvalidMGRReplicationGroupMemberException.java | 5 +++--
.../mysql/type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java | 8 ++++----
7 files changed, 24 insertions(+), 20 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 03ca66952b6..e435202e32f 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
@@ -133,10 +133,10 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| SQL State | Vendor Code | 错误信息 |
| --------- | ----------- | ------ |
-| HY000 | 23000 | MGR plugin is not active in database \`%s\` |
-| 44000 | 23001 | MGR is not in single primary mode in database
\`%s\` |
-| 44000 | 23002 | \`%s\` is not in MGR replication group member in
database \`%s\` |
-| 44000 | 23003 | Group name in MGR is not same with configured one
\`%s\` in database \`%s\` |
+| HY000 | 23080 | MGR plugin is not active in database \`%s\` |
+| 44000 | 23081 | MGR is not in single primary mode in database
\`%s\` |
+| 44000 | 23082 | \`%s\` is not in MGR replication group member in
database \`%s\` |
+| 44000 | 23083 | Group name in MGR is not same with configured one
\`%s\` in database \`%s\` |
### SQL 方言转换
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 cd8f9c046ab..75541706d46 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
@@ -133,10 +133,10 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| SQL State | Vendor Code | Reason |
| --------- | ----------- | ------ |
-| HY000 | 23000 | MGR plugin is not active in database \`%s\` |
-| 44000 | 23001 | MGR is not in single primary mode in database
\`%s\` |
-| 44000 | 23002 | \`%s\` is not in MGR replication group member in
database \`%s\` |
-| 44000 | 23003 | Group name in MGR is not same with configured one
\`%s\` in database \`%s\` |
+| HY000 | 23080 | MGR plugin is not active in database \`%s\` |
+| 44000 | 23081 | MGR is not in single primary mode in database
\`%s\` |
+| 44000 | 23082 | \`%s\` is not in MGR replication group member in
database \`%s\` |
+| 44000 | 23083 | Group name in MGR is not same with configured one
\`%s\` in database \`%s\` |
### SQL Dialect Translator
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRGroupNameConfigurationException.java
similarity index 80%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRGroupNameConfigurationException.java
index e98519b439b..e53f771a297 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRGroupNameConfigurationException.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRGroupNameConfigurationException.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.mysql.exception;
+package org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.DBDiscoverySQLException;
import
org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
@@ -27,6 +28,6 @@ public final class InvalidMGRGroupNameConfigurationException
extends DBDiscovery
private static final long serialVersionUID = -2585442998454509788L;
public InvalidMGRGroupNameConfigurationException(final String groupName,
final String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 3, "Group name in MGR is
not same with configured one `%s` in database `%s`", groupName, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 83, "Group name in MGR is
not same with configured one `%s` in database `%s`", groupName, databaseName);
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRModeException.java
similarity index 80%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRModeException.java
index e8255b37aad..635fb6a7070 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRModeException.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRModeException.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.mysql.exception;
+package org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.DBDiscoverySQLException;
import
org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
@@ -27,6 +28,6 @@ public final class InvalidMGRModeException extends
DBDiscoverySQLException {
private static final long serialVersionUID = -2190741601319220590L;
public InvalidMGRModeException(final String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 1, "MGR is not in single
primary mode in database `%s`", databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 81, "MGR is not in single
primary mode in database `%s`", databaseName);
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRPluginException.java
similarity index 81%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRPluginException.java
index 8e8810b3440..012fcec3894 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRPluginException.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRPluginException.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.mysql.exception;
+package org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.DBDiscoverySQLException;
import
org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
@@ -27,6 +28,6 @@ public final class InvalidMGRPluginException extends
DBDiscoverySQLException {
private static final long serialVersionUID = 1703082683321097037L;
public InvalidMGRPluginException(final String databaseName) {
- super(XOpenSQLState.GENERAL_ERROR, 0, "MGR plugin is not active in
database `%s`", databaseName);
+ super(XOpenSQLState.GENERAL_ERROR, 80, "MGR plugin is not active in
database `%s`", databaseName);
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRReplicationGroupMemberException.java
similarity index 80%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRReplicationGroupMemberException.java
index 38a5bcaf216..bcb834e7e39 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/mgr/InvalidMGRReplicationGroupMemberException.java
@@ -15,8 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.dbdiscovery.mysql.exception;
+package org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.DBDiscoverySQLException;
import
org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
/**
@@ -27,6 +28,6 @@ public final class InvalidMGRReplicationGroupMemberException
extends DBDiscovery
private static final long serialVersionUID = 3766206496827463146L;
public InvalidMGRReplicationGroupMemberException(final String url, final
String databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 2, "`%s` is not in MGR
replication group member in database `%s`", url, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 82, "`%s` is not in MGR
replication group member in database `%s`", url, databaseName);
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java
index b4f62ce012f..e02fa1cf70e 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java
@@ -19,10 +19,10 @@ package org.apache.shardingsphere.dbdiscovery.mysql.type;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.dbdiscovery.mysql.exception.InvalidMGRGroupNameConfigurationException;
-import
org.apache.shardingsphere.dbdiscovery.mysql.exception.InvalidMGRModeException;
-import
org.apache.shardingsphere.dbdiscovery.mysql.exception.InvalidMGRPluginException;
-import
org.apache.shardingsphere.dbdiscovery.mysql.exception.InvalidMGRReplicationGroupMemberException;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRGroupNameConfigurationException;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRModeException;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRPluginException;
+import
org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRReplicationGroupMemberException;
import
org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryProviderAlgorithm;
import org.apache.shardingsphere.dbdiscovery.spi.ReplicaDataSourceStatus;
import
org.apache.shardingsphere.infra.database.metadata.dialect.MySQLDataSourceMetaData;