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 421370e1ac4 Refactor MissingRequiredReadStorageUnitException (#30715)
421370e1ac4 is described below

commit 421370e1ac49ab70d16fefa3413282ca28776b9d
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Mar 31 17:03:00 2024 +0800

    Refactor MissingRequiredReadStorageUnitException (#30715)
---
 .../user-manual/error-code/sql-error-code.cn.md    | 22 +++++++--------
 .../user-manual/error-code/sql-error-code.en.md    | 22 +++++++--------
 .../MissingRequiredReadStorageUnitException.java   |  8 +++---
 ...eadwriteSplittingStorageUnitStatusExecutor.java |  2 +-
 .../StorageUnitDefinitionViolationException.java   | 33 ----------------------
 5 files changed, 27 insertions(+), 60 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 1aa48ab6366..0114ab57f73 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,7 +34,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 | 0A000     | 10108       | Can not alter connection info in storage units: 
'%s'.                          |
 | 0A000     | 10109       | Storage units can not connect, error messages are: 
%s.                         |
 | 44000     | 10120       | Invalid storage unit status, error message is: %s. 
                            |
-| 44000     | 10150       | Read storage unit '%s' does not exist in rule 
'%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.  
                            |
@@ -209,16 +208,17 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
 
 ### 读写分离
 
-| SQL State | Vendor Code | 错误信息                                               
                                         |
-|-----------|-------------|---------------------------------------------------------------------------------------------|
-| 44000     | 20270       | Inline expression %s names size error.             
                                         |
-| HY004     | 20280       | Invalid read database weight \`%s\`.               
                                         |
-| 44000     | 20290       | Data source name is required in database \`%s\.`   
                                         |
-| 44000     | 20291       | Write data source name is required in database 
`\`%s\.`                                     |
-| 44000     | 20292       | Read data source names is required in database 
`\`%s\.`                                     |
-| 44000     | 20293       | Can not config duplicate %s data source \`%s\` in 
database \`%s\.`                          |
-| 42S02     | 20294       | %s data source name \`%s\` not in database \`%s\.` 
                                         |
-| 44000     | 20295       | Auto aware data source name is required in 
database \`%s\.`                                 |
+| SQL State | Vendor Code | 错误信息                                               
                |
+|-----------|-------------|--------------------------------------------------------------------|
+| 44000     | 20270       | Inline expression %s names size error.             
                |
+| HY004     | 20280       | Invalid read database weight \`%s\`.               
                |
+| 44000     | 20290       | Data source name is required in database \`%s\.`   
                |
+| 44000     | 20291       | Write data source name is required in database 
`\`%s\.`            |
+| 44000     | 20292       | Read data source names is required in database 
`\`%s\.`            |
+| 44000     | 20293       | Can not config duplicate %s data source \`%s\` in 
database \`%s\.` |
+| 42S02     | 20294       | %s data source name \`%s\` not in database \`%s\.` 
                |
+| 44000     | 20295       | Auto aware data source name is required in 
database \`%s\.`        |
+| 44000     | 20296       | Read storage unit '%s' does not exist in rule 
'%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 adbe0d3458e..cdee3823c90 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
@@ -34,7 +34,6 @@ SQL error codes provide by standard `SQL State`, `Vendor 
Code` and `Reason`, whi
 | 0A000     | 10108       | Can not alter connection info in storage units: 
'%s'.                          |
 | 0A000     | 10109       | Storage units can not connect, error messages are: 
%s.                         |
 | 44000     | 10120       | Invalid storage unit status, error message is: %s. 
                            |
-| 44000     | 10150       | Read storage unit '%s' does not exist in rule 
'%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.  
                            |
@@ -209,16 +208,17 @@ SQL error codes provide by standard `SQL State`, `Vendor 
Code` and `Reason`, whi
 
 ### Readwrite-splitting
 
-| SQL State | Vendor Code | Reason                                             
                                         |
-|-----------|-------------|---------------------------------------------------------------------------------------------|
-| 44000     | 20270       | Inline expression %s names size error.             
                                         |
-| HY004     | 20280       | Invalid read database weight \`%s\`.               
                                         |
-| 44000     | 20290       | Data source name is required in database \`%s\.`   
                                         |
-| 44000     | 20291       | Write data source name is required in database 
`\`%s\.`                                     |
-| 44000     | 20292       | Read data source names is required in database 
`\`%s\.`                                     |
-| 44000     | 20293       | Can not config duplicate %s data source \`%s\` in 
database \`%s\.`                          |
-| 42S02     | 20294       | %s data source name \`%s\` not in database \`%s\.` 
                                         |
-| 44000     | 20295       | Auto aware data source name is required in 
database \`%s\.`                                 |
+| SQL State | Vendor Code | Reason                                             
                |
+|-----------|-------------|--------------------------------------------------------------------|
+| 44000     | 20270       | Inline expression %s names size error.             
                |
+| HY004     | 20280       | Invalid read database weight \`%s\`.               
                |
+| 44000     | 20290       | Data source name is required in database \`%s\.`   
                |
+| 44000     | 20291       | Write data source name is required in database 
`\`%s\.`            |
+| 44000     | 20292       | Read data source names is required in database 
`\`%s\.`            |
+| 44000     | 20293       | Can not config duplicate %s data source \`%s\` in 
database \`%s\.` |
+| 42S02     | 20294       | %s data source name \`%s\` not in database \`%s\.` 
                |
+| 44000     | 20295       | Auto aware data source name is required in 
database \`%s\.`        |
+| 44000     | 20296       | Read storage unit '%s' does not exist in rule 
'%s'.                |
 
 ### Database HA
 
diff --git 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/exception/MissingRequiredReadStorageUnitException.java
 
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/exception/checker/MissingRequiredReadStorageUnitException.java
similarity index 81%
rename from 
features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/exception/MissingRequiredReadStorageUnitException.java
rename to 
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/exception/checker/MissingRequiredReadStorageUnitException.java
index 5e22e1c45c7..c8ba63830f8 100644
--- 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/exception/MissingRequiredReadStorageUnitException.java
+++ 
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/exception/checker/MissingRequiredReadStorageUnitException.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.readwritesplitting.distsql.handler.exception;
+package org.apache.shardingsphere.readwritesplitting.exception.checker;
 
-import 
org.apache.shardingsphere.infra.exception.storageunit.StorageUnitDefinitionViolationException;
 import 
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
+import 
org.apache.shardingsphere.readwritesplitting.exception.ReadwriteSplittingSQLException;
 
 /**
  * Missing required read storage unit exception.
  */
-public final class MissingRequiredReadStorageUnitException extends 
StorageUnitDefinitionViolationException {
+public final class MissingRequiredReadStorageUnitException extends 
ReadwriteSplittingSQLException {
     
     private static final long serialVersionUID = -4252553422332603648L;
     
     public MissingRequiredReadStorageUnitException(final String ruleName, 
final String storageUnitName) {
-        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 50, "Read storage unit 
'%s' does not exist in rule '%s'.", storageUnitName, ruleName);
+        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 96, "Read storage unit 
'%s' does not exist in rule '%s'.", storageUnitName, ruleName);
     }
 }
diff --git 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingStorageUnitStatusExecutor.java
 
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingStorageUnitStatusExecutor.java
index 07eda407ef3..056492962bc 100644
--- 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingStorageUnitStatusExecutor.java
+++ 
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingStorageUnitStatusExecutor.java
@@ -29,7 +29,7 @@ import 
org.apache.shardingsphere.infra.state.datasource.DataSourceState;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.storage.service.StorageNodeStatusService;
 import 
org.apache.shardingsphere.infra.exception.storageunit.InvalidStorageUnitStatusException;
-import 
org.apache.shardingsphere.readwritesplitting.distsql.handler.exception.MissingRequiredReadStorageUnitException;
+import 
org.apache.shardingsphere.readwritesplitting.exception.checker.MissingRequiredReadStorageUnitException;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.AlterReadwriteSplittingStorageUnitStatusStatement;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceRule;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitDefinitionViolationException.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitDefinitionViolationException.java
deleted file mode 100644
index ac7085b08ae..00000000000
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitDefinitionViolationException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.exception.storageunit;
-
-import 
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState;
-import 
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException;
-
-/**
- * Storage unit definition violation exception.
- */
-public abstract class StorageUnitDefinitionViolationException extends 
ResourceDefinitionException {
-    
-    private static final long serialVersionUID = -2686784350802985974L;
-    
-    protected StorageUnitDefinitionViolationException(final SQLState sqlState, 
final int errorCode, final String reason, final Object... messageArgs) {
-        super(sqlState, errorCode, reason, messageArgs);
-    }
-}

Reply via email to