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


##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java:
##########
@@ -386,38 +384,37 @@ private static List<List<Object>> 
executeAwaitingIndexes(IgniteImpl node, Functi
         CatalogManager catalogManager = node.catalogManager();
 
         // Get existing indexes
-        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion())
-                .stream().map(CatalogObjectDescriptor::id)
+        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+                .map(CatalogObjectDescriptor::id)
                 .collect(Collectors.toSet());
 
         List<List<Object>> result = statement.apply(node);
 
         // Get indexes after a statement and compute the difference
-        Set<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+        List<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
                 .map(CatalogObjectDescriptor::id)
-                .collect(Collectors.toSet());
-
-        difference.removeAll(existing);
+                .filter(id -> !existing.contains(id))
+                .collect(Collectors.toList());
 
         if (difference.isEmpty()) {
             return result;
         }
 
         // If there are new indexes, wait for them to become available.
+        HybridClock clock = node.clock();
 
         try {
-            assertTrue(waitForCondition(() -> {
-                int latestVersion = catalogManager.latestCatalogVersion();
-                int notAvailable = 0;
-
-                for (CatalogIndexDescriptor index : 
catalogManager.indexes(latestVersion)) {
-                    if (!index.available() && difference.contains(index.id())) 
{
-                        notAvailable++;
-                    }
-                }
-
-                return notAvailable == 0;
-            }, 10_000));
+            assertTrue(waitForCondition(
+                    () -> {
+                        long now = clock.nowLong();
+
+                        return difference.stream()
+                                .map(id -> catalogManager.index(id, now))
+                                .allMatch(indexDescriptor -> indexDescriptor 
!= null && indexDescriptor.available());
+                    },
+                    10,

Review Comment:
   Why other method waits so long? As I see you was single reviewer for that 
change )



##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java:
##########
@@ -386,38 +384,37 @@ private static List<List<Object>> 
executeAwaitingIndexes(IgniteImpl node, Functi
         CatalogManager catalogManager = node.catalogManager();
 
         // Get existing indexes
-        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion())
-                .stream().map(CatalogObjectDescriptor::id)
+        Set<Integer> existing = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+                .map(CatalogObjectDescriptor::id)
                 .collect(Collectors.toSet());
 
         List<List<Object>> result = statement.apply(node);
 
         // Get indexes after a statement and compute the difference
-        Set<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
+        List<Integer> difference = 
catalogManager.indexes(catalogManager.latestCatalogVersion()).stream()
                 .map(CatalogObjectDescriptor::id)
-                .collect(Collectors.toSet());
-
-        difference.removeAll(existing);
+                .filter(id -> !existing.contains(id))
+                .collect(Collectors.toList());
 
         if (difference.isEmpty()) {
             return result;
         }
 
         // If there are new indexes, wait for them to become available.
+        HybridClock clock = node.clock();
 
         try {
-            assertTrue(waitForCondition(() -> {
-                int latestVersion = catalogManager.latestCatalogVersion();
-                int notAvailable = 0;
-
-                for (CatalogIndexDescriptor index : 
catalogManager.indexes(latestVersion)) {
-                    if (!index.available() && difference.contains(index.id())) 
{
-                        notAvailable++;
-                    }
-                }
-
-                return notAvailable == 0;
-            }, 10_000));
+            assertTrue(waitForCondition(
+                    () -> {
+                        long now = clock.nowLong();
+
+                        return difference.stream()
+                                .map(id -> catalogManager.index(id, now))
+                                .allMatch(indexDescriptor -> indexDescriptor 
!= null && indexDescriptor.available());
+                    },
+                    10,

Review Comment:
   Why other method waits so long? As I see you was a single reviewer for that 
change )



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