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


##########
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);

Review Comment:
   > Time t1: CREATE INDEX - Index descriptor with available = false is added 
to the catalog. + schedules IndexBuild task.
   ...
   > Time t2: Some time later IndexBuild task completes and sets available = 
true to that index
   ...
   
   RW transaction works, RO transaction does. Here is why:
   
   A client can not won't observe an index in the catalog because read-only 
transaction as a delay, see TxManager::currentTimestamp.
   



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