denis-chudov commented on code in PR #3511:
URL: https://github.com/apache/ignite-3/pull/3511#discussion_r1611515683


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionContext.java:
##########
@@ -45,19 +59,26 @@ public QueryTransactionContext(IgniteTransactions 
transactions, @Nullable Intern
      * @return Transaction wrapper.
      */
     public QueryTransactionWrapper getOrStartImplicit(SqlQueryType queryType) {
-        InternalTransaction outerTx = tx;
+        InternalTransaction transaction = tx;
+        boolean implicit;
 
-        if (outerTx == null) {
-            return new QueryTransactionWrapperImpl((InternalTransaction) 
transactions.begin(
-                    new TransactionOptions().readOnly(queryType != 
SqlQueryType.DML)), true);
+        if (transaction == null) {
+            implicit = true;
+            transaction = (InternalTransaction) transactions.begin(
+                    new TransactionOptions().readOnly(queryType != 
SqlQueryType.DML));
+        } else {
+            implicit = false;
+            validateStatement(queryType, transaction.isReadOnly());
         }
 
-        validateStatement(queryType, outerTx.isReadOnly());
+        // Adding inflights only for read-only transactions.

Review Comment:
   extended the comment



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/ScriptTransactionContext.java:
##########
@@ -96,7 +103,11 @@ public CompletableFuture<Void> 
handleControlStatement(SqlNode node) {
             boolean readOnly = ((IgniteSqlStartTransaction) node).getMode() == 
IgniteSqlStartTransactionMode.READ_ONLY;
             InternalTransaction tx = (InternalTransaction) 
queryTxCtx.transactions().begin(new TransactionOptions().readOnly(readOnly));
 
-            this.wrapper = new ScriptTransactionWrapperImpl(tx);
+            if (readOnly && !transactionInflights.addInflight(tx.id(), 
readOnly)) {

Review Comment:
   done



-- 
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-unsubscr...@ignite.apache.org

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

Reply via email to