This is an automated email from the ASF dual-hosted git repository. duanzhengqiang 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 ae597f4ea4b Fix transaction E2E on MySQL. (#29113) ae597f4ea4b is described below commit ae597f4ea4b3d1cd761f56825dc0ed9d04407960 Author: Raigor <raigor.ji...@gmail.com> AuthorDate: Tue Nov 21 22:22:40 2023 +0800 Fix transaction E2E on MySQL. (#29113) --- .../cases/deadlock/TransactionDeadlockTestCase.java | 2 +- .../ReadwriteSplittingInTransactionTestCase.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/deadlock/TransactionDeadlockTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/deadlock/TransactionDeadlockTestCase.java index d971d31c335..130fcf0d9b6 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/deadlock/TransactionDeadlockTestCase.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/deadlock/TransactionDeadlockTestCase.java @@ -82,7 +82,7 @@ public final class TransactionDeadlockTestCase extends BaseTransactionTestCase { // CHECKSTYLE:OFF } catch (final Exception ex) { // CHECKSTYLE:ON - assertThat(ex.getMessage(), is("com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction")); + assertThat(ex.getMessage(), is("com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction")); } } log.info("The deadlock test case execution time is: {}", System.currentTimeMillis() - startTime); diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java index d4533da6bc0..0fd43040029 100644 --- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java +++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java @@ -76,11 +76,14 @@ public final class ReadwriteSplittingInTransactionTestCase extends BaseTransacti } private String preview(final Connection connection, final String sql) throws SQLException { - ResultSet resultSet = connection.createStatement().executeQuery(String.format("PREVIEW %s;", sql)); - if (resultSet.next()) { - return resultSet.getString("data_source_name"); + try (Statement statement = connection.createStatement()) { + statement.execute(String.format("PREVIEW %s;", sql)); + ResultSet resultSet = statement.getResultSet(); + if (resultSet.next()) { + return resultSet.getString("data_source_name"); + } + return ""; } - return ""; } private void assertWriteDataSourceTableRowCount(final Connection connection, final int rowNum) throws SQLException {