This is an automated email from the ASF dual-hosted git repository.

ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new abe32a6186 IGNITE-18631 Fix flaky 
ItSqlAsynchronousApiTest#checkMixedTransactionsForIndex test (#1576)
abe32a6186 is described below

commit abe32a61869c95c5ea51d12aebfa43b7d4969c01
Author: Alexander Polovtcev <[email protected]>
AuthorDate: Wed Jan 25 15:48:12 2023 +0200

    IGNITE-18631 Fix flaky 
ItSqlAsynchronousApiTest#checkMixedTransactionsForIndex test (#1576)
---
 .../internal/sql/api/ItSqlAsynchronousApiTest.java |  3 +++
 .../sql/engine/AbstractBasicIntegrationTest.java   | 21 +++++++++++++++++
 .../internal/sql/engine/ItIndexSpoolTest.java      | 25 +-------------------
 .../internal/sql/engine/ItSecondaryIndexTest.java  | 27 +++-------------------
 .../ignite/internal/table/ItTableScanTest.java     |  9 ++------
 5 files changed, 30 insertions(+), 55 deletions(-)

diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
index 0277ddec38..83cc3e872e 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
@@ -362,6 +362,9 @@ public class ItSqlAsynchronousApiTest extends 
AbstractBasicIntegrationTest {
         sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
         sql("CREATE INDEX TEST_IDX ON TEST(VAL0)");
 
+        // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
+        waitForIndex("TEST_IDX");
+
         Matcher<String> planMatcher = containsIndexScan("PUBLIC", "TEST", 
"TEST_IDX");
 
         checkMixedTransactions(planMatcher);
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/AbstractBasicIntegrationTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/AbstractBasicIntegrationTest.java
index f868bed2aa..601724c094 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/AbstractBasicIntegrationTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/AbstractBasicIntegrationTest.java
@@ -21,6 +21,7 @@ import static java.util.stream.Collectors.toList;
 import static 
org.apache.ignite.internal.sql.engine.util.CursorUtils.getAllFromCursor;
 import static org.apache.ignite.internal.testframework.IgniteTestUtils.await;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertAll;
@@ -28,11 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.IntStream;
@@ -41,6 +44,8 @@ import org.apache.ignite.IgnitionManager;
 import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.logger.IgniteLogger;
 import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
+import 
org.apache.ignite.internal.schema.configuration.index.TableIndexConfiguration;
 import org.apache.ignite.internal.sql.engine.property.PropertiesHolder;
 import org.apache.ignite.internal.sql.engine.session.SessionId;
 import org.apache.ignite.internal.sql.engine.util.QueryChecker;
@@ -435,4 +440,20 @@ public class AbstractBasicIntegrationTest extends 
BaseIgniteAbstractTest {
                 }
         );
     }
+
+    protected static void waitForIndex(String indexName) throws 
InterruptedException {
+        // FIXME: Wait for the index to be created on all nodes,
+        //  this is a workaround for 
https://issues.apache.org/jira/browse/IGNITE-18203 to avoid missed updates to 
the index.
+        assertTrue(waitForCondition(
+                () -> CLUSTER_NODES.stream().map(node -> 
getIndexConfiguration(node, indexName)).allMatch(Objects::nonNull),
+                10_000)
+        );
+    }
+
+    private static @Nullable TableIndexConfiguration 
getIndexConfiguration(Ignite node, String indexName) {
+        return ((IgniteImpl) node).clusterConfiguration()
+                .getConfiguration(TablesConfiguration.KEY)
+                .indexes()
+                .get(indexName.toUpperCase());
+    }
 }
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIndexSpoolTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIndexSpoolTest.java
index e9d0766518..567100b54d 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIndexSpoolTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIndexSpoolTest.java
@@ -18,22 +18,14 @@
 package org.apache.ignite.internal.sql.engine;
 
 import static 
org.apache.ignite.internal.sql.engine.util.Commons.IN_BUFFER_SIZE;
-import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.List;
-import java.util.Objects;
 import java.util.stream.Stream;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.logger.IgniteLogger;
 import org.apache.ignite.internal.logger.Loggers;
-import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
-import 
org.apache.ignite.internal.schema.configuration.index.TableIndexConfiguration;
 import org.apache.ignite.table.Table;
