You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/09 04:04:45 UTC

[GitHub] [shardingsphere] FlyingZC opened a new pull request, #22029: Automatically start a xa transaction if needed(#20234)

FlyingZC opened a new pull request, #22029:
URL: https://github.com/apache/shardingsphere/pull/22029

   Fixes #20234.
   
   Changes proposed in this pull request:
     - Automatically start a xa transaction if needed
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `mvn clean install -B -T2C -DskipTests -Dmaven.javadoc.skip=true -e`.
   - [x] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu merged pull request #22029: Automatically start a distributed transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019850173


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);

Review Comment:
   Refer to mysql document——https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html, implicit commit should be a proper noun.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1017430343


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorWrapper.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.communication;
+
+import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
+import org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult;
+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.communication.jdbc.transaction.JDBCBackendTransactionManager;
+
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * Proxy SQL executor wrapper.
+ */
+public final class ProxySQLExecutorWrapper implements IProxySQLExecutor {

Review Comment:
   Why not just add these logics into `ProxySQLExecutor`? There are already some transaction logics in `ProxySQLExecutor`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019230861


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);
+    }
+    
+    private boolean needAutoTransaction(final ExecutionContext executionContext) {
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        return TransactionType.XA == transactionStatus.getTransactionType() && !transactionStatus.isInTransaction() && sqlStatement instanceof DMLStatement
+                && !(sqlStatement instanceof SelectStatement) && executionContext.getExecutionUnits().size() > 1;
+    }
+    
+    private List<ExecuteResult> doExecuteWithinTransaction(final ExecutionContext executionContext) throws SQLException {
+        List<ExecuteResult> result;
+        JDBCBackendTransactionManager transactionManager = new JDBCBackendTransactionManager(backendConnection);

Review Comment:
   Is it possible to avoid creating the JDBCBackendTransactionManager object every time?



##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);
+    }
+    
+    private boolean needAutoTransaction(final ExecutionContext executionContext) {
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        return TransactionType.XA == transactionStatus.getTransactionType() && !transactionStatus.isInTransaction() && sqlStatement instanceof DMLStatement

Review Comment:
   Do we need to add base transaction here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1020674440


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);

Review Comment:
   `implicit commit` is a proper noun.I will rename methods to` isNeedImplicitCommitTransaction` and `doExecuteWithImplicitCommitTransaction`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019780403


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -127,6 +125,7 @@ public ResponseHeader execute() throws SQLException {
         if (executionContext.getExecutionUnits().isEmpty()) {
             return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
         }
+        IProxySQLExecutor proxySQLExecutor = ProxySQLExecutorFactory.newInstance(executionContext, this);

Review Comment:
   I will Implement this function in the next pr.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019849288


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);

