ptupitsyn commented on code in PR #3640:
URL: https://github.com/apache/ignite-3/pull/3640#discussion_r1576026972


##########
modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientSql.java:
##########
@@ -242,7 +243,17 @@ public <T> CompletableFuture<AsyncResultSet<T>> 
executeAsync(
         if (transaction != null) {
             try {
                 //noinspection resource
-                return 
ClientTransaction.get(transaction).channel().serviceAsync(ClientOp.SQL_EXEC, 
payloadWriter, payloadReader);
+                return ClientLazyTransaction.ensureStarted(transaction, ch, 
null)
+                        .thenCompose(tx -> 
tx.channel().serviceAsync(ClientOp.SQL_EXEC, payloadWriter, payloadReader))
+                        .exceptionally(e -> {
+                            Throwable ex = unwrapCause(e);
+                            if (ex instanceof TransactionException) {
+                                var te = (TransactionException) ex;
+                                throw new SqlException(te.traceId(), 
te.code(), te.getMessage(), te);

Review Comment:
   This was added specifically to match the embedded behavior and fix 
`ItSqlApiBaseTest#checkTransactionsWithDml` (this test runs against client and 
embedded APIs to ensure consistency):
   
   
https://github.com/apache/ignite-3/blob/0f9f1df95e0006edd9c0b0595a7c2082f2d5cb29/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlApiBaseTest.java#L249
   
   
   Server-side mapping:
   
   
https://github.com/apache/ignite-3/blob/ee00a7c028ef6c8c1d8cdab0169fdd36deb1c5fe/modules/sql-engine/src/main/java/org/apache/ignite/internal/lang/SqlExceptionMapperUtil.java#L61



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to