From 211fc57c30b5983ee51e2ef7669ae4be3f719791 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Sun, 31 Mar 2024 23:42:55 +0800 Subject: [PATCH] Move ResourceDefinitionException and RuleDefinitionException (#30719) * Refactor TableDoesNotExistException * Refactor TableNotFoundException * Refactor UnsupportedStorageTypeException * Refactor UnsupportedStorageTypeException * Refactor UnrecognizedDatabaseURLException * Refactor UnsupportedStorageTypeException * Refactor UnsupportedStorageTypeException * Move ResourceDefinitionException and RuleDefinitionException --- .../content/user-manual/error-code/sql-error-code.cn.md | 7 +++---- .../content/user-manual/error-code/sql-error-code.en.md | 9 +++------ .../handler/update/CreateBroadcastTableRuleExecutor.java | 2 +- .../update/CreateBroadcastTableRuleExecutorTest.java | 2 +- .../handler/update/CreateEncryptRuleExecutor.java | 2 +- .../checker/ReadwriteSplittingRuleStatementChecker.java | 2 +- ...AlterReadwriteSplittingStorageUnitStatusExecutor.java | 2 +- .../update/AlterReadwriteSplittingRuleExecutorTest.java | 2 +- .../update/CreateReadwriteSplittingRuleExecutorTest.java | 2 +- .../update/DropReadwriteSplittingRuleExecutorTest.java | 2 +- .../handler/checker/ShadowRuleStatementChecker.java | 2 +- .../distsql/update/AlterShadowRuleExecutorTest.java | 2 +- .../distsql/update/CreateShadowRuleExecutorTest.java | 2 +- .../checker/ShardingTableRuleStatementChecker.java | 2 +- .../checker/ShardingRuleStatementCheckerTest.java | 2 +- .../update/DropShardingAlgorithmExecutorTest.java | 2 +- .../update/DropShardingTableRuleExecutorTest.java | 2 +- .../segment/from/impl/SimpleTableSegmentBinder.java | 4 ++-- .../segment/from/impl/SimpleTableSegmentBinderTest.java | 4 ++-- .../rule/checker/RuleConfigurationCheckEngine.java | 2 +- ...tExistsException.java => TableNotFoundException.java} | 6 +++--- .../exception/resource}/ResourceDefinitionException.java | 3 ++- .../AlterStorageUnitConnectionInfoException.java | 4 ++-- .../storageunit/DuplicateStorageUnitException.java | 4 ++-- .../storageunit/EmptyStorageUnitException.java | 4 ++-- .../storageunit/InUsedStorageUnitException.java | 4 ++-- .../storageunit/InvalidStorageUnitStatusException.java | 4 ++-- .../MissingRequiredStorageUnitsException.java | 4 ++-- .../storageunit/StorageUnitsConnectException.java | 4 ++-- .../storageunit/StorageUnitsOperateException.java | 4 ++-- .../infra/exception/rule/DuplicateRuleException.java | 1 - .../infra/exception/rule/EmptyRuleException.java | 1 - .../infra/exception/rule/InUsedRuleException.java | 1 - .../rule/InvalidRuleConfigurationException.java | 1 - .../exception/rule/MissingRequiredRuleException.java | 1 - .../infra/exception/rule}/RuleDefinitionException.java | 3 ++- .../UnsupportedActualDataNodeStructureException.java | 2 +- .../core/connector/url/StandardJdbcUrlParser.java | 1 - .../connector/url/UnrecognizedDatabaseURLException.java | 6 +++--- .../core/type/UnsupportedStorageTypeException.java | 4 +--- .../executor/rdl/resource/AlterStorageUnitExecutor.java | 8 ++++---- .../rdl/resource/RegisterStorageUnitExecutor.java | 4 ++-- .../rdl/resource/UnregisterStorageUnitExecutor.java | 6 +++--- .../DistSQLDataSourcePoolPropertiesValidator.java | 2 +- .../rdl/resource/AlterStorageUnitExecutorTest.java | 6 +++--- .../rdl/resource/RegisterStorageUnitExecutorTest.java | 2 +- .../rdl/resource/UnregisterStorageUnitExecutorTest.java | 4 ++-- .../data/pipeline/cdc/util/CDCSchemaTableUtils.java | 4 ++-- .../distsql/handler/update/LoadSingleTableExecutor.java | 2 +- .../update/SetDefaultSingleTableStorageUnitExecutor.java | 2 +- .../handler/update/LoadSingleTableExecutorTest.java | 2 +- .../SetDefaultSingleTableStorageUnitExecutorTest.java | 2 +- .../proxy/backend/connector/DatabaseConnector.java | 2 +- .../handler/data/impl/UnicastDatabaseBackendHandler.java | 2 +- .../ral/updatable/RefreshTableMetaDataExecutor.java | 4 ++-- .../util/YamlDatabaseConfigurationImportExecutor.java | 2 +- .../ral/updatable/RefreshTableMetaDataUpdaterTest.java | 4 ++-- .../admin/executor/UnicastResourceShowExecutor.java | 2 +- 58 files changed, 84 insertions(+), 94 deletions(-) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{TableNotExistsException.java => TableNotFoundException.java} (88%) rename infra/{exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category => common/src/main/java/org/apache/shardingsphere/infra/exception/resource}/ResourceDefinitionException.java (91%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/AlterStorageUnitConnectionInfoException.java (88%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/DuplicateStorageUnitException.java (88%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/EmptyStorageUnitException.java (88%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/InUsedStorageUnitException.java (89%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/InvalidStorageUnitStatusException.java (88%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/MissingRequiredStorageUnitsException.java (88%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/StorageUnitsConnectException.java (89%) rename infra/common/src/main/java/org/apache/shardingsphere/infra/exception/{ => resource}/storageunit/StorageUnitsOperateException.java (88%) rename infra/{exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category => common/src/main/java/org/apache/shardingsphere/infra/exception/rule}/RuleDefinitionException.java (90%) 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 7feac46bb702e..9481001732f8d 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 @@ -14,19 +14,16 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供, | SQL State | Vendor Code | 错误信息 | |-----------|-------------|--------------------------------------------------------------------------------| -| 08000 | 10001 | The URL \`%s\` is not recognized, please refer to the pattern \`%s\`. | -| 42000 | 10002 | Can not support 3-tier structure for actual data node \`%s\` with JDBC \`%s\`. | +| 0A000 | 10002 | Can not support 3-tier structure for actual data node \`%s\` with JDBC \`%s\`. | | HY004 | 10003 | Invalid format for actual data node \`%s\`. | | HY000 | 10005 | Column '%s' in %s is ambiguous. | | 42S02 | 10006 | Unknown column '%s' in '%s'. | | 42S02 | 10007 | Table or view \`%s\` does not exist. | | 42S02 | 10008 | Missing required table '%s' in storage unit '%s'. | -| 42000 | 10010 | Rule does not exist. | | 42S02 | 10020 | Schema \`%s\` does not exist. | | 42S02 | 10021 | Single table \`%s\` does not exist. | | HY000 | 10022 | Can not load table with database name \`%s\` and data source name \`%s\`. | | 0A000 | 10030 | Can not drop schema \`%s\` because of contains tables. | -| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`. | | HY000 | 10100 | Can not %s storage units '%s'. | | 42S02 | 10101 | There is no storage unit in database '%s'. | | 44000 | 10102 | Storage units '%s' do not exist in database '%s'. | @@ -74,6 +71,8 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供, |-----------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 08000 | 13000 | Can not register driver, reason is: %s | | 08000 | 13001 | Can not register SQL federation driver, reason is: %s | +| 08000 | 13002 | The URL '%s' is not recognized, please refer to the pattern '%s'. | +| 0A000 | 13003 | Unsupported storage type of URL '%s'. | | 01000 | 13010 | Circuit break open, the request has been ignored. | | 01000 | 13011 | The cluster status is read-only. | | 01000 | 13012 | The cluster status is unavailable. | 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 ca22a4e991c36..516bc1043ace7 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 @@ -14,19 +14,16 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi | SQL State | Vendor Code | Reason | |-----------|-------------|--------------------------------------------------------------------------------| -| 08000 | 10001 | The URL \`%s\` is not recognized, please refer to the pattern \`%s\`. | -| 42000 | 10002 | Can not support 3-tier structure for actual data node \`%s\` with JDBC \`%s\`. | +| 0A000 | 10002 | Can not support 3-tier structure for actual data node \`%s\` with JDBC \`%s\`. | | HY004 | 10003 | Invalid format for actual data node \`%s\`. | | HY000 | 10005 | Column '%s' in %s is ambiguous. | | 42S02 | 10006 | Unknown column '%s' in '%s'. | | 42S02 | 10007 | Table or view \`%s\` does not exist. | | 42S02 | 10008 | Missing required table '%s' in storage unit '%s'. | -| 42000 | 10010 | Rule does not exist. | | 42S02 | 10020 | Schema \`%s\` does not exist. | | 42S02 | 10021 | Single table \`%s\` does not exist. | | HY000 | 10022 | Can not load table with database name \`%s\` and data source name \`%s\`. | | 0A000 | 10030 | Can not drop schema \`%s\` because of contains tables. | -| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`. | | HY000 | 10100 | Can not %s storage units '%s'. | | 42S02 | 10101 | There is no storage unit in database '%s'. | | 44000 | 10102 | Storage units '%s' do not exist in database '%s'. | @@ -36,12 +33,10 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi | 0A000 | 10111 | Can not alter connection info in storage units: '%s'. | | 44000 | 10120 | Invalid storage unit status, error message is: %s. | | 44000 | 10200 | Invalid '%s' rule '%s', error message is: %s | -| 44000 | 10200 | Invalid '%s' rule '%s', error message is: %s | | 42S02 | 10201 | There is no rule in database '%s'. | | 42S02 | 10202 | %s rules '%s' do not exist in database '%s'. | | 44000 | 10203 | %s rules '%s' in database '%s' are still in used. | | 42S01 | 10204 | 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. | @@ -76,6 +71,8 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi |-----------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 08000 | 13000 | Can not register driver, reason is: %s | | 08000 | 13001 | Can not register SQL federation driver, reason is: %s | +| 08000 | 13002 | The URL '%s' is not recognized, please refer to the pattern '%s'. | +| 0A000 | 13003 | Unsupported storage type of URL '%s'. | | 01000 | 13010 | Circuit break open, the request has been ignored. | | 01000 | 13011 | The cluster status is read-only. | | 01000 | 13012 | The cluster status is unavailable. | diff --git a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutor.java b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutor.java index 7a3461c5b005b..55e16814f852b 100644 --- a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutor.java +++ b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutor.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.broadcast.distsql.statement.CreateBroadcastTableRuleStatement; import org.apache.shardingsphere.broadcast.rule.BroadcastRule; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleCreateExecutor; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java index 2db3fbdd11cf5..e853307d59766 100644 --- a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java +++ b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.broadcast.distsql.statement.CreateBroadcastTableRuleStatement; import org.apache.shardingsphere.broadcast.rule.BroadcastRule; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.junit.jupiter.api.Test; diff --git a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java index c86d8db466826..b75ebeb010a7a 100644 --- a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java +++ b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java @@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; diff --git a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java index dd3ea2cae2e5d..42d00985b052a 100644 --- a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java +++ b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/checker/ReadwriteSplittingRuleStatementChecker.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.algorithm.loadbalancer.core.LoadBalanceAlgorithm; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; 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 056492962bc28..2f67f07c4c30b 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 @@ -28,7 +28,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.infra.exception.resource.storageunit.InvalidStorageUnitStatusException; import org.apache.shardingsphere.readwritesplitting.exception.checker.MissingRequiredReadStorageUnitException; import org.apache.shardingsphere.readwritesplitting.distsql.statement.AlterReadwriteSplittingStorageUnitStatusStatement; import org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceRule; diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java index 703f4eb3ef88d..1b399a104268a 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java index 39cc398582662..e9667f34cff18 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java index 996288d664379..61d9c098d1ce4 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.datanode.DataNode; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; +import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; import org.apache.shardingsphere.infra.exception.rule.InUsedRuleException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java index 3139b7b35610c..48b6d8c191a3a 100644 --- a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java +++ b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/checker/ShadowRuleStatementChecker.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.KernelSQLException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java index c5ce72ca9bc22..9259322840b6c 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.algorithm.core.exception.type.InUsedAlgorithmException; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java index f4e3abe461664..3a16655120083 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.segment.AlgorithmSegment; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java index cf9bb407f92e4..daab8c6cae933 100644 --- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java +++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java @@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java index ea0327aae7f41..c932b2078ff49 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java index d1b376b54009a..23f1e616edbad 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.type.InUsedAlgorithmException; import org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; +import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration; diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java index 41a0a7edba671..3c15e739698a9 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.sharding.distsql.update; import com.google.common.base.Splitter; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; +import org.apache.shardingsphere.infra.exception.rule.RuleDefinitionException; import org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException; import org.apache.shardingsphere.infra.exception.rule.InUsedRuleException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinder.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinder.java index e19f6edc621fd..d39862c21871d 100644 --- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinder.java +++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinder.java @@ -28,7 +28,7 @@ import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; import org.apache.shardingsphere.infra.database.opengauss.type.OpenGaussDatabaseType; import org.apache.shardingsphere.infra.database.postgresql.type.PostgreSQLDatabaseType; -import org.apache.shardingsphere.infra.exception.TableNotExistsException; +import org.apache.shardingsphere.infra.exception.TableNotFoundException; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException; import org.apache.shardingsphere.infra.metadata.database.schema.manager.SystemSchemaManager; @@ -148,6 +148,6 @@ private static void checkTableExists(final String tableName, final SQLStatementB ShardingSpherePreconditions.checkState(statementBinderContext.getMetaData().containsDatabase(databaseName) && statementBinderContext.getMetaData().getDatabase(databaseName).containsSchema(schemaName) && statementBinderContext.getMetaData().getDatabase(databaseName).getSchema(schemaName).containsTable(tableName), - () -> new TableNotExistsException(tableName)); + () -> new TableNotFoundException(tableName)); } } diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinderTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinderTest.java index 25f6a270ff991..ca07fdd35bd46 100644 --- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinderTest.java +++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/from/impl/SimpleTableSegmentBinderTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.binder.statement.SQLStatementBinderContext; import org.apache.shardingsphere.infra.database.core.DefaultDatabase; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.exception.TableNotExistsException; +import org.apache.shardingsphere.infra.exception.TableNotFoundException; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -145,7 +145,7 @@ void assertBindTableNotExists() { SimpleTableSegment simpleTableSegment = new SimpleTableSegment(new TableNameSegment(0, 10, new IdentifierValue("t_not_exists"))); ShardingSphereMetaData metaData = createMetaData(); Map tableBinderContexts = new LinkedHashMap<>(); - assertThrows(TableNotExistsException.class, + assertThrows(TableNotFoundException.class, () -> SimpleTableSegmentBinder.bind(simpleTableSegment, new SQLStatementBinderContext(metaData, DefaultDatabase.LOGIC_NAME, databaseType, Collections.emptySet()), tableBinderContexts)); } diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java index 0936a7cd4524d..f7ecfaed86b3f 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotExistsException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotFoundException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotExistsException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotFoundException.java index 28141de15fb5e..1bb9df619510d 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotExistsException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/TableNotFoundException.java @@ -21,13 +21,13 @@ import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException; /** - * Table not exists exception. + * Table not found exception. */ -public final class TableNotExistsException extends MetaDataSQLException { +public final class TableNotFoundException extends MetaDataSQLException { private static final long serialVersionUID = -2507596759730534895L; - public TableNotExistsException(final String tableName) { + public TableNotFoundException(final String tableName) { super(XOpenSQLState.NOT_FOUND, 7, "Table or view `%s` does not exist.", tableName); } } diff --git a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ResourceDefinitionException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/ResourceDefinitionException.java similarity index 91% rename from infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ResourceDefinitionException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/ResourceDefinitionException.java index 66b6fc6d89dc9..948e44571359c 100644 --- a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/ResourceDefinitionException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/ResourceDefinitionException.java @@ -15,10 +15,11 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category; +package org.apache.shardingsphere.infra.exception.resource; import com.google.common.base.Preconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState; +import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException; /** * Resource definition exception. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/AlterStorageUnitConnectionInfoException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/AlterStorageUnitConnectionInfoException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/AlterStorageUnitConnectionInfoException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/AlterStorageUnitConnectionInfoException.java index 4414abe82690a..e3c95ed11887b 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/AlterStorageUnitConnectionInfoException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/AlterStorageUnitConnectionInfoException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import java.util.Collection; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/DuplicateStorageUnitException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/DuplicateStorageUnitException.java index 66e10013bf7aa..bda0bfda82941 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/DuplicateStorageUnitException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/DuplicateStorageUnitException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import java.util.Collection; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/EmptyStorageUnitException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/EmptyStorageUnitException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/EmptyStorageUnitException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/EmptyStorageUnitException.java index d45334531bbb8..2c59a6b5285b5 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/EmptyStorageUnitException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/EmptyStorageUnitException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; /** * Empty storage unit exception. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InUsedStorageUnitException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InUsedStorageUnitException.java similarity index 89% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InUsedStorageUnitException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InUsedStorageUnitException.java index 1d81beae5c3c8..95fbcf34ee8d2 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InUsedStorageUnitException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InUsedStorageUnitException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import java.util.Collection; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InvalidStorageUnitStatusException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InvalidStorageUnitStatusException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InvalidStorageUnitStatusException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InvalidStorageUnitStatusException.java index db18b32775db6..0fc3b24252619 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/InvalidStorageUnitStatusException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/InvalidStorageUnitStatusException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; /** * Invalid storage unit status exception. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/MissingRequiredStorageUnitsException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/MissingRequiredStorageUnitsException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/MissingRequiredStorageUnitsException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/MissingRequiredStorageUnitsException.java index cf8afec77d356..8c53c61a5e6bf 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/MissingRequiredStorageUnitsException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/MissingRequiredStorageUnitsException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import java.util.Collection; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsConnectException.java similarity index 89% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsConnectException.java index 72e851f551f02..3b9b70dfafe16 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsConnectException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsConnectException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import java.util.Map; import java.util.stream.Collectors; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsOperateException.java similarity index 88% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsOperateException.java index de7550fcea95a..72e42516c84d9 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/storageunit/StorageUnitsOperateException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/resource/storageunit/StorageUnitsOperateException.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.storageunit; +package org.apache.shardingsphere.infra.exception.resource.storageunit; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ResourceDefinitionException; +import org.apache.shardingsphere.infra.exception.resource.ResourceDefinitionException; import java.util.Collection; 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 eb2211441e06d..3e55d551cda03 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 @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.exception.rule; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; import java.util.Collection; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/EmptyRuleException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/EmptyRuleException.java index 1b4a9b54c7d21..bf2379600c95e 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/EmptyRuleException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/EmptyRuleException.java @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.exception.rule; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; /** * Empty rule unit exception. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InUsedRuleException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InUsedRuleException.java index 8862e2a10ca06..8b019c2715c1c 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InUsedRuleException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/InUsedRuleException.java @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.exception.rule; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; import java.util.Collection; 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 a964b47007c72..6569719bd6002 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 @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.exception.rule; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; import java.util.Collection; 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 bda267b509417..2c4b00761b814 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 @@ -18,7 +18,6 @@ package org.apache.shardingsphere.infra.exception.rule; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException; import java.util.Collection; diff --git a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleDefinitionException.java similarity index 90% rename from infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleDefinitionException.java index 3c9971717014b..8354ef615d598 100644 --- a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/RuleDefinitionException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/rule/RuleDefinitionException.java @@ -15,10 +15,11 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category; +package org.apache.shardingsphere.infra.exception.rule; import com.google.common.base.Preconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState; +import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException; /** * Rule definition exception. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/exception/UnsupportedActualDataNodeStructureException.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/exception/UnsupportedActualDataNodeStructureException.java index 2f2b73e7f67b5..4ab2cb3eb9529 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/exception/UnsupportedActualDataNodeStructureException.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/exception/UnsupportedActualDataNodeStructureException.java @@ -31,6 +31,6 @@ public final class UnsupportedActualDataNodeStructureException extends MetaDataS private static final long serialVersionUID = -8921823916974492519L; public UnsupportedActualDataNodeStructureException(final DataNode dataNode, final Collection jdbcUrlPrefixes) { - super(XOpenSQLState.SYNTAX_ERROR, 2, "Can not support 3-tier structure for actual data node `%s` with JDBC `%s`.", dataNode.format(), jdbcUrlPrefixes.toString()); + super(XOpenSQLState.FEATURE_NOT_SUPPORTED, 2, "Can not support 3-tier structure for actual data node `%s` with JDBC `%s`.", dataNode.format(), jdbcUrlPrefixes.toString()); } } diff --git a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/StandardJdbcUrlParser.java b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/StandardJdbcUrlParser.java index b675cb6205d8d..e8a39a24d5c28 100644 --- a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/StandardJdbcUrlParser.java +++ b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/StandardJdbcUrlParser.java @@ -51,7 +51,6 @@ public final class StandardJdbcUrlParser { * * @param jdbcUrl JDBC URL to be parsed * @return parsed JDBC URL - * @throws UnrecognizedDatabaseURLException unrecognized database URL exception */ public JdbcUrl parse(final String jdbcUrl) { Matcher matcher = CONNECTION_URL_PATTERN.matcher(jdbcUrl); diff --git a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/UnrecognizedDatabaseURLException.java b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/UnrecognizedDatabaseURLException.java index 0f4372ca3d218..4da62e781227a 100644 --- a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/UnrecognizedDatabaseURLException.java +++ b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/connector/url/UnrecognizedDatabaseURLException.java @@ -18,16 +18,16 @@ package org.apache.shardingsphere.infra.database.core.connector.url; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException; +import org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.ConnectionSQLException; /** * Unrecognized database URL exception. */ -public final class UnrecognizedDatabaseURLException extends MetaDataSQLException { +public final class UnrecognizedDatabaseURLException extends ConnectionSQLException { private static final long serialVersionUID = -1551117178863766353L; public UnrecognizedDatabaseURLException(final String url, final String pattern) { - super(XOpenSQLState.CONNECTION_EXCEPTION, 1, "The URL `%s` is not recognized, please refer to the pattern `%s`.", url, pattern); + super(XOpenSQLState.CONNECTION_EXCEPTION, 3, "The URL `%s` is not recognized, please refer to the pattern `%s`.", url, pattern); } } diff --git a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/type/UnsupportedStorageTypeException.java b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/type/UnsupportedStorageTypeException.java index 0483b36774675..09da5a7475a9e 100644 --- a/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/type/UnsupportedStorageTypeException.java +++ b/infra/database/core/src/main/java/org/apache/shardingsphere/infra/database/core/type/UnsupportedStorageTypeException.java @@ -52,8 +52,6 @@ public final class UnsupportedStorageTypeException extends ConnectionSQLExceptio private static final long serialVersionUID = 8981789100727786183L; public UnsupportedStorageTypeException(final String url) { - super(XOpenSQLState.FEATURE_NOT_SUPPORTED, 40, - "Unsupported storage type of URL `%s`. Add corresponding SPI implementation of `%s` to enable handling. Through reference SQL State: %s. Through reference Vendor Code: %s.", - url, DatabaseType.class.getName(), XOpenSQLState.FEATURE_NOT_SUPPORTED.getValue(), 40); + super(XOpenSQLState.FEATURE_NOT_SUPPORTED, 2, "Unsupported storage type of URL '%s'.", url); } } diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutor.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutor.java index ec7d7650b25da..419583614286c 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutor.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutor.java @@ -33,10 +33,10 @@ import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.ShardingSphereExternalException; -import org.apache.shardingsphere.infra.exception.storageunit.AlterStorageUnitConnectionInfoException; -import org.apache.shardingsphere.infra.exception.storageunit.DuplicateStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.StorageUnitsOperateException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.AlterStorageUnitConnectionInfoException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.DuplicateStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.StorageUnitsOperateException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.mode.manager.ContextManager; diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutor.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutor.java index 09b8d65beceea..3a3d7234cf3e2 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutor.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutor.java @@ -28,8 +28,8 @@ import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.ShardingSphereExternalException; -import org.apache.shardingsphere.infra.exception.storageunit.DuplicateStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.StorageUnitsOperateException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.DuplicateStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.StorageUnitsOperateException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; import org.apache.shardingsphere.mode.manager.ContextManager; diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutor.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutor.java index ffbab47a0e797..f91e24c990b6d 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutor.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutor.java @@ -25,9 +25,9 @@ import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.UnregisterStorageUnitStatement; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.server.ShardingSphereServerException; -import org.apache.shardingsphere.infra.exception.storageunit.InUsedStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; -import org.apache.shardingsphere.infra.exception.storageunit.StorageUnitsOperateException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.InUsedStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.StorageUnitsOperateException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DistSQLDataSourcePoolPropertiesValidator.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DistSQLDataSourcePoolPropertiesValidator.java index 187f3238aa7a7..a9b79da5c3ecf 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DistSQLDataSourcePoolPropertiesValidator.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DistSQLDataSourcePoolPropertiesValidator.java @@ -20,7 +20,7 @@ import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.datasource.pool.props.validator.DataSourcePoolPropertiesValidator; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; -import org.apache.shardingsphere.infra.exception.storageunit.StorageUnitsConnectException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.StorageUnitsConnectException; import java.util.Map; diff --git a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutorTest.java b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutorTest.java index 7bc32bc10c7d4..9359e215f7de1 100644 --- a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutorTest.java +++ b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/AlterStorageUnitExecutorTest.java @@ -22,9 +22,9 @@ import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment; import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.AlterStorageUnitStatement; import org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties; -import org.apache.shardingsphere.infra.exception.storageunit.AlterStorageUnitConnectionInfoException; -import org.apache.shardingsphere.infra.exception.storageunit.DuplicateStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.AlterStorageUnitConnectionInfoException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.DuplicateStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; diff --git a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutorTest.java b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutorTest.java index e0900a347b419..2943087c1da54 100644 --- a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutorTest.java +++ b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/RegisterStorageUnitExecutorTest.java @@ -21,7 +21,7 @@ import org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment; import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment; import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.RegisterStorageUnitStatement; -import org.apache.shardingsphere.infra.exception.storageunit.DuplicateStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.DuplicateStorageUnitException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; diff --git a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java index 0f98b2a5d54b5..fa0c63086fed1 100644 --- a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java +++ b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java @@ -20,8 +20,8 @@ import org.apache.shardingsphere.distsql.handler.fixture.DistSQLHandlerFixtureRule; import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.UnregisterStorageUnitStatement; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; -import org.apache.shardingsphere.infra.exception.storageunit.InUsedStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.InUsedStorageUnitException; import org.apache.shardingsphere.infra.instance.mode.ModeContextManager; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode; diff --git a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java index ff81e45f0199a..ba40deffcf6c7 100644 --- a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java +++ b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader; import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; import org.apache.shardingsphere.infra.exception.SchemaNotFoundException; -import org.apache.shardingsphere.infra.exception.TableNotExistsException; +import org.apache.shardingsphere.infra.exception.TableNotFoundException; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; @@ -69,7 +69,7 @@ public static Map> parseTableExpressionWithSchema(final Shar if (dialectDatabaseMetaData.getDefaultSchema().isPresent() && schemaName.isEmpty()) { schemaName = dialectDatabaseMetaData.getDefaultSchema().get(); } - ShardingSpherePreconditions.checkNotNull(database.getSchema(schemaName).getTable(each.getTable()), () -> new TableNotExistsException(each.getTable())); + ShardingSpherePreconditions.checkNotNull(database.getSchema(schemaName).getTable(each.getTable()), () -> new TableNotFoundException(each.getTable())); result.computeIfAbsent(schemaName, ignored -> new HashSet<>()).add(each.getTable()); } } diff --git a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutor.java b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutor.java index 3756843be9e3b..ccb00bb1df288 100644 --- a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutor.java +++ b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutor.java @@ -19,7 +19,7 @@ import lombok.Setter; import org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleCreateExecutor; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.database.DatabaseTypeEngine; import org.apache.shardingsphere.infra.database.core.metadata.database.DialectDatabaseMetaData; import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; diff --git a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutor.java b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutor.java index dd1cc2a243138..4fc04b06a2613 100644 --- a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutor.java +++ b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutor.java @@ -19,7 +19,7 @@ import com.google.common.base.Strings; import lombok.Setter; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleCreateExecutor; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java index a3faad1348acd..a848adab9b451 100644 --- a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java +++ b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.single.distsql.handler.update; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.table.TableExistsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java index d1b67f8921c4c..459c8da2f9ccc 100644 --- a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java +++ b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.single.distsql.handler.update; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration; import org.apache.shardingsphere.single.distsql.statement.rdl.SetDefaultSingleTableStorageUnitStatement; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java index 59f752acb42af..ae31b42537dea 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java @@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.SQLExceptionTransformEngine; import org.apache.shardingsphere.infra.exception.rule.EmptyRuleException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext; import org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler; import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java index 9af2df5ce1bea..716eaa868995c 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.authority.rule.AuthorityRule; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.infra.session.query.QueryContext; import org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector; import org.apache.shardingsphere.proxy.backend.connector.DatabaseConnectorFactory; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataExecutor.java index 15cdd852a505d..36570941ba2ce 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataExecutor.java @@ -19,8 +19,8 @@ import lombok.Setter; import org.apache.shardingsphere.distsql.handler.aware.DistSQLExecutorDatabaseAware; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.handler.engine.update.DistSQLUpdateExecutor; import org.apache.shardingsphere.distsql.statement.ral.updatable.RefreshTableMetaDataStatement; import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java index cea0087d57915..ad4fa2309c018 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java @@ -19,7 +19,7 @@ import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationCheckEngine; import org.apache.shardingsphere.distsql.handler.exception.datasource.MissingRequiredDataSourcesException; -import org.apache.shardingsphere.infra.exception.storageunit.StorageUnitsOperateException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.StorageUnitsOperateException; import org.apache.shardingsphere.distsql.handler.validate.DistSQLDataSourcePoolPropertiesValidator; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.database.DatabaseTypeEngine; diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdaterTest.java index d020a34018e71..0c815b085d2be 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/RefreshTableMetaDataUpdaterTest.java @@ -17,8 +17,8 @@ package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; -import org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.distsql.statement.ral.updatable.RefreshTableMetaDataStatement; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; diff --git a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UnicastResourceShowExecutor.java b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UnicastResourceShowExecutor.java index 438c6a602d138..2d85517af09fb 100644 --- a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UnicastResourceShowExecutor.java +++ b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/UnicastResourceShowExecutor.java @@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.binder.engine.SQLBindEngine; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException; -import org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException; +import org.apache.shardingsphere.infra.exception.resource.storageunit.EmptyStorageUnitException; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResultMetaData; import org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.raw.metadata.RawQueryResultColumnMetaData;