tkalkirill commented on code in PR #2686:
URL: https://github.com/apache/ignite-3/pull/2686#discussion_r1357942407


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java:
##########
@@ -1230,15 +1231,31 @@ private void createTableWithData(List<IgniteImpl> 
nodes, String name, int replic
         }
     }
 
-    private void waitForIndex(Collection<IgniteImpl> nodes, 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-18733 to avoid missed updates to 
the PK index.
-        assertTrue(waitForCondition(
-                () -> nodes.stream()
-                        .map(nodeImpl -> 
nodeImpl.catalogManager().index(indexName.toUpperCase(), 
nodeImpl.clock().nowLong()))
-                        .allMatch(Objects::nonNull),
-                TIMEOUT_MILLIS
-        ));
+    private void waitForIndexToBecomeAvailable(Collection<IgniteImpl> nodes, 
String indexName) throws InterruptedException {
+        CountDownLatch latch = new CountDownLatch(nodes.size());
+
+        nodes.forEach(node -> 
node.catalogManager().listen(CatalogEvent.INDEX_AVAILABLE, (event, ex) -> {
+            if (ex != null) {
+                return failedFuture(ex);
+            }
+
+            MakeIndexAvailableEventParameters availableEvent = 
(MakeIndexAvailableEventParameters) event;
+
+            CatalogIndexDescriptor index = 
node.catalogManager().index(availableEvent.indexId(), 
HybridTimestamp.MAX_VALUE.longValue());

Review Comment:
   ```suggestion
               CatalogIndexDescriptor index = 
node.catalogManager().index(availableEvent.indexId(), event.catalogVersion());
   ```



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