korlov42 commented on code in PR #6235:
URL: https://github.com/apache/ignite-3/pull/6235#discussion_r2209533118


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSqlTest.java:
##########
@@ -376,6 +392,109 @@ void testTransactionRollbackRevertsSqlUpdate() {
         assertEquals(1, res.currentPage().iterator().next().intValue(0));
     }
 
+    @Test
+    void testExplicitTransactionKvCase() {
+        IgniteClient client = client();
+        IgniteSql sql = client.sql();
+
+        sql.execute(null, "CREATE TABLE my_table (id INT PRIMARY KEY, val 
INT)");
+
+        // First, let's fill the table and check every row in implicit tx.
+        // This should also prepare partition awareness metadata.
+        int count = 10;
+        for (int i = 0; i < count; i++) {
+            try (ResultSet<?> ignored = sql.execute(null, "INSERT INTO 
my_table VALUES (?, ?)", i, i)) {
+                // No-op.
+            }
+        }
+
+        for (int i = 0; i < count; i++) {
+            try (ResultSet<SqlRow> rs = sql.execute(null, "SELECT * FROM 
my_table WHERE id = ?", i)) {
+                assertEquals(i, rs.next().intValue(1));
+            }
+        }
+
+        // Now let's clean the table and do the same steps but within explicit 
tx.
+
+        try (ResultSet<?> ignored = sql.execute(null, "DELETE FROM my_table")) 
{
+            // No-op.
+        }
+
+        Transaction tx = client.transactions().begin();
+        for (int i = 0; i < count; i++) {
+            try (ResultSet<?> ignored = sql.execute(tx, "INSERT INTO my_table 
VALUES (?, ?)", i, i)) {
+                // No-op.
+            }
+        }
+
+        for (int i = 0; i < count; i++) {
+            try (ResultSet<SqlRow> rs = sql.execute(tx, "SELECT * FROM 
my_table WHERE id = ?", i)) {
+                assertEquals(i, rs.next().intValue(1));
+            }
+        }
+
+        // All just inserted rows should not be visible yet
+        for (int i = 0; i < count; i++) {
+            try (ResultSet<SqlRow> rs = sql.execute(null, "SELECT * FROM 
my_table WHERE id = ?", i)) {

Review Comment:
   Good catch! This looks like general problem with remote transaction since KV 
api fails as well. I filed a separate ticket for this case 
https://issues.apache.org/jira/browse/IGNITE-25921



##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlApiBaseTest.java:
##########
@@ -269,10 +270,12 @@ public void checkTransactionsWithDml() {
 
         // Outdated tx.
         Transaction outerTx0 = outerTx;
-        assertThrowsSqlException(
+        assertThrowsWithCode(
+                IgniteException.class,

Review Comment:
   doesn't look good indeed. Revered this change and introduced exception 
remapping instead



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