You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2023/01/19 11:33:12 UTC

[GitHub] [ignite-3] ygerzhedovich commented on a diff in pull request #1537: IGNITE-18227 Refactor scan nodes and add support RO index scans

ygerzhedovich commented on code in PR #1537:
URL: https://github.com/apache/ignite-3/pull/1537#discussion_r1081138614


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java:
##########
@@ -343,37 +346,59 @@ public void checkTransactionsWithDml() throws Exception {
         assertEquals(txManagerInternal.finished(), states.size());
     }
 
-    /** Check correctness of rw and ro transactions. */
+    /** Check correctness of rw and ro transactions for table scan. */
     @Test
-    public void checkMixedTransactions() throws Exception {
+    public void checkMixedTransactionsForTable() throws Exception {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+
+        Matcher<String> planMatcher = containsTableScan("PUBLIC", "TEST");
+
+        checkMixedTransactions(planMatcher);
+    }
+
+
+    /** Check correctness of rw and ro transactions for index scan. */
+    @Test
+    public void checkMixedTransactionsForIndex() throws Exception {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+        sql("CREATE INDEX TEST_IDX ON TEST(VAL0)");
+
+        Matcher<String> planMatcher = containsIndexScan("PUBLIC", "TEST", "TEST_IDX");
+
+        checkMixedTransactions(planMatcher);
+    }
+
+    private void checkMixedTransactions(Matcher<String> planMatcher) throws Exception {
         IgniteSql sql = igniteSql();
 
         if (sql instanceof ClientSql) {
             return;
         }
 
-        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
-
         Session ses = sql.createSession();
 
         for (int i = 0; i < ROW_COUNT; ++i) {
             sql("INSERT INTO TEST VALUES (?, ?)", i, i);
         }
 
-        checkTx(ses, true, false, true);
-        checkTx(ses, true, false, false);
-        checkTx(ses, true, true, true);
-        checkTx(ses, true, true, false);
-        checkTx(ses, false, true, true);
-        checkTx(ses, false, true, false);
-        checkTx(ses, false, false, true);
-        checkTx(ses, false, false, false);
+        checkTx(ses, true, false, true, planMatcher);
+        checkTx(ses, true, false, false, planMatcher);
+        checkTx(ses, true, true, true, planMatcher);
+        checkTx(ses, true, true, false, planMatcher);
+        checkTx(ses, false, true, true, planMatcher);
+        checkTx(ses, false, true, false, planMatcher);
+        checkTx(ses, false, false, true, planMatcher);
+        checkTx(ses, false, false, false, planMatcher);

Review Comment:
   ```suggestion
           for (int roTx = 0; roTx < 2; roTx++) {
               for (int commit = 0; commit < 2; commit++) {
                   for (int explicit = 0; explicit < 2; explicit++) {
                       checkTx(ses, roTx == 0, commit == 0, explicit == 0, planMatcher);
                   }
               }
           }
   ```



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

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