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/09/01 14:47:18 UTC
[shardingsphere] branch master updated: Add InvalidMGRReplicationGroupMemberException (#20718)
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 25f27445664 Add InvalidMGRReplicationGroupMemberException (#20718)
25f27445664 is described below
commit 25f2744566427d11dba4ede3b730dd23cbc10d6f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Sep 1 22:47:07 2022 +0800
Add InvalidMGRReplicationGroupMemberException (#20718)
---
.../content/user-manual/error-code/sql-error-code.cn.md | 1 +
.../content/user-manual/error-code/sql-error-code.en.md | 1 +
.../exception/InvalidMGRReplicationGroupMemberException.java | 12 ++++++------
.../type/MGRMySQLDatabaseDiscoveryProviderAlgorithm.java | 4 ++--
.../exception/ShardingSphereConfigurationException.java | 2 +-
5 files changed, 11 insertions(+), 9 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 e8ad0e55b59..34f2e1d52c2 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
@@ -67,6 +67,7 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| HY000 | 20050 | Routed target \`%s\` does not exist, available targets are \`%s\` |
| HY000 | 20051 | \`%s %s\` can not route correctly for %s \`%s\` |
| 42S02 | 20052 | Can not find data source in sharding rule, invalid actual data node \`%s\` |
+| 44000 | 23000 | \`%s\` is not in MGR replication group member in database \`%s\` |
| HY004 | 24000 | Encrypt algorithm \`%s\` initialize failed, reason is: %s |
| 0A000 | 24001 | The SQL clause \`%s\` is unsupported in encrypt rule |
| 44000 | 24002 | Altered column \`%s\` must use same encrypt algorithm with previous column \`%s\` in table \`%s\` |
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 179a79a8dfe..7e725e0abcc 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
@@ -67,6 +67,7 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| HY000 | 20050 | Routed target \`%s\` does not exist, available targets are \`%s\` |
| HY000 | 20051 | \`%s %s\` can not route correctly for %s \`%s\` |
| 42S02 | 20052 | Can not find data source in sharding rule, invalid actual data node \`%s\` |
+| 44000 | 23000 | \`%s\` is not in MGR replication group member in database \`%s\` |
| HY004 | 24000 | Encrypt algorithm \`%s\` initialize failed, reason is: %s |
| HY004 | 24001 | The SQL clause \`%s\` is unsupported in encrypt rule |
| 44000 | 24002 | Altered column \`%s\` must use same encrypt algorithm with previous column \`%s\` in table \`%s\` |
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
similarity index 65%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
copy to shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
index f9093b5793c..9dbdd48ea91 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/exception/InvalidMGRReplicationGroupMemberException.java
@@ -15,19 +15,19 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.exception;
+package org.apache.shardingsphere.dbdiscovery.mysql.exception;
import org.apache.shardingsphere.infra.util.exception.sql.ShardingSphereSQLException;
import org.apache.shardingsphere.infra.util.exception.sql.sqlstate.XOpenSQLState;
/**
- * Configuration exception.
+ * Invalid MGR replication group member exception.
*/
-public final class ShardingSphereConfigurationException extends ShardingSphereSQLException {
+public final class InvalidMGRReplicationGroupMemberException extends ShardingSphereSQLException {
- private static final long serialVersionUID = -1360264079938958332L;
+ private static final long serialVersionUID = 3766206496827463146L;
- public ShardingSphereConfigurationException(final String reason, final String... messageArguments) {
- super(XOpenSQLState.SYNTAX_ERROR, 11001, reason, messageArguments);
+ public InvalidMGRReplicationGroupMemberException(final String url, final String databaseName) {
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 23000, "`%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 daecd81abed..eaccbca839f 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
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.dbdiscovery.mysql.type;
import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.dbdiscovery.mysql.exception.InvalidMGRReplicationGroupMemberException;
import org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryProviderAlgorithm;
import org.apache.shardingsphere.dbdiscovery.spi.ReplicaDataSourceStatus;
-import org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
import org.apache.shardingsphere.infra.database.metadata.dialect.MySQLDataSourceMetaData;
import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.util.exception.sql.SQLWrapperException;
@@ -129,7 +129,7 @@ public final class MGRMySQLDatabaseDiscoveryProviderAlgorithm implements Databas
}
}
}
- throw new ShardingSphereConfigurationException("`%s` is not in MGR replication group member in database `%s`.", url, databaseName);
+ throw new InvalidMGRReplicationGroupMemberException(url, databaseName);
}
@Override
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
index f9093b5793c..2e7778ebb5c 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/exception/ShardingSphereConfigurationException.java
@@ -27,7 +27,7 @@ public final class ShardingSphereConfigurationException extends ShardingSphereSQ
private static final long serialVersionUID = -1360264079938958332L;
- public ShardingSphereConfigurationException(final String reason, final String... messageArguments) {
+ public ShardingSphereConfigurationException(final String reason, final Object... messageArguments) {
super(XOpenSQLState.SYNTAX_ERROR, 11001, reason, messageArguments);
}
}