This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 a9ec1186fae Move backend exception into infra module (#20066)
a9ec1186fae is described below
commit a9ec1186fae5e8632b7159676934e854b92966de
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Aug 10 23:54:52 2022 +0800
Move backend exception into infra module (#20066)
* Add SQLExceptionMapper
* Refactor TableModifyInTransactionException
* Move backend exception into infra module
* Move SQLExceptionMapper to db-protocol-core module
---
.../db/protocol/error/SQLExceptionMapper.java | 25 ++++----
.../protocol/error/SQLExceptionMapperFactory.java | 30 ++++++----
.../infra}/exception/CircuitBreakException.java | 2 +-
.../infra}/exception/DBCreateExistsException.java | 2 +-
.../infra}/exception/DBDropNotExistsException.java | 2 +-
.../infra}/exception/InTransactionException.java | 2 +-
.../exception/InvalidParameterValueException.java | 2 +-
.../exception/ResourceNotExistedException.java | 2 +-
.../infra}/exception/RuleNotExistedException.java | 2 +-
.../exception/TableLockWaitTimeoutException.java | 2 +-
.../infra}/exception/TableLockedException.java | 2 +-
.../TableModifyInTransactionException.java | 10 ++--
.../communication/DatabaseCommunicationEngine.java | 2 +-
.../backend/communication/ProxySQLExecutor.java | 8 ++-
.../communication/ReactiveProxySQLExecutor.java | 8 ++-
.../TableModifyInTransactionException.java | 40 -------------
.../executor/AbstractDatabaseMetadataExecutor.java | 2 +-
.../executor/UnicastResourceShowExecutor.java | 2 +-
.../executor/PostgreSQLSetCharsetExecutor.java | 2 +-
.../data/impl/UnicastDatabaseBackendHandler.java | 2 +-
.../database/CreateDatabaseBackendHandler.java | 2 +-
.../database/DropDatabaseBackendHandler.java | 2 +-
.../executor/ShowShardingHintStatusExecutor.java | 2 +-
.../handler/distsql/rul/sql/PreviewHandler.java | 2 +-
.../transaction/TransactionBackendHandler.java | 2 +-
.../communication/ProxySQLExecutorTest.java | 2 +-
.../TableModifyInTransactionExceptionTest.java | 70 ----------------------
...QLStatementContextInstanceOfTableAvailable.java | 59 ------------------
.../DatabaseOperateBackendHandlerFactoryTest.java | 2 +-
.../database/CreateDatabaseBackendHandlerTest.java | 2 +-
.../database/DropDatabaseBackendHandlerTest.java | 2 +-
.../state/impl/CircuitBreakProxyState.java | 2 +-
.../state/impl/CircuitBreakProxyStateTest.java | 2 +-
.../frontend/mysql/err/MySQLErrPacketFactory.java | 16 ++---
.../mysql/err/MySQLErrPacketFactoryTest.java | 11 ++--
.../opengauss/OpenGaussFrontendEngine.java | 2 +-
.../opengauss/err/OpenGaussErrorPacketFactory.java | 2 +-
.../postgresql/PostgreSQLFrontendEngine.java | 2 +-
.../postgresql/err/PostgreSQLErrPacketFactory.java | 6 +-
.../cases/truncate/MySQLXATruncateTestCase.java | 2 +-
40 files changed, 96 insertions(+), 245 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
similarity index 61%
copy from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
copy to
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
index ec16a03807a..6257d5ec047 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapper.java
@@ -15,20 +15,25 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.db.protocol.error;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
+import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
+
+import java.sql.SQLException;
/**
- * DB create exists exception.
+ * SQL exception mapper.
*/
-@RequiredArgsConstructor
-@Getter
-public final class DBCreateExistsException extends
ShardingSphereInsideException {
-
- private static final long serialVersionUID = 779787160167652641L;
+@SingletonSPI
+public interface SQLExceptionMapper extends TypedSPI {
- private final String databaseName;
+ /**
+ * Convert ShardingSphere inside exception into SQLException.
+ *
+ * @param insideException ShardingSphere inside exception
+ * @return SQLException
+ */
+ SQLException convert(ShardingSphereInsideException insideException);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
similarity index 50%
copy from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
copy to
shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
index ec16a03807a..337d4573adb 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/SQLExceptionMapperFactory.java
@@ -15,20 +15,30 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.db.protocol.error;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry;
/**
- * DB create exists exception.
+ * SQL exception mapper.
*/
-@RequiredArgsConstructor
-@Getter
-public final class DBCreateExistsException extends
ShardingSphereInsideException {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class SQLExceptionMapperFactory {
- private static final long serialVersionUID = 779787160167652641L;
+ static {
+ ShardingSphereServiceLoader.register(SQLExceptionMapper.class);
+ }
- private final String databaseName;
+ /**
+ * Convert ShardingSphere inside exception into SQLException.
+ *
+ * @param databaseType database type
+ * @return SQLException
+ */
+ public static SQLExceptionMapper getInstance(final String databaseType) {
+ return TypedSPIRegistry.getRegisteredService(SQLExceptionMapper.class,
databaseType);
+ }
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/CircuitBreakException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/CircuitBreakException.java
similarity index 94%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/CircuitBreakException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/CircuitBreakException.java
index 892970eb706..01fa7f0572e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/CircuitBreakException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/CircuitBreakException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBCreateExistsException.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBCreateExistsException.java
index ec16a03807a..6ab7c713a62 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBCreateExistsException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBCreateExistsException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBDropNotExistsException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBDropNotExistsException.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBDropNotExistsException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBDropNotExistsException.java
index 648fd5ce33c..042482dc5de 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/DBDropNotExistsException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/DBDropNotExistsException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InTransactionException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InTransactionException.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InTransactionException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InTransactionException.java
index c101e53fb5d..9cffc79c51c 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InTransactionException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InTransactionException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InvalidParameterValueException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InvalidParameterValueException.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InvalidParameterValueException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InvalidParameterValueException.java
index 6193f2ab027..371ec4f34e8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/InvalidParameterValueException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/InvalidParameterValueException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/ResourceNotExistedException.java
similarity index 94%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/ResourceNotExistedException.java
index 3700c6577c9..855a8af7c12 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceNotExistedException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/ResourceNotExistedException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/RuleNotExistedException.java
similarity index 94%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/RuleNotExistedException.java
index 7311a49d936..6229b52aa92 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/RuleNotExistedException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/RuleNotExistedException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockWaitTimeoutException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockWaitTimeoutException.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockWaitTimeoutException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockWaitTimeoutException.java
index b9f34beade9..e14564face9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockWaitTimeoutException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockWaitTimeoutException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockedException.java
similarity index 95%
copy from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
copy to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockedException.java
index ab6840fa4cb..a95406b0214 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableLockedException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableModifyInTransactionException.java
similarity index 78%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableModifyInTransactionException.java
index ab6840fa4cb..511fcdc15b5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableLockedException.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/exception/TableModifyInTransactionException.java
@@ -15,22 +15,20 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.exception;
+package org.apache.shardingsphere.infra.exception;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
/**
- * Table locked exception.
+ * Table modify in transaction exception.
*/
@RequiredArgsConstructor
@Getter
-public final class TableLockedException extends ShardingSphereInsideException {
+public final class TableModifyInTransactionException extends
ShardingSphereInsideException {
- private static final long serialVersionUID = 2622020743612706932L;
-
- private final String schemaName;
+ private static final long serialVersionUID = 5676889868293244575L;
private final String tableName;
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
index c6e5bc327e1..85b592e9170 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
@@ -43,7 +43,7 @@ import
org.apache.shardingsphere.infra.metadata.database.schema.util.SystemSchem
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import
org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
import
org.apache.shardingsphere.proxy.backend.handler.data.DatabaseBackendHandler;
import org.apache.shardingsphere.proxy.backend.response.data.QueryResponseCell;
import org.apache.shardingsphere.proxy.backend.response.data.QueryResponseRow;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
index 7a2acea1035..bf4cbc1226e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.proxy.backend.communication;
+import org.apache.shardingsphere.infra.binder.type.TableAvailable;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
@@ -42,7 +43,7 @@ import
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.Proxy
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import
org.apache.shardingsphere.proxy.backend.session.transaction.TransactionStatus;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CloseStatement;
@@ -95,7 +96,10 @@ public final class ProxySQLExecutor {
public void checkExecutePrerequisites(final ExecutionContext
executionContext) {
if
(isExecuteDDLInXATransaction(executionContext.getSqlStatementContext().getSqlStatement())
||
isExecuteDDLInPostgreSQLOpenGaussTransaction(executionContext.getSqlStatementContext().getSqlStatement()))
{
- throw new
TableModifyInTransactionException(executionContext.getSqlStatementContext());
+ String tableName = executionContext.getSqlStatementContext()
instanceof TableAvailable && !((TableAvailable)
executionContext.getSqlStatementContext()).getAllTables().isEmpty()
+ ? ((TableAvailable)
executionContext.getSqlStatementContext()).getAllTables().iterator().next().getTableName().getIdentifier().getValue()
+ : "unknown_table";
+ throw new TableModifyInTransactionException(tableName);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ReactiveProxySQLExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ReactiveProxySQLExecutor.java
index 99c3dca3783..a01f4ead506 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ReactiveProxySQLExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ReactiveProxySQLExecutor.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.proxy.backend.communication;
import io.vertx.core.Future;
import io.vertx.sqlclient.SqlClient;
+import org.apache.shardingsphere.infra.binder.type.TableAvailable;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
@@ -35,7 +36,7 @@ import
org.apache.shardingsphere.proxy.backend.communication.vertx.VertxBackendS
import
org.apache.shardingsphere.proxy.backend.communication.vertx.executor.ProxyReactiveExecutor;
import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import
org.apache.shardingsphere.proxy.backend.session.transaction.TransactionStatus;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
@@ -74,7 +75,10 @@ public final class ReactiveProxySQLExecutor {
public void checkExecutePrerequisites(final ExecutionContext
executionContext) {
if
(isExecuteDDLInXATransaction(executionContext.getSqlStatementContext().getSqlStatement())
||
isExecuteDDLInPostgreSQLOpenGaussTransaction(executionContext.getSqlStatementContext().getSqlStatement()))
{
- throw new
TableModifyInTransactionException(executionContext.getSqlStatementContext());
+ String tableName = executionContext.getSqlStatementContext()
instanceof TableAvailable && !((TableAvailable)
executionContext.getSqlStatementContext()).getAllTables().isEmpty()
+ ? ((TableAvailable)
executionContext.getSqlStatementContext()).getAllTables().iterator().next().getTableName().getIdentifier().getValue()
+ : "unknown_table";
+ throw new TableModifyInTransactionException(tableName);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionException.java
deleted file mode 100644
index 0db0beff0b2..00000000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionException.java
+++ /dev/null
@@ -1,40 +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.proxy.backend.exception;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.type.TableAvailable;
-import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
-
-/**
- * Table modify in transaction exception.
- */
-@Getter
-public final class TableModifyInTransactionException extends
ShardingSphereInsideException {
-
- private static final long serialVersionUID = 5676889868293244575L;
-
- private final String tableName;
-
- public TableModifyInTransactionException(final SQLStatementContext<?>
sqlStatementContext) {
- tableName = sqlStatementContext instanceof TableAvailable &&
!((TableAvailable) sqlStatementContext).getAllTables().isEmpty()
- ? ((TableAvailable)
sqlStatementContext).getAllTables().iterator().next().getTableName().getIdentifier().getValue()
- : "unknown_table";
- }
-}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetadataExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetadataExecutor.java
index a475da55db7..5217ffa2134 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetadataExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/executor/AbstractDatabaseMetadataExecutor.java
@@ -32,7 +32,7 @@ import
org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphere
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.ResourceNotExistedException;
+import org.apache.shardingsphere.infra.exception.ResourceNotExistedException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.proxy.backend.handler.admin.FunctionWithException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/mysql/executor/UnicastResourceShowExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/mysql/executor/UnicastResourceShowExecutor.java
index 425c92f285a..acff8eaff71 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/mysql/executor/UnicastResourceShowExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/mysql/executor/UnicastResourceShowExecutor.java
@@ -34,7 +34,7 @@ import
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicati
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.query.QueryHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java
index 8ba31a8bc44..15c9510ef1e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/admin/postgresql/executor/PostgreSQLSetCharsetExecutor.java
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.proxy.backend.handler.admin.postgresql.executor;
import org.apache.shardingsphere.db.protocol.CommonConstants;
-import
org.apache.shardingsphere.proxy.backend.exception.InvalidParameterValueException;
+import
org.apache.shardingsphere.infra.exception.InvalidParameterValueException;
import
org.apache.shardingsphere.proxy.backend.handler.admin.postgresql.PostgreSQLCharacterSets;
import
org.apache.shardingsphere.proxy.backend.handler.admin.postgresql.PostgreSQLSessionVariableHandler;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java
index 74ddd76ed72..38e91df3bbe 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/impl/UnicastDatabaseBackendHandler.java
@@ -24,7 +24,7 @@ import
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicati
import
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngineFactory;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
import org.apache.shardingsphere.proxy.backend.response.data.QueryResponseRow;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandler.java
index a2e967c1f9b..da0bd7c9d7a 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandler.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.database;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandler.java
index dd0a359571b..246ae19acc9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandler.java
@@ -24,7 +24,7 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException;
+import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
import org.apache.shardingsphere.infra.exception.UnknownDatabaseException;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/executor/ShowShardingHintStatusExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/executor/ShowShardingHintStatusExecutor.java
index e516891e223..e663f814a1f 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/executor/ShowShardingHintStatusExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/hint/executor/ShowShardingHintStatusExecutor.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataMergedRe
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
import
org.apache.shardingsphere.proxy.backend.response.header.query.QueryHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.enums.HintShardingType;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewHandler.java
index 94fff75fb5b..aab753b9b72 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/sql/PreviewHandler.java
@@ -64,7 +64,7 @@ import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDB
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.rul.SQLRULBackendHandler;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
index 7617facfb15..0d8db501251 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionBackendHandler.java
@@ -21,7 +21,7 @@ import io.vertx.core.Future;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import
org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
-import
org.apache.shardingsphere.proxy.backend.exception.InTransactionException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
import
org.apache.shardingsphere.proxy.backend.communication.TransactionManager;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.transaction.JDBCBackendTransactionManager;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorTest.java
index 1477f12c9c5..d729b19e6fe 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorTest.java
@@ -36,7 +36,7 @@ import
org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionExceptionTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionExceptionTest.java
deleted file mode 100644
index 72e5db0dc04..00000000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/TableModifyInTransactionExceptionTest.java
+++ /dev/null
@@ -1,70 +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.proxy.backend.exception;
-
-import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
-import
org.apache.shardingsphere.proxy.backend.exception.fixture.TestSQLStatementContextInstanceOfTableAvailable;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
-import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
-import org.junit.Test;
-
-import java.util.Collections;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class TableModifyInTransactionExceptionTest {
-
- @Test
- public void
assertTableNameWhenSQLStatementContextInstanceOfSQLStatementContextUnImplementsTableAvailable()
{
- SQLStatementContext sqlStatementContext =
mock(SQLStatementContext.class);
- TableModifyInTransactionException tableModifyInTransactionException =
new TableModifyInTransactionException(sqlStatementContext);
- assertThat(tableModifyInTransactionException.getTableName(),
is("unknown_table"));
- }
-
- @Test
- public void
assertTableNameWhenSQLStatementContextInstanceOfSQLStatementContextImplementsTableAvailable()
{
- SQLStatementContext sqlStatementContext =
mock(TestSQLStatementContextInstanceOfTableAvailable.class);
- TableModifyInTransactionException tableModifyInTransactionException =
new TableModifyInTransactionException(sqlStatementContext);
- assertThat(tableModifyInTransactionException.getTableName(),
is("unknown_table"));
- }
-
- @Test
- public void
assertTableNameWhenSQLStatementContextInstanceOfSQLStatementContextImplementsTableAvailableOnEmptyTableList()
{
- TestSQLStatementContextInstanceOfTableAvailable sqlStatementContext =
mock(TestSQLStatementContextInstanceOfTableAvailable.class);
-
when(sqlStatementContext.getAllTables()).thenReturn(Collections.emptyList());
- TableModifyInTransactionException tableModifyInTransactionException =
new TableModifyInTransactionException(sqlStatementContext);
- assertThat(tableModifyInTransactionException.getTableName(),
is("unknown_table"));
- }
-
- @Test
- public void
assertTableNameWhenSQLStatementContextInstanceOfSQLStatementContextImplementsTableAvailableOnAnyTableList()
{
- TestSQLStatementContextInstanceOfTableAvailable sqlStatementContext =
mock(TestSQLStatementContextInstanceOfTableAvailable.class);
- SimpleTableSegment simpleTableSegment = mock(SimpleTableSegment.class);
- IdentifierValue identifierValue = mock(IdentifierValue.class);
- when(identifierValue.getValue()).thenReturn("identifierValue");
- TableNameSegment tableNameSegment = new TableNameSegment(0, 1,
identifierValue);
- when(simpleTableSegment.getTableName()).thenReturn(tableNameSegment);
-
when(sqlStatementContext.getAllTables()).thenReturn(Collections.singleton(simpleTableSegment));
- TableModifyInTransactionException tableModifyInTransactionException =
new TableModifyInTransactionException(sqlStatementContext);
- assertThat(tableModifyInTransactionException.getTableName(),
is("identifierValue"));
- }
-}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/fixture/TestSQLStatementContextInstanceOfTableAvailable.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/fixture/TestSQLStatementContextInstanceOfTableAvailable.java
deleted file mode 100644
index 1a9f0d24d90..00000000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/exception/fixture/TestSQLStatementContextInstanceOfTableAvailable.java
+++ /dev/null
@@ -1,59 +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.proxy.backend.exception.fixture;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.binder.segment.table.TablesContext;
-import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.type.TableAvailable;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
-import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
-
-import java.util.Collection;
-
-@RequiredArgsConstructor
-public final class TestSQLStatementContextInstanceOfTableAvailable implements
SQLStatementContext<SQLStatement>, TableAvailable {
-
- private final SQLStatement sqlStatement;
-
- private final Collection<SimpleTableSegment> allTables;
-
- private final TablesContext tablesContext;
-
- @Override
- public SQLStatement getSqlStatement() {
- return sqlStatement;
- }
-
- @Override
- public TablesContext getTablesContext() {
- return tablesContext;
- }
-
- @Override
- public DatabaseType getDatabaseType() {
- return DatabaseTypeEngine.getDatabaseType("MySQL");
- }
-
- @Override
- public Collection<SimpleTableSegment> getAllTables() {
- return allTables;
- }
-}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
index 7e81308132d..425edb78b6e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/admin/DatabaseOperateBackendHandlerFactoryTest.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
import
org.apache.shardingsphere.proxy.backend.handler.database.DatabaseOperateBackendHandlerFactory;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandlerTest.java
index a72eca8cc08..acddecf8d95 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/CreateDatabaseBackendHandlerTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateDatabaseStatement;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandlerTest.java
index d223b66ac84..20aa45f148a 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/database/DropDatabaseBackendHandlerTest.java
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException;
+import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyState.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyState.java
index 5c6acf8ae4f..5cb2c5cac21 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyState.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyState.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.frontend.state.impl;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException;
+import org.apache.shardingsphere.infra.exception.CircuitBreakException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.apache.shardingsphere.proxy.frontend.state.ProxyState;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyStateTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyStateTest.java
index 1485f8c4859..202b928e66e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyStateTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/CircuitBreakProxyStateTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.frontend.state.impl;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
-import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException;
+import org.apache.shardingsphere.infra.exception.CircuitBreakException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.junit.Test;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
index 4770135e2d0..cf7fc30f067 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
@@ -28,14 +28,14 @@ import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurat
import
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
import org.apache.shardingsphere.infra.exception.UnknownDatabaseException;
-import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
-import
org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException;
-import
org.apache.shardingsphere.proxy.backend.exception.ResourceNotExistedException;
-import
org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
-import
org.apache.shardingsphere.proxy.backend.exception.TableLockWaitTimeoutException;
-import org.apache.shardingsphere.proxy.backend.exception.TableLockedException;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
+import org.apache.shardingsphere.infra.exception.CircuitBreakException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
+import org.apache.shardingsphere.infra.exception.ResourceNotExistedException;
+import org.apache.shardingsphere.infra.exception.RuleNotExistedException;
+import org.apache.shardingsphere.infra.exception.TableLockWaitTimeoutException;
+import org.apache.shardingsphere.infra.exception.TableLockedException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLErrorCode;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLException;
import
org.apache.shardingsphere.proxy.frontend.exception.FrontendTooManyConnectionsException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
index f5c3ca813f0..0fe3028e855 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
@@ -18,15 +18,14 @@
package org.apache.shardingsphere.proxy.frontend.mysql.err;
import
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
-import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
import
org.apache.shardingsphere.infra.distsql.exception.rule.RuleDefinitionViolationException;
-import org.apache.shardingsphere.proxy.backend.exception.CircuitBreakException;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
-import
org.apache.shardingsphere.proxy.backend.exception.DBDropNotExistsException;
import org.apache.shardingsphere.infra.exception.NoDatabaseSelectedException;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
import org.apache.shardingsphere.infra.exception.UnknownDatabaseException;
+import org.apache.shardingsphere.infra.exception.CircuitBreakException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.DBDropNotExistsException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.UnsupportedVariableException;
import
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedCommandException;
import
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException;
@@ -84,7 +83,7 @@ public final class MySQLErrPacketFactoryTest {
@Test
public void assertNewInstanceWithTableModifyInTransactionException() {
- MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
TableModifyInTransactionException(mock(SQLStatementContext.class)));
+ MySQLErrPacket actual = MySQLErrPacketFactory.newInstance(new
TableModifyInTransactionException("unknown_table"));
assertThat(actual.getSequenceId(), is(1));
assertThat(actual.getErrorCode(), is(3176));
assertThat(actual.getSqlState(), is("HY000"));
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
index d6a527421c8..91b83089930 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import
org.apache.shardingsphere.db.protocol.opengauss.codec.OpenGaussPacketCodecEngine;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLServerInfo;
-import
org.apache.shardingsphere.proxy.backend.exception.InTransactionException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
import
org.apache.shardingsphere.proxy.frontend.opengauss.authentication.OpenGaussAuthenticationEngine;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
index 2e18ce693cd..85be266fd86 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/err/OpenGaussErrorPacketFactory.java
@@ -24,7 +24,7 @@ import lombok.SneakyThrows;
import
org.apache.shardingsphere.db.protocol.opengauss.packet.command.generic.OpenGaussErrorResponsePacket;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
-import
org.apache.shardingsphere.proxy.backend.exception.InTransactionException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.InvalidAuthorizationSpecificationException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLAuthenticationException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLProtocolViolationException;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
index 2c35027b352..1fcfe460461 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
import
org.apache.shardingsphere.db.protocol.postgresql.codec.PostgreSQLPacketCodecEngine;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLServerInfo;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.PostgreSQLPacket;
-import
org.apache.shardingsphere.proxy.backend.exception.InTransactionException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
index ca92e5e0505..debc37c126d 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrPacketFactory.java
@@ -24,12 +24,12 @@ import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLError
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLMessageSeverityLevel;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.generic.PostgreSQLErrorResponsePacket;
import
org.apache.shardingsphere.infra.exception.InsertColumnsAndValuesMismatchedException;
-import
org.apache.shardingsphere.proxy.backend.exception.DBCreateExistsException;
-import
org.apache.shardingsphere.proxy.backend.exception.InTransactionException;
+import org.apache.shardingsphere.infra.exception.DBCreateExistsException;
+import org.apache.shardingsphere.infra.exception.InTransactionException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.InvalidAuthorizationSpecificationException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLAuthenticationException;
import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.exception.PostgreSQLProtocolViolationException;
-import
org.apache.shardingsphere.proxy.backend.exception.InvalidParameterValueException;
+import
org.apache.shardingsphere.infra.exception.InvalidParameterValueException;
import org.postgresql.util.PSQLException;
import org.postgresql.util.ServerErrorMessage;
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
index a0a00dbe218..310f868007c 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.integration.transaction.cases.base.BaseTransact
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
import
org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
-import
org.apache.shardingsphere.proxy.backend.exception.TableModifyInTransactionException;
+import
org.apache.shardingsphere.infra.exception.TableModifyInTransactionException;
import org.apache.shardingsphere.transaction.core.TransactionType;
import javax.sql.DataSource;