zstan commented on code in PR #2712:
URL: https://github.com/apache/ignite-3/pull/2712#discussion_r1400074606


##########
modules/runner/src/testFixtures/java/org/apache/ignite/internal/ClusterPerClassIntegrationTest.java:
##########
@@ -227,4 +266,64 @@ public Person(int id, String name, double salary) {
             this.salary = salary;
         }
     }
+
+    /**
+     * Waits for some amount of time so that read-only transactions can 
observe the most recent version of the catalog.
+     */
+    protected static void waitForReadTimestampThatObservesMostRecentCatalog()  
{
+        // See TxManagerImpl::currentReadTimestamp.
+        long delay = HybridTimestamp.CLOCK_SKEW + 
TestIgnitionManager.DEFAULT_PARTITION_IDLE_SYNC_TIME_INTERVAL_MS;
+        try {
+            TimeUnit.MILLISECONDS.sleep(delay);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static List<List<Object>> executeAwaitingIndexes(IgniteImpl node, 
Function<IgniteImpl, List<List<Object>>> statement) {
+        CatalogManager catalogManager = node.catalogManager();
+
+        // Get existing indexes
+        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()
+                .map(CatalogObjectDescriptor::id)
+                .collect(Collectors.toSet());
+
+        difference.removeAll(existing);
+
+        if (difference.isEmpty()) {
+            return result;
+        }
+
+        // If there are new indexes, wait for them to become available.
+
+        try {
+            waitForCondition(() -> {

Review Comment:
   this await is still without assertion check.



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