Review Comment:
   Please rename needAutoTransaction to `isNeedImplictCommit` and rename doExecuteWithinTransaction to `doExecuteWithImplictCommit`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019774571


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);
+    }
+    
+    private boolean needAutoTransaction(final ExecutionContext executionContext) {
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        return TransactionType.XA == transactionStatus.getTransactionType() && !transactionStatus.isInTransaction() && sqlStatement instanceof DMLStatement

Review Comment:
   Yes, BASE transaction also supports this feature.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019775675


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);
+    }
+    
+    private boolean needAutoTransaction(final ExecutionContext executionContext) {
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        return TransactionType.XA == transactionStatus.getTransactionType() && !transactionStatus.isInTransaction() && sqlStatement instanceof DMLStatement
+                && !(sqlStatement instanceof SelectStatement) && executionContext.getExecutionUnits().size() > 1;
+    }
+    
+    private List<ExecuteResult> doExecuteWithinTransaction(final ExecutionContext executionContext) throws SQLException {
+        List<ExecuteResult> result;
+        JDBCBackendTransactionManager transactionManager = new JDBCBackendTransactionManager(backendConnection);

Review Comment:
   The `JDBCBackendTransactionManager` just only holds the `ShardingSphereTransactionManagerEngine` object, which has been created in the rule in advance.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1018980457


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -73,19 +75,12 @@ public final class ProxySQLExecutor {
     
     private final JDBCBackendConnection backendConnection;
     
-    private final ProxyJDBCExecutor jdbcExecutor;
-    
-    private final RawExecutor rawExecutor;
+    private final JDBCDatabaseCommunicationEngine databaseCommunicationEngine;
     
     public ProxySQLExecutor(final String type, final JDBCBackendConnection backendConnection, final JDBCDatabaseCommunicationEngine databaseCommunicationEngine) {

Review Comment:
   Consider simplifying this with `RequiredArgsConstructor`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1017423520


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorFactory.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.communication;
+
+import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
+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.session.transaction.TransactionStatus;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.transaction.core.TransactionType;
+
+/**
+ * Proxy SQL executor factory.
+ */
+public final class ProxySQLExecutorFactory {
+    
+    /**
+     * Create new instance of Proxy SQL executor.
+     * 
+     * @param executionContext execution context
+     * @param databaseCommunicationEngine database communication engine
+     * @return Proxy SQL executor
+     */
+    public static IProxySQLExecutor newInstance(final ExecutionContext executionContext, final JDBCDatabaseCommunicationEngine databaseCommunicationEngine) {
+        TransactionStatus transactionStatus = databaseCommunicationEngine.getBackendConnection().getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        IProxySQLExecutor proxySQLExecutor;
+        if (needAutoTransaction(executionContext, transactionStatus, sqlStatement)) {
+            proxySQLExecutor =
+                    new ProxySQLExecutorWrapper(databaseCommunicationEngine.getDriverType(), (JDBCBackendConnection) databaseCommunicationEngine.getBackendConnection(), databaseCommunicationEngine);
+        } else {
+            proxySQLExecutor =
+                    new ProxySQLExecutor(databaseCommunicationEngine.getDriverType(), (JDBCBackendConnection) databaseCommunicationEngine.getBackendConnection(), databaseCommunicationEngine);
+        }
+        return proxySQLExecutor;

Review Comment:
   Please rename proxySQLExecutor to result.



##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutorFactory.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.communication;
+
+import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
+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.session.transaction.TransactionStatus;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.transaction.core.TransactionType;
+
+/**
+ * Proxy SQL executor factory.
+ */
+public final class ProxySQLExecutorFactory {
+    
+    /**
+     * Create new instance of Proxy SQL executor.
+     * 
+     * @param executionContext execution context
+     * @param databaseCommunicationEngine database communication engine
+     * @return Proxy SQL executor
+     */
+    public static IProxySQLExecutor newInstance(final ExecutionContext executionContext, final JDBCDatabaseCommunicationEngine databaseCommunicationEngine) {
+        TransactionStatus transactionStatus = databaseCommunicationEngine.getBackendConnection().getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        IProxySQLExecutor proxySQLExecutor;
+        if (needAutoTransaction(executionContext, transactionStatus, sqlStatement)) {
+            proxySQLExecutor =

Review Comment:
   Can we cache the proxySQLExecutor to improve performance?



##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -127,6 +125,7 @@ public ResponseHeader execute() throws SQLException {
         if (executionContext.getExecutionUnits().isEmpty()) {
             return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
         }
+        IProxySQLExecutor proxySQLExecutor = ProxySQLExecutorFactory.newInstance(executionContext, this);

Review Comment:
   Can we consider jdbc adapter?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] codecov-commenter commented on pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#issuecomment-1311181838

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/22029?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22029](https://codecov.io/gh/apache/shardingsphere/pull/22029?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (35d2587) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e25c1a3e308d32cb4d889d76b5e2e850e385685a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e25c1a3) will **increase** coverage by `0.03%`.
   > The diff coverage is `6.89%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #22029      +/-   ##
   ============================================
   + Coverage     60.97%   61.00%   +0.03%     
   - Complexity     2467     2549      +82     
   ============================================
     Files          4109     4110       +1     
     Lines         57199    57292      +93     
     Branches       9690     9686       -4     
   ============================================
   + Hits          34875    34950      +75     
   - Misses        19374    19395      +21     
   + Partials       2950     2947       -3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/22029?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...shardingsphere/infra/instance/InstanceContext.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9pbnN0YW5jZS9JbnN0YW5jZUNvbnRleHQuamF2YQ==) | `35.29% <0.00%> (-4.71%)` | :arrow_down: |
   | [...atus/compute/service/ComputeNodeStatusService.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bW9kZS90eXBlL2NsdXN0ZXIvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvbW9kZS9tYW5hZ2VyL2NsdXN0ZXIvY29vcmRpbmF0b3IvcmVnaXN0cnkvc3RhdHVzL2NvbXB1dGUvc2VydmljZS9Db21wdXRlTm9kZVN0YXR1c1NlcnZpY2UuamF2YQ==) | `67.56% <ø> (+0.90%)` | :arrow_up: |
   | [...ompute/watcher/ComputeNodeStateChangedWatcher.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bW9kZS90eXBlL2NsdXN0ZXIvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvbW9kZS9tYW5hZ2VyL2NsdXN0ZXIvY29vcmRpbmF0b3IvcmVnaXN0cnkvc3RhdHVzL2NvbXB1dGUvd2F0Y2hlci9Db21wdXRlTm9kZVN0YXRlQ2hhbmdlZFdhdGNoZXIuamF2YQ==) | `12.76% <0.00%> (-0.57%)` | :arrow_down: |
   | [.../proxy/backend/communication/ProxySQLExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL1Byb3h5U1FMRXhlY3V0b3IuamF2YQ==) | `16.88% <0.00%> (-17.45%)` | :arrow_down: |
   | [...coordinator/subscriber/StateChangedSubscriber.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bW9kZS90eXBlL2NsdXN0ZXIvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvbW9kZS9tYW5hZ2VyL2NsdXN0ZXIvY29vcmRpbmF0b3Ivc3Vic2NyaWJlci9TdGF0ZUNoYW5nZWRTdWJzY3JpYmVyLmphdmE=) | `82.05% <100.00%> (+0.97%)` | :arrow_up: |
   | [...e/AlterReadwriteSplittingRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvdXBkYXRlL0FsdGVyUmVhZHdyaXRlU3BsaXR0aW5nUnVsZVN0YXRlbWVudFVwZGF0ZXIuamF2YQ==) | `10.00% <0.00%> (-54.41%)` | :arrow_down: |
   | [.../CreateReadwriteSplittingRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvdXBkYXRlL0NyZWF0ZVJlYWR3cml0ZVNwbGl0dGluZ1J1bGVTdGF0ZW1lbnRVcGRhdGVyLmphdmE=) | `70.00% <0.00%> (-22.60%)` | :arrow_down: |
   | [...te/DropReadwriteSplittingRuleStatementUpdater.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvdXBkYXRlL0Ryb3BSZWFkd3JpdGVTcGxpdHRpbmdSdWxlU3RhdGVtZW50VXBkYXRlci5qYXZh) | `85.71% <0.00%> (-1.08%)` | :arrow_down: |
   | [...eadwritesplitting/rule/ReadwriteSplittingRule.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9yZWFkd3JpdGVzcGxpdHRpbmcvcnVsZS9SZWFkd3JpdGVTcGxpdHRpbmdSdWxlLmphdmE=) | `66.66% <0.00%> (-0.41%)` | :arrow_down: |
   | [...itor/statement/impl/OracleStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3FsLXBhcnNlci9kaWFsZWN0L29yYWNsZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9vcmFjbGUvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9PcmFjbGVTdGF0ZW1lbnRTUUxWaXNpdG9yLmphdmE=) | `72.07% <0.00%> (-0.38%)` | :arrow_down: |
   | ... and [21 more](https://codecov.io/gh/apache/shardingsphere/pull/22029/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #22029: Automatically start a xa transaction if needed(#20234)

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #22029:
URL: https://github.com/apache/shardingsphere/pull/22029#discussion_r1019850783


##########
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java:
##########
@@ -143,16 +134,40 @@ private boolean isPostgreSQLOrOpenGaussStatement(final SQLStatement sqlStatement
      * @throws SQLException SQL exception
      */
     public List<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
+        return needAutoTransaction(executionContext) ? doExecuteWithinTransaction(executionContext) : doExecute(executionContext);

Review Comment:
   In addition, can we investigate whether other databases also have implicit commit behavior?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org