-import org.jetbrains.annotations.Nullable;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.Arguments;
@@ -102,6 +94,7 @@ public class ItIndexSpoolTest extends 
AbstractBasicIntegrationTest {
         for (String name : List.of("TEST0", "TEST1")) {
             sql(String.format("CREATE TABLE " + name + "(id INT PRIMARY KEY, 
jid INT, val VARCHAR) WITH replicas=2,partitions=%d", parts));
 
+            // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
             waitForIndex(name + "_PK");
 
             // TODO: https://issues.apache.org/jira/browse/IGNITE-17304 
uncomment this
@@ -110,20 +103,4 @@ public class ItIndexSpoolTest extends 
AbstractBasicIntegrationTest {
             insertData(name, List.of("ID", "JID", "VAL"), dataRows);
         }
     }
-
-    private static void waitForIndex(String indexName) throws 
InterruptedException {
-        // FIXME: Wait for the index to be created on all nodes,
-        //  this is a workaround for 
https://issues.apache.org/jira/browse/IGNITE-18203 to avoid missed updates to 
the PK index.
-        assertTrue(waitForCondition(
-                () -> CLUSTER_NODES.stream().map(node -> 
getIndexConfiguration(node, indexName)).allMatch(Objects::nonNull),
-                10_000)
-        );
-    }
-
-    private static @Nullable TableIndexConfiguration 
getIndexConfiguration(Ignite node, String indexName) {
-        return ((IgniteImpl) node).clusterConfiguration()
-                .getConfiguration(TablesConfiguration.KEY)
-                .indexes()
-                .get(indexName.toUpperCase());
-    }
 }
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSecondaryIndexTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSecondaryIndexTest.java
index b2498853ba..320b91e786 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSecondaryIndexTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSecondaryIndexTest.java
@@ -23,17 +23,9 @@ import static 
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsIn
 import static 
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsSubPlan;
 import static 
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsTableScan;
 import static 
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsUnion;
-import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static org.hamcrest.Matchers.not;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.List;
-import java.util.Objects;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.app.IgniteImpl;
-import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
-import 
org.apache.ignite.internal.schema.configuration.index.TableIndexConfiguration;
-import org.jetbrains.annotations.Nullable;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
@@ -60,6 +52,7 @@ public class ItSecondaryIndexTest extends 
AbstractBasicIntegrationTest {
         sql("CREATE INDEX " + NAME_CITY_IDX + " ON developer (name DESC, city 
DESC)");
         sql("CREATE INDEX " + NAME_DEPID_CITY_IDX + " ON developer (name DESC, 
depid DESC, city DESC)");
 
+        // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
         waitForIndex(DEPID_IDX);
         waitForIndex(NAME_CITY_IDX);
         waitForIndex(NAME_DEPID_CITY_IDX);
@@ -93,6 +86,7 @@ public class ItSecondaryIndexTest extends 
AbstractBasicIntegrationTest {
         sql("CREATE TABLE unwrap_pk(f1 VARCHAR, f2 BIGINT, f3 BIGINT, f4 
BIGINT, primary key(f2, f1))");
         sql("CREATE INDEX " + PK_SORTED_IDX + " ON unwrap_pk(f2, f1)");
 
+        // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
         waitForIndex(PK_SORTED_IDX);
 
         insertData("UNWRAP_PK", List.of("F1", "F2", "F3", "F4"), new 
Object[][]{
@@ -108,6 +102,7 @@ public class ItSecondaryIndexTest extends 
AbstractBasicIntegrationTest {
         sql("CREATE TABLE t1 (id INT PRIMARY KEY, val INT)");
         sql("CREATE INDEX t1_idx on t1(val DESC)");
 
+        // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
         waitForIndex("t1_idx");
 
         insertData("T1", List.of("ID", "VAL"), new Object[][]{
@@ -121,22 +116,6 @@ public class ItSecondaryIndexTest extends 
AbstractBasicIntegrationTest {
         });
     }
 
-    private static void waitForIndex(String indexName) throws 
InterruptedException {
-        // FIXME: Wait for the sorted index to be created on all nodes,
-        //  this is a workaround for 
https://issues.apache.org/jira/browse/IGNITE-18203 to avoid missed updates to 
the sorted index.
-        assertTrue(waitForCondition(
-                () -> CLUSTER_NODES.stream().map(node -> 
getSortedIndexConfig(node, indexName)).allMatch(Objects::nonNull),
-                10_000)
-        );
-    }
-
-    private static @Nullable TableIndexConfiguration 
getSortedIndexConfig(Ignite node, String indexName) {
-        return ((IgniteImpl) node).clusterConfiguration()
-                .getConfiguration(TablesConfiguration.KEY)
-                .indexes()
-                .get(indexName.toUpperCase());
-    }
-
     @Test
     public void testEqualsFilterWithUnwrpKey() {
         assertQuery("SELECT F1 FROM UNWRAP_PK WHERE F2=2")
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
index e8e59e8acb..70c0841c5e 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
@@ -31,7 +31,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Flow.Publisher;
@@ -95,12 +94,8 @@ public class ItTableScanTest extends 
AbstractBasicIntegrationTest {
     public void beforeTest() throws InterruptedException {
         TableImpl table = getOrCreateTable();
 
-        // FIXME: Wait for the sorted index to be created on all nodes,
-        //  this is a workaround for 
https://issues.apache.org/jira/browse/IGNITE-18203 to avoid missed updates to 
the sorted index.
-        assertTrue(waitForCondition(
-                () -> 
CLUSTER_NODES.stream().map(ItTableScanTest::getSortedIndexConfig).allMatch(Objects::nonNull),
-                10_000)
-        );
+        // FIXME: https://issues.apache.org/jira/browse/IGNITE-18203
+        waitForIndex(SORTED_IDX);
 
         loadData(table);
     }

Reply via email to