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


##########
modules/index/src/main/java/org/apache/ignite/internal/index/ChangeIndexStatusTask.java:
##########
@@ -149,28 +158,33 @@ CompletableFuture<Void> start() {
         }
 
         try {
-            return supplyAsync(() -> 
awaitActivateForCatalogVersionOfIndexCreation()
-                    .thenCompose(unused -> 
ensureThatLocalNodeStillPrimaryReplica())
-                    .thenCompose(unused -> 
inBusyLocks(logicalTopologyService::logicalTopologyOnLeader))
-                    
.thenComposeAsync(this::awaitFinishRwTxsBeforeCatalogVersionOfIndexCreation, 
executor)
-                    .thenComposeAsync(unused -> switchIndexToBuildingStatus(), 
executor), executor)
-                    .thenCompose(Function.identity())
-                    .handle((unused, throwable) -> {
+            LOG.info("Starting task to change index status. Index: {}", 
indexDescriptor);
+
+            return awaitCatalogVersionActivation()

Review Comment:
   If you look at who calls this code, you can find that this happens on the 
metastore thread, which I want to release as soon as possible, if the futures 
are already completed, then the pipeline will be executed immediately, and we 
don’t know what’s inside it, maybe there are calculations that will take some 
time.
   
   Perhaps this looks like premature optimization or worrying from scratch, but 
I think we need to slightly change the way we use listeners on the metastore 
thread.



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