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/09/05 09:40:59 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions

strongduanmu commented on code in PR #20726:
URL: https://github.com/apache/shardingsphere/pull/20726#discussion_r962707354


##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -129,12 +135,33 @@ public ResponseHeader execute() throws SQLException {
             return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
         }
         proxySQLExecutor.checkExecutePrerequisites(executionContext);
-        List result = proxySQLExecutor.execute(executionContext);
-        refreshMetaData(executionContext);
-        Object executeResultSample = result.iterator().next();
-        return executeResultSample instanceof QueryResult
-                ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
-                : processExecuteUpdate(executionContext, result);
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        JDBCBackendTransactionManager transactionManager = null;
+        if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()

Review Comment:
   Can you exclude the scenario of routing to a single data node? At this time, using the local transaction can meet the requirements.



-- 